summary refs log tree commit diff stats
path: root/compiler/pragmas.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-06-09 23:29:43 +0200
committerAraq <rumpf_a@web.de>2013-06-09 23:29:43 +0200
commit23ef565a3c2c1f83816fefbeadb0fc59e754997d (patch)
tree7a2adeeb6f3215c35ff0b7fdeeee6f9907308931 /compiler/pragmas.nim
parent2aaa8f7909e51eb3d971e197f152e247c64362e9 (diff)
downloadNim-23ef565a3c2c1f83816fefbeadb0fc59e754997d.tar.gz
implemented large parts of the 'not nil' checking
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r--compiler/pragmas.nim10
1 files changed, 7 insertions, 3 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index cc432aea8..cecec8e5e 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -50,7 +50,7 @@ const
   typePragmas* = {wImportc, wExportc, wDeprecated, wMagic, wAcyclic, wNodecl, 
     wPure, wHeader, wCompilerProc, wFinal, wSize, wExtern, wShallow, 
     wImportcpp, wImportobjc, wError, wIncompleteStruct, wByCopy, wByRef,
-    wInheritable, wGenSym, wInject}
+    wInheritable, wGenSym, wInject, wRequiresInit}
   fieldPragmas* = {wImportc, wExportc, wDeprecated, wExtern, 
     wImportcpp, wImportobjc, wError}
   varPragmas* = {wImportc, wExportc, wVolatile, wRegister, wThreadVar, wNodecl, 
@@ -253,11 +253,11 @@ proc processNote(c: PContext, n: PNode) =
     of wHint:
       var x = findStr(msgs.HintsToStr, n.sons[0].sons[1].ident.s)
       if x >= 0: nk = TNoteKind(x + ord(hintMin))
-      else: invalidPragma(n)
+      else: invalidPragma(n); return
     of wWarning:
       var x = findStr(msgs.WarningsToStr, n.sons[0].sons[1].ident.s)
       if x >= 0: nk = TNoteKind(x + ord(warnMin))
-      else: InvalidPragma(n)
+      else: InvalidPragma(n); return
     else:
       invalidPragma(n)
       return
@@ -695,6 +695,10 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
           noVal(it)
           if sym.typ == nil: invalidPragma(it)
           else: incl(sym.typ.flags, tfIncompleteStruct)
+        of wRequiresInit:
+          noVal(it)
+          if sym.typ == nil: invalidPragma(it)
+          else: incl(sym.typ.flags, tfNeedsInit)
         of wByRef:
           noVal(it)
           if sym == nil or sym.typ == nil: