Added `global` pragma that can be used to introduce new global variables from within procs

This commit is contained in:
Zahary Karadjov 2012-04-05 19:20:52 +03:00
commit 6d80583d5a
6 changed files with 22 additions and 10 deletions

View file

@ -51,7 +51,7 @@ const
wImportcpp, wImportobjc, wError}
varPragmas* = {wImportc, wExportc, wVolatile, wRegister, wThreadVar, wNodecl,
wMagic, wHeader, wDeprecated, wCompilerProc, wDynLib, wExtern,
wImportcpp, wImportobjc, wError, wNoInit, wCompileTime}
wImportcpp, wImportobjc, wError, wNoInit, wCompileTime, wGlobal}
constPragmas* = {wImportc, wExportc, wHeader, wDeprecated, wMagic, wNodecl,
wExtern, wImportcpp, wImportobjc, wError}
letPragmas* = varPragmas
@ -494,6 +494,9 @@ proc pragma(c: PContext, sym: PSym, n: PNode, validPragmas: TSpecialWords) =
noVal(it)
incl(sym.flags, sfCompileTime)
incl(sym.loc.Flags, lfNoDecl)
of wGlobal:
noVal(it)
incl(sym.flags, sfGlobal)
of wMerge:
noval(it)
incl(sym.flags, sfMerge)