diff options
author | Andreas Rumpf <andreas@andreas-desktop> | 2010-03-05 12:55:13 +0100 |
---|---|---|
committer | Andreas Rumpf <andreas@andreas-desktop> | 2010-03-05 12:55:13 +0100 |
commit | 13c69f5540a0527f11357d63ba5a2c15adaa42cb (patch) | |
tree | a6e401c273507be21ffb5660e9c40f98c39f4944 /rod | |
parent | a22d6b7e683eaabaa935dd387fb2de95ef4bfd40 (diff) | |
download | Nim-13c69f5540a0527f11357d63ba5a2c15adaa42cb.tar.gz |
Bugfix: macros can be exported again
Diffstat (limited to 'rod')
-rwxr-xr-x | rod/lookups.nim | 27 | ||||
-rwxr-xr-x | rod/semstmts.nim | 4 | ||||
-rwxr-xr-x | rod/semtypes.nim | 17 |
3 files changed, 23 insertions, 25 deletions
diff --git a/rod/lookups.nim b/rod/lookups.nim index e545ad3e6..474933604 100755 --- a/rod/lookups.nim +++ b/rod/lookups.nim @@ -69,6 +69,17 @@ proc addDecl(c: PContext, sym: PSym) = proc addDeclAt(c: PContext, sym: PSym, at: Natural) = if SymTabAddUniqueAt(c.tab, sym, at) == Failure: liMessage(sym.info, errAttemptToRedefine, sym.Name.s) + +proc AddInterfaceDeclAux(c: PContext, sym: PSym) = + if (sfInInterface in sym.flags): + # add to interface: + if c.module == nil: InternalError(sym.info, "AddInterfaceDeclAux") + StrTableAdd(c.module.tab, sym) + if getCurrOwner().kind == skModule: incl(sym.flags, sfGlobal) + +proc addInterfaceDeclAt*(c: PContext, sym: PSym, at: Natural) = + addDeclAt(c, sym, at) + AddInterfaceDeclAux(c, sym) proc addOverloadableSymAt(c: PContext, fn: PSym, at: Natural) = if not (fn.kind in OverloadableSyms): @@ -77,13 +88,6 @@ proc addOverloadableSymAt(c: PContext, fn: PSym, at: Natural) = if (check != nil) and not (check.Kind in OverloadableSyms): liMessage(fn.info, errAttemptToRedefine, fn.Name.s) SymTabAddAt(c.tab, fn, at) - -proc AddInterfaceDeclAux(c: PContext, sym: PSym) = - if (sfInInterface in sym.flags): - # add to interface: - if c.module == nil: InternalError(sym.info, "AddInterfaceDeclAux") - StrTableAdd(c.module.tab, sym) - if getCurrOwner().kind == skModule: incl(sym.flags, sfGlobal) proc addInterfaceDecl(c: PContext, sym: PSym) = # it adds the symbol to the interface if appropriate @@ -115,9 +119,6 @@ proc lookUp(c: PContext, n: PNode): PSym = if result.kind == skStub: loadStub(result) proc QualifiedLookUp(c: PContext, n: PNode, ambiguousCheck: bool): PSym = - var - m: PSym - ident: PIdent case n.kind of nkIdent: result = SymtabGet(c.Tab, n.ident) @@ -136,9 +137,9 @@ proc QualifiedLookUp(c: PContext, n: PNode, ambiguousCheck: bool): PSym = liMessage(n.info, errUseQualifier, n.sym.name.s) of nkDotExpr: result = nil - m = qualifiedLookUp(c, n.sons[0], false) + var m = qualifiedLookUp(c, n.sons[0], false) if (m != nil) and (m.kind == skModule): - ident = nil + var ident: PIdent = nil if (n.sons[1].kind == nkIdent): ident = n.sons[1].ident elif (n.sons[1].kind == nkAccQuoted) and @@ -236,4 +237,4 @@ proc nextOverloadIter(o: var TOverloadIter, c: PContext, n: PNode): PSym = else: result = nil if (result != nil) and (result.kind == skStub): loadStub(result) - \ No newline at end of file + diff --git a/rod/semstmts.nim b/rod/semstmts.nim index d2df06f3d..f792dc691 100755 --- a/rod/semstmts.nim +++ b/rod/semstmts.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2009 Andreas Rumpf +# (c) Copyright 2010 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -675,7 +675,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, if kind in OverloadableSyms: addInterfaceOverloadableSymAt(c, s, c.tab.tos - 2) else: - addDeclAt(c, s, c.tab.tos - 2) + addInterfaceDeclAt(c, s, c.tab.tos - 2) if n.sons[pragmasPos] != nil: pragma(c, s, n.sons[pragmasPos], validPragmas) else: if n.sons[pragmasPos] != nil: diff --git a/rod/semtypes.nim b/rod/semtypes.nim index cf88b0b4b..c4fadac8a 100755 --- a/rod/semtypes.nim +++ b/rod/semtypes.nim @@ -227,7 +227,8 @@ proc semGeneric(c: PContext, n: PNode, s: PSym, prev: PType): PType = if s.ast == nil: liMessage(n.info, errCannotInstantiateX, s.name.s) result = instGenericContainer(c, n, result) -proc semIdentVis(c: PContext, kind: TSymKind, n: PNode, allowed: TSymFlags): PSym = +proc semIdentVis(c: PContext, kind: TSymKind, n: PNode, + allowed: TSymFlags): PSym = # identifier with visibility if n.kind == nkPostfix: if (sonsLen(n) == 2) and (n.sons[0].kind == nkIdent): @@ -252,14 +253,10 @@ proc semIdentWithPragma(c: PContext, kind: TSymKind, n: PNode, case kind of skType: # process pragmas later, because result.typ has not been set yet - of skField: - pragma(c, result, n.sons[1], fieldPragmas) - of skVar: - pragma(c, result, n.sons[1], varPragmas) - of skConst: - pragma(c, result, n.sons[1], constPragmas) - else: - nil + of skField: pragma(c, result, n.sons[1], fieldPragmas) + of skVar: pragma(c, result, n.sons[1], varPragmas) + of skConst: pragma(c, result, n.sons[1], constPragmas) + else: nil else: result = semIdentVis(c, kind, n, allowed) @@ -685,4 +682,4 @@ proc processMagicType(c: PContext, m: PSym) = of mArray, mOpenArray, mRange, mSet, mSeq, mOrdinal: return else: liMessage(m.info, errTypeExpected) - \ No newline at end of file + |