diff options
author | Araq <rumpf_a@web.de> | 2013-06-27 18:13:11 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-06-27 18:13:11 +0200 |
commit | 139562cc643c7a4b201b25892d9cc949d3c4e5b8 (patch) | |
tree | d4bf55ee5ddb6541cdafd39fe02d7a611a3dfa75 /compiler/pragmas.nim | |
parent | 6d7ad6698296f9460fe3bf5fe4a3ef188608a9f5 (diff) | |
download | Nim-139562cc643c7a4b201b25892d9cc949d3c4e5b8.tar.gz |
implements the 'codegenDecl' pragma
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r-- | compiler/pragmas.nim | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index cecec8e5e..8f3da9f38 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -23,7 +23,7 @@ const wMagic, wNosideEffect, wSideEffect, wNoreturn, wDynLib, wHeader, wCompilerProc, wProcVar, wDeprecated, wVarargs, wCompileTime, wMerge, wBorrow, wExtern, wImportCompilerProc, wThread, wImportCpp, wImportObjC, - wNoStackFrame, wError, wDiscardable, wNoInit, wDestructor, wHoist, + wNoStackFrame, wError, wDiscardable, wNoInit, wDestructor, wCodegenDecl, wGenSym, wInject, wRaises, wTags} converterPragmas* = procPragmas methodPragmas* = procPragmas @@ -56,7 +56,7 @@ const varPragmas* = {wImportc, wExportc, wVolatile, wRegister, wThreadVar, wNodecl, wMagic, wHeader, wDeprecated, wCompilerProc, wDynLib, wExtern, wImportcpp, wImportobjc, wError, wNoInit, wCompileTime, wGlobal, - wGenSym, wInject} + wGenSym, wInject, wCodegenDecl} constPragmas* = {wImportc, wExportc, wHeader, wDeprecated, wMagic, wNodecl, wExtern, wImportcpp, wImportobjc, wError, wGenSym, wInject} letPragmas* = varPragmas @@ -147,7 +147,10 @@ proc expectIntLit(c: PContext, n: PNode): int = proc getOptionalStr(c: PContext, n: PNode, defaultStr: string): string = if n.kind == nkExprColonExpr: result = expectStrLit(c, n) else: result = defaultStr - + +proc processCodegenDecl(c: PContext, n: PNode, sym: PSym) = + sym.constraint = getStrLitNode(c, n) + proc processMagic(c: PContext, n: PNode, s: PSym) = #if sfSystemModule notin c.module.flags: # liMessage(n.info, errMagicOnlyInSystem) @@ -669,9 +672,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int, of wNoInit: noVal(it) if sym != nil: incl(sym.flags, sfNoInit) - of wHoist: - noVal(it) - if sym != nil: incl(sym.flags, sfHoist) + of wCodegenDecl: processCodegenDecl(c, it, sym) of wChecks, wObjChecks, wFieldChecks, wRangechecks, wBoundchecks, wOverflowchecks, wNilchecks, wAssertions, wWarnings, wHints, wLinedir, wStacktrace, wLinetrace, wOptimization, |