diff options
author | andri lim <jangko128@gmail.com> | 2018-07-21 00:48:12 +0700 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2018-07-20 19:48:12 +0200 |
commit | 9c3336dcffcb10f662f5c358f63d073db1454116 (patch) | |
tree | 672adf24925d0eeddfd265164d9915958f023815 /lib/core/macros.nim | |
parent | 060871e64ac9d665430d4d9ae912bf7a379ee976 (diff) | |
download | Nim-9c3336dcffcb10f662f5c358f63d073db1454116.tar.gz |
fixes #8371, macros.hasCustomPragma doesn't crash anymore (#8378)
* fixes #8371, macros.hasCustomPragma doesn't crash anymore * fix macros.hasCustomPragma
Diffstat (limited to 'lib/core/macros.nim')
-rw-r--r-- | lib/core/macros.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 8a1be3720..345c53b08 100644 --- a/lib/core/macros.nim +++ b/lib/core/macros.nim @@ -1284,7 +1284,7 @@ proc customPragmaNode(n: NimNode): NimNode = let 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] elif typ.typeKind == ntyTypeDesc: let impl = typ[1].getImpl() @@ -1319,6 +1319,8 @@ proc customPragmaNode(n: NimNode): NimNode = if identDefs.kind == nnkRecCase: identDefsStack.add(identDefs[0]) for i in 1..<identDefs.len: + # if it is and empty branch, skip + if identDefs[i][0].kind == nnkNilLit: continue if identDefs[i][1].kind == nnkIdentDefs: identDefsStack.add(identDefs[i][1]) else: # nnkRecList |