summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorcooldome <cdome@bk.ru>2018-01-18 09:38:55 +0000
committerAndreas Rumpf <rumpf_a@web.de>2018-01-18 10:38:55 +0100
commit27aab0be162de4cca6132b46c12d98ce9c83d60e (patch)
tree7954f6bfb3b7586a7571b063ce3b5b6991d3450e /compiler/semstmts.nim
parentd9c922fc70b226b1c64c11d5ed3599c7b9322fd5 (diff)
downloadNim-27aab0be162de4cca6132b46c12d98ce9c83d60e.tar.gz
Custom pragmas in procs bug fix (#7086)
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index ccddabcbe..78833adad 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1143,7 +1143,7 @@ proc semProcAnnotation(c: PContext, prc: PNode;
   if n == nil or n.kind == nkEmpty: return
   for i in countup(0, n.len-1):
     var it = n.sons[i]
-    var key = if it.kind == nkExprColonExpr: it.sons[0] else: it
+    var key = if it.kind in nkPragmaCallKinds and it.len >= 1: it.sons[0] else: it
     let m = lookupMacro(c, key)
     if m == nil:
       if key.kind == nkIdent and key.ident.id == ord(wDelegator):
@@ -1164,10 +1164,12 @@ proc semProcAnnotation(c: PContext, prc: PNode;
     if prc[pragmasPos].kind != nkEmpty and prc[pragmasPos].len == 0:
       prc.sons[pragmasPos] = emptyNode
 
-    if it.kind == nkExprColonExpr:
-      # pass pragma argument to the macro too:
-      x.add(it.sons[1])
+    if it.kind in nkPragmaCallKinds and it.len > 1:
+      # pass pragma arguments to the macro too:
+      for i in 1..<it.len:
+        x.add(it.sons[i])
     x.add(prc)
+    
     # recursion assures that this works for multiple macro annotations too:
     result = semExpr(c, x)
     # since a proc annotation can set pragmas, we process these here again.