summary refs log tree commit diff stats
path: root/compiler/pragmas.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2019-01-11 16:34:22 +0100
committerGitHub <noreply@github.com>2019-01-11 16:34:22 +0100
commit5397c5d31d58f14ad39e8009882a87ceda6253aa (patch)
tree9cccf3d837316b1a5d39e7dd0c633a184fdb42c9 /compiler/pragmas.nim
parentd1b7aa28e7b5b847a44eda11ff7aadbe3bb0b49a (diff)
downloadNim-5397c5d31d58f14ad39e8009882a87ceda6253aa.tar.gz
fixes #10216 (#10270)
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r--compiler/pragmas.nim19
1 files changed, 11 insertions, 8 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index bb5707cd5..b1a88ace7 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -64,10 +64,10 @@ const
   varPragmas* = {wImportc, wExportc, wVolatile, wRegister, wThreadVar, wNodecl,
     wMagic, wHeader, wDeprecated, wCompilerProc, wCore, wDynlib, wExtern,
     wImportCpp, wImportObjC, wError, wNoInit, wCompileTime, wGlobal,
-    wGensym, wInject, wCodegenDecl, wGuard, wGoto, wExportNims, wUsed, wRaises}
+    wGensym, wInject, wCodegenDecl, wGuard, wGoto, wExportNims, wUsed}
   constPragmas* = {wImportc, wExportc, wHeader, wDeprecated, wMagic, wNodecl,
     wExtern, wImportCpp, wImportObjC, wError, wGensym, wInject, wExportNims,
-    wIntDefine, wStrDefine, wUsed, wCompilerProc, wCore, wRaises}
+    wIntDefine, wStrDefine, wUsed, wCompilerProc, wCore}
   letPragmas* = varPragmas
   procTypePragmas* = {FirstCallConv..LastCallConv, wVarargs, wNosideeffect,
                       wThread, wRaises, wLocks, wTags, wGcSafe}
@@ -1119,13 +1119,16 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
         else: sym.flags.incl sfUsed
       of wLiftLocals: discard
       else: invalidPragma(c, it)
-    elif sym == nil or (sym != nil and sym.kind in {skVar, skLet, skParam, 
-                      skField, skProc, skFunc, skConverter, skMethod, skType}):
-      n.sons[i] = semCustomPragma(c, it)
-    elif sym != nil:
-      illegalCustomPragma(c, it, sym)
+    elif comesFromPush and whichKeyword(ident) in {wTags, wRaises}:
+      discard "ignore the .push pragma; it doesn't apply"
     else:
-      invalidPragma(c, it)
+      if sym == nil or (sym != nil and sym.kind in {skVar, skLet, skParam,
+                        skField, skProc, skFunc, skConverter, skMethod, skType}):
+        n.sons[i] = semCustomPragma(c, it)
+      elif sym != nil:
+        illegalCustomPragma(c, it, sym)
+      else:
+        invalidPragma(c, it)
 
 proc mergePragmas(n, pragmas: PNode) =
   if n[pragmasPos].kind == nkEmpty: