summary refs log tree commit diff stats
path: root/compiler/semstmts.nim
diff options
context:
space:
mode:
authorAndrii Riabushenko <cdome@bk.ru>2018-12-11 23:35:46 +0000
committerAndrii Riabushenko <cdome@bk.ru>2018-12-11 23:35:46 +0000
commitdf0f0f28589c6aad9fc34a924194aa9932120e6e (patch)
tree0637ab6b024e33530b5b57ca56fcf6054b587bc8 /compiler/semstmts.nim
parentcd81f368d184dae6268ccf5f4bdc771a661f4ac1 (diff)
downloadNim-df0f0f28589c6aad9fc34a924194aa9932120e6e.tar.gz
custom pragmas in pragma blocks
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r--compiler/semstmts.nim12
1 files changed, 5 insertions, 7 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index 04fe91cfb..aec03b492 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -1876,18 +1876,16 @@ proc setLine(n: PNode, info: TLineInfo) =
   n.info = info
 
 proc semPragmaBlock(c: PContext, n: PNode): PNode =
+  checkSonsLen(n, 2, c.config)
   let pragmaList = n.sons[0]
   pragma(c, nil, pragmaList, exprPragmas)
-  result = semExpr(c, n.sons[1])
-  n.sons[1] = result
+  n[1] = semExpr(c, n[1])
+  result = n
+  result.typ = n[1].typ
   for i in 0 ..< pragmaList.len:
     case whichPragma(pragmaList.sons[i])
     of wLine: setLine(result, pragmaList.sons[i].info)
-    of wLocks, wGcSafe, wNosideeffect:
-      result = n
-      result.typ = n.sons[1].typ
-    of wNoRewrite:
-      incl(result.flags, nfNoRewrite)
+    of wNoRewrite: incl(result.flags, nfNoRewrite)
     else: discard
 
 proc semStaticStmt(c: PContext, n: PNode): PNode =