summary refs log tree commit diff stats
path: root/compiler/pragmas.nim
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-02-28 23:22:47 +0100
committerAndreas Rumpf <rumpf_a@web.de>2016-02-28 23:22:47 +0100
commit0baa1d995581ce9b6c00db1dc84a2d2383440c7f (patch)
treedd1f689c627ca3a81da8d6b43d849120ea4a1d5d /compiler/pragmas.nim
parent38dee2095c3b04e0f6eb8e5e9751ab7b4755d3e8 (diff)
downloadNim-0baa1d995581ce9b6c00db1dc84a2d2383440c7f.tar.gz
first version of .partial objects
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r--compiler/pragmas.nim11
1 files changed, 10 insertions, 1 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index d4996981d..2280ef712 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -55,7 +55,7 @@ const
     wPure, wHeader, wCompilerproc, wFinal, wSize, wExtern, wShallow,
     wImportCpp, wImportObjC, wError, wIncompleteStruct, wByCopy, wByRef,
     wInheritable, wGensym, wInject, wRequiresInit, wUnchecked, wUnion, wPacked,
-    wBorrow, wGcSafe, wExportNims}
+    wBorrow, wGcSafe, wExportNims, wPartial}
   fieldPragmas* = {wImportc, wExportc, wDeprecated, wExtern,
     wImportCpp, wImportObjC, wError, wGuard, wBitsize}
   varPragmas* = {wImportc, wExportc, wVolatile, wRegister, wThreadVar, wNodecl,
@@ -835,6 +835,15 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int,
         noVal(it)
         if sym.kind != skType or sym.typ == nil: invalidPragma(it)
         else: incl(sym.typ.flags, tfByCopy)
+      of wPartial:
+        noVal(it)
+        if sym.kind != skType or sym.typ == nil: invalidPragma(it)
+        else:
+          incl(sym.typ.flags, tfPartial)
+          # .partial types can only work with dead code elimination
+          # to prevent the codegen from doing anything before we compiled
+          # the whole program:
+          incl gGlobalOptions, optDeadCodeElim
       of wInject, wGensym:
         # We check for errors, but do nothing with these pragmas otherwise
         # as they are handled directly in 'evalTemplate'.