More robust findPragma

This commit is contained in:
Zahary Karadjov 2019-06-05 03:14:54 +03:00
parent 5e03d90ad3
commit 58a313d8eb
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 2 additions and 2 deletions

View File

@ -18,9 +18,9 @@ const
proc findPragma*(pragmas: NimNode, pragmaSym: NimNode): NimNode = proc findPragma*(pragmas: NimNode, pragmaSym: NimNode): NimNode =
for p in pragmas: for p in pragmas:
if p.kind == nnkSym and p == pragmaSym: if p.kind in {nnkSym, nnkIdent} and eqIdent(p, pragmaSym):
return p return p
if p.kind in nnkPragmaCallKinds and p.len > 0 and p[0].kind == nnkSym and p[0] == pragmaSym: if p.kind in nnkPragmaCallKinds and p.len > 0 and eqIdent(p[0], pragmaSym):
return p return p
iterator recordFields*(typeImpl: NimNode): FieldDescription = iterator recordFields*(typeImpl: NimNode): FieldDescription =