diff options
author | Zahary Karadjov <zahary@gmail.com> | 2013-05-11 22:47:37 +0300 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2013-05-11 22:47:37 +0300 |
commit | f44a4362bbb74255b8781951c6b1286100176ef3 (patch) | |
tree | 02793b12db243c31e8d0136833cb7621c9f1c0a7 /compiler/pragmas.nim | |
parent | 40b411fb1c319a74daedce524c5d821b6bdc0e45 (diff) | |
download | Nim-f44a4362bbb74255b8781951c6b1286100176ef3.tar.gz |
added a ``noforward`` pragma that enables a new compilation strategy
not requiring forward declarations on a per-module basis
Diffstat (limited to 'compiler/pragmas.nim')
-rw-r--r-- | compiler/pragmas.nim | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index ba761739a..ed3c44e1c 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -42,7 +42,7 @@ const wFatal, wDefine, wUndef, wCompile, wLink, wLinkSys, wPure, wPush, wPop, wBreakpoint, wWatchpoint, wPassL, wPassC, wDeadCodeElim, wDeprecated, wFloatChecks, wInfChecks, wNanChecks, wPragma, wEmit, wUnroll, - wLinearScanEnd, wPatterns, wEffects} + wLinearScanEnd, wPatterns, wEffects, wNoForward} lambdaPragmas* = {FirstCallConv..LastCallConv, wImportc, wExportc, wNodecl, wNosideEffect, wSideEffect, wNoreturn, wDynLib, wHeader, wDeprecated, wExtern, wThread, wImportcpp, wImportobjc, wNoStackFrame, @@ -182,7 +182,11 @@ proc onOff(c: PContext, n: PNode, op: TOptions) = proc pragmaDeadCodeElim(c: PContext, n: PNode) = if IsTurnedOn(c, n): incl(c.module.flags, sfDeadCodeElim) else: excl(c.module.flags, sfDeadCodeElim) - + +proc pragmaNoForward(c: PContext, n: PNode) = + if IsTurnedOn(c, n): incl(c.module.flags, sfNoForward) + else: excl(c.module.flags, sfNoForward) + proc processCallConv(c: PContext, n: PNode) = if (n.kind == nkExprColonExpr) and (n.sons[1].kind == nkIdent): var sw = whichKeyword(n.sons[1].ident) @@ -552,6 +556,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: int, noVal(it) incl(sym.flags, sfThread) of wDeadCodeElim: pragmaDeadCodeElim(c, it) + of wNoForward: pragmaNoForward(c, it) of wMagic: processMagic(c, it, sym) of wCompileTime: noVal(it) |