use typeof instead type (#16962)

This commit is contained in:
flywind 2021-02-08 02:46:07 -06:00 • committed by GitHub
commit d447c0fe3f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 253 additions and 253 deletions

View file

@ -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))