parent
b08c50bb55
commit
f7c203fb6c
27 changed files with 432 additions and 1032 deletions
|
|
@ -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`.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 = "("
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue