From 9c3336dcffcb10f662f5c358f63d073db1454116 Mon Sep 17 00:00:00 2001 From: andri lim Date: Sat, 21 Jul 2018 00:48:12 +0700 Subject: [PATCH] fixes #8371, macros.hasCustomPragma doesn't crash anymore (#8378) * fixes #8371, macros.hasCustomPragma doesn't crash anymore * fix macros.hasCustomPragma --- lib/core/macros.nim | 4 +++- tests/pragmas/tcustom_pragma.nim | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/lib/core/macros.nim b/lib/core/macros.nim index 8a1be3720b..345c53b088 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..