Tweak type walking in private/macros
This commit is contained in:
parent
6008b0ba25
commit
335dcd2987
|
@ -1,6 +1,6 @@
|
||||||
# Package
|
# Package
|
||||||
|
|
||||||
version = "20230720"
|
version = "20230723"
|
||||||
author = "Emery Hemingway"
|
author = "Emery Hemingway"
|
||||||
description = "data model and serialization format"
|
description = "data model and serialization format"
|
||||||
license = "Unlicense"
|
license = "Unlicense"
|
||||||
|
|
|
@ -30,16 +30,16 @@ proc extractTypeImpl(n: NimNode): NimNode =
|
||||||
|
|
||||||
proc customPragmaNode(n: NimNode): NimNode =
|
proc customPragmaNode(n: NimNode): NimNode =
|
||||||
expectKind(n, {nnkSym, nnkDotExpr, nnkBracketExpr, nnkTypeOfExpr, nnkType, nnkCheckedFieldExpr})
|
expectKind(n, {nnkSym, nnkDotExpr, nnkBracketExpr, nnkTypeOfExpr, nnkType, nnkCheckedFieldExpr})
|
||||||
let
|
var
|
||||||
typ = n.getTypeInst()
|
typ = n.getTypeInst()
|
||||||
|
|
||||||
if typ.kind == nnkBracketExpr and typ.len > 1 and typ[1].kind == nnkProcTy:
|
if typ.kind == nnkBracketExpr and typ.len > 1 and typ[1].kind == nnkProcTy:
|
||||||
return typ[1][1]
|
return typ[1][1]
|
||||||
elif typ.typeKind == ntyTypeDesc:
|
elif typ.typeKind == ntyTypeDesc:
|
||||||
let impl = getImpl(
|
typ = typ[1]
|
||||||
if kind(typ[1]) == nnkBracketExpr: typ[1][0]
|
while kind(typ) == nnkBracketExpr:
|
||||||
else: typ[1]
|
typ = typ[0]
|
||||||
)
|
let impl = getImpl(typ)
|
||||||
if impl.kind == nnkNilLit:
|
if impl.kind == nnkNilLit:
|
||||||
return impl
|
return impl
|
||||||
elif impl[0].kind == nnkPragmaExpr:
|
elif impl[0].kind == nnkPragmaExpr:
|
||||||
|
|
Loading…
Reference in New Issue