summary refs log tree commit diff stats
path: root/lib/core/macros.nim
diff options
context:
space:
mode:
authorRSDuck <RSDuck@users.noreply.github.com>2018-04-19 11:07:45 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-04-19 11:07:45 +0200
commit34029263725ef931863ea73966dc08588758dada (patch)
tree90ad5bd8291401c69d7a5baa6af213d5a1dd5415 /lib/core/macros.nim
parent0dc4d6dcc28a6e35f36caaa5bcc801b4acac61b4 (diff)
downloadNim-34029263725ef931863ea73966dc08588758dada.tar.gz
hasCustomPragma/getCustomPragmaVal: small fix (#7650)
* fix hasCustomPragma/getCustomPragmaVal for types without pragma

* fix pragma on pointer test

* removed trailing spaces
Diffstat (limited to 'lib/core/macros.nim')
-rw-r--r--lib/core/macros.nim6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/core/macros.nim b/lib/core/macros.nim
index b050eb6c8..1dc067e1a 100644
--- a/lib/core/macros.nim
+++ b/lib/core/macros.nim
@@ -1288,7 +1288,11 @@ proc customPragmaNode(n: NimNode): NimNode =
     typ = n.getTypeInst()
 
   if typ.typeKind == ntyTypeDesc:
-    return typ[1].getImpl()[0][1]
+    let impl = typ[1].getImpl()
+    if impl[0].kind == nnkPragmaExpr:
+      return impl[0][1]
+    else:
+      return impl[0] # handle types which don't have macro at all
 
   if n.kind == nnkSym: # either an variable or a proc
     let impl = n.getImpl()