Tweak type walking in private/macros

This commit is contained in:
Emery Hemingway 2023-07-23 08:26:35 +01:00
parent 6008b0ba25
commit 335dcd2987
2 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
# Package
version = "20230720"
version = "20230723"
author = "Emery Hemingway"
description = "data model and serialization format"
license = "Unlicense"

View File

@ -30,16 +30,16 @@ proc extractTypeImpl(n: NimNode): NimNode =
proc customPragmaNode(n: NimNode): NimNode =
expectKind(n, {nnkSym, nnkDotExpr, nnkBracketExpr, nnkTypeOfExpr, nnkType, nnkCheckedFieldExpr})
let
var
typ = n.getTypeInst()
if typ.kind == nnkBracketExpr and typ.len > 1 and typ[1].kind == nnkProcTy:
return typ[1][1]
elif typ.typeKind == ntyTypeDesc:
let impl = getImpl(
if kind(typ[1]) == nnkBracketExpr: typ[1][0]
else: typ[1]
)
typ = typ[1]
while kind(typ) == nnkBracketExpr:
typ = typ[0]
let impl = getImpl(typ)
if impl.kind == nnkNilLit:
return impl
elif impl[0].kind == nnkPragmaExpr: