summary refs log tree commit diff stats
path: root/compiler/pragmas.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-11-26 23:28:02 +0100
committerAndreas Rumpf <rumpf_a@web.de>2018-11-27 00:36:29 +0100
commit413580bc0444fc9d8e01b6af01433f8c08d2d298 (patch)
tree1b1d5b7ce15100a612621a1cd8871257c4359784 /compiler/pragmas.nim
parent93cf0ef52ef81af15009566f90e0d020903e8c2b (diff)
downloadNim-413580bc0444fc9d8e01b6af01433f8c08d2d298.tar.gz
new minor language feature: .noSideEffect blocks like .gcsafe blocks
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r--compiler/pragmas.nim7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index 62f70a090..2ce6b2231 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -38,7 +38,7 @@ const
     wImportc, wExportc, wNodecl, wMagic, wDeprecated, wBorrow, wExtern,
     wImportCpp, wImportObjC, wError, wDiscardable, wGensym, wInject, wRaises,
     wTags, wLocks, wGcSafe, wExportNims, wUsed}
-  exprPragmas* = {wLine, wLocks, wNoRewrite, wGcSafe}
+  exprPragmas* = {wLine, wLocks, wNoRewrite, wGcSafe, wNosideeffect}
   stmtPragmas* = {wChecks, wObjChecks, wFieldChecks, wRangechecks,
     wBoundchecks, wOverflowchecks, wNilchecks, wMovechecks, wAssertions,
     wWarnings, wHints,
@@ -855,8 +855,9 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
         sym.flags.incl sfOverriden
       of wNosideeffect:
         noVal(c, it)
-        incl(sym.flags, sfNoSideEffect)
-        if sym.typ != nil: incl(sym.typ.flags, tfNoSideEffect)
+        if sym != nil:
+          incl(sym.flags, sfNoSideEffect)
+          if sym.typ != nil: incl(sym.typ.flags, tfNoSideEffect)
       of wSideeffect:
         noVal(c, it)
         incl(sym.flags, sfSideEffect)