remove legacy code (#21134)

* remove legacy code

* fixes
This commit is contained in:
ringabout 2022-12-26 20:20:05 +08:00 • committed by GitHub
commit f7c203fb6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
27 changed files with 432 additions and 1032 deletions

View file

@ -23,8 +23,6 @@ proc `$`(info: InstantiationInfo): string =
# ---------------------------------------------------------------------------
when not defined(nimHasSinkInference):
{.pragma: nosinks.}
proc raiseAssert*(msg: string) {.noinline, noreturn, nosinks.} =
## Raises an `AssertionDefect` with `msg`.

View file

@ -37,22 +37,8 @@ from typetraits import OrdinalEnum, tupleLen
when defined(nimPreviewSlimSystem):
import std/assertions
when not defined(nimFixedForwardGeneric):
# xxx remove pending csources_v1 update >= 1.2.0
proc to[T](node: JsonNode, t: typedesc[T]): T =
when T is string: node.getStr
elif T is bool: node.getBool
else: static: doAssert false, $T # support as needed (only needed during bootstrap)
proc isNamedTuple(T: typedesc): bool = # old implementation
when T isnot tuple: result = false
else:
var t: T
for name, _ in t.fieldPairs:
when name == "Field0": return compiles(t.Field0)
else: return true
return false
else:
proc isNamedTuple(T: typedesc): bool {.magic: "TypeTrait".}
proc isNamedTuple(T: typedesc): bool {.magic: "TypeTrait".}
type
Joptions* = object # xxx rename FromJsonOptions

View file

@ -13,21 +13,7 @@ template toLocation*(result: var string, file: string | cstring, line: int, col:
addInt(result, col)
result.add ")"
when defined(nimHasIsNamedTuple):
proc isNamedTuple(T: typedesc): bool {.magic: "TypeTrait".}
else:
# for bootstrap; remove after release 1.2
proc isNamedTuple(T: typedesc): bool =
# Taken from typetraits.
when T isnot tuple: result = false
else:
var t: T
for name, _ in t.fieldPairs:
when name == "Field0":
return compiles(t.Field0)
else:
return true
return false
proc isNamedTuple(T: typedesc): bool {.magic: "TypeTrait".}
template tupleObjectDollar*[T: tuple | object](result: var string, x: T) =
result = "("