summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-12-01 16:12:46 +0100
committerGitHub <noreply@github.com>2018-12-01 16:12:46 +0100
commitc74226f4c1d156f2124783ac4464a8473d79c651 (patch)
treeba04c0e5cf5733ce35566aeefc7a121ab96a3aa1
parent3f546b70edab2930452a467368c6d34694cea22a (diff)
downloadNim-c74226f4c1d156f2124783ac4464a8473d79c651.tar.gz
enables .raises: [] via a .push (#9834) [backport]
-rw-r--r--compiler/pragmas.nim9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index 2ce6b2231..3d8e5645b 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -1119,6 +1119,12 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
     else:
       invalidPragma(c, it)
 
+proc mergePragmas(n, pragmas: PNode) =
+  if n[pragmasPos].kind == nkEmpty:
+    n[pragmasPos] = pragmas
+  else:
+    for p in pragmas: n.sons[pragmasPos].add p
+
 proc implicitPragmas*(c: PContext, sym: PSym, n: PNode,
                       validPragmas: TSpecialWords) =
   if sym != nil and sym.kind != skModule:
@@ -1127,11 +1133,12 @@ proc implicitPragmas*(c: PContext, sym: PSym, n: PNode,
       if not o.isNil:
         pushInfoContext(c.config, n.info)
         var i = 0
-        while i < o.len():
+        while i < o.len:
           if singlePragma(c, sym, o, i, validPragmas):
             internalError(c.config, n.info, "implicitPragmas")
           inc i
         popInfoContext(c.config)
+        if sym.kind in routineKinds: mergePragmas(sym.ast, o)
 
     if lfExportLib in sym.loc.flags and sfExportc notin sym.flags:
       localError(c.config, n.info, ".dynlib requires .exportc")