use typeof instead type (#16962)
This commit is contained in:
parent
4fac8af0c9
commit
d447c0fe3f
31 changed files with 253 additions and 253 deletions
|
|
@ -791,7 +791,7 @@ when declared(float128):
|
|||
|
||||
proc newLit*(arg: enum): NimNode {.compileTime.} =
|
||||
result = newCall(
|
||||
arg.type.getTypeInst[1],
|
||||
arg.typeof.getTypeInst[1],
|
||||
newLit(int(arg))
|
||||
)
|
||||
|
||||
|
|
@ -801,13 +801,13 @@ proc newLit*[T](s: set[T]): NimNode {.compileTime.}
|
|||
proc newLit*[T: tuple](arg: T): NimNode {.compileTime.}
|
||||
|
||||
proc newLit*(arg: object): NimNode {.compileTime.} =
|
||||
result = nnkObjConstr.newTree(arg.type.getTypeInst[1])
|
||||
result = nnkObjConstr.newTree(arg.typeof.getTypeInst[1])
|
||||
for a, b in arg.fieldPairs:
|
||||
result.add nnkExprColonExpr.newTree( newIdentNode(a), newLit(b) )
|
||||
|
||||
proc newLit*(arg: ref object): NimNode {.compileTime.} =
|
||||
## produces a new ref type literal node.
|
||||
result = nnkObjConstr.newTree(arg.type.getTypeInst[1])
|
||||
result = nnkObjConstr.newTree(arg.typeof.getTypeInst[1])
|
||||
for a, b in fieldPairs(arg[]):
|
||||
result.add nnkExprColonExpr.newTree(newIdentNode(a), newLit(b))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue