Bugfix: macros can be exported again

This commit is contained in:
Andreas Rumpf 2010-03-05 12:55:13 +01:00
commit 13c69f5540
6 changed files with 26 additions and 26 deletions

View file

@ -1,7 +1,7 @@
# #
# #
# Nimrod's Runtime Library # Nimrod's Runtime Library
# (c) Copyright 2009 Andreas Rumpf # (c) Copyright 2010 Andreas Rumpf
# #
# See the file "copying.txt", included in this # See the file "copying.txt", included in this
# distribution, for details about the copyright. # distribution, for details about the copyright.

View file

@ -70,6 +70,17 @@ proc addDeclAt(c: PContext, sym: PSym, at: Natural) =
if SymTabAddUniqueAt(c.tab, sym, at) == Failure: if SymTabAddUniqueAt(c.tab, sym, at) == Failure:
liMessage(sym.info, errAttemptToRedefine, sym.Name.s) 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) = proc addOverloadableSymAt(c: PContext, fn: PSym, at: Natural) =
if not (fn.kind in OverloadableSyms): if not (fn.kind in OverloadableSyms):
InternalError(fn.info, "addOverloadableSymAt") InternalError(fn.info, "addOverloadableSymAt")
@ -78,13 +89,6 @@ proc addOverloadableSymAt(c: PContext, fn: PSym, at: Natural) =
liMessage(fn.info, errAttemptToRedefine, fn.Name.s) liMessage(fn.info, errAttemptToRedefine, fn.Name.s)
SymTabAddAt(c.tab, fn, at) 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) = proc addInterfaceDecl(c: PContext, sym: PSym) =
# it adds the symbol to the interface if appropriate # it adds the symbol to the interface if appropriate
addDecl(c, sym) addDecl(c, sym)
@ -115,9 +119,6 @@ proc lookUp(c: PContext, n: PNode): PSym =
if result.kind == skStub: loadStub(result) if result.kind == skStub: loadStub(result)
proc QualifiedLookUp(c: PContext, n: PNode, ambiguousCheck: bool): PSym = proc QualifiedLookUp(c: PContext, n: PNode, ambiguousCheck: bool): PSym =
var
m: PSym
ident: PIdent
case n.kind case n.kind
of nkIdent: of nkIdent:
result = SymtabGet(c.Tab, n.ident) 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) liMessage(n.info, errUseQualifier, n.sym.name.s)
of nkDotExpr: of nkDotExpr:
result = nil result = nil
m = qualifiedLookUp(c, n.sons[0], false) var m = qualifiedLookUp(c, n.sons[0], false)
if (m != nil) and (m.kind == skModule): if (m != nil) and (m.kind == skModule):
ident = nil var ident: PIdent = nil
if (n.sons[1].kind == nkIdent): if (n.sons[1].kind == nkIdent):
ident = n.sons[1].ident ident = n.sons[1].ident
elif (n.sons[1].kind == nkAccQuoted) and elif (n.sons[1].kind == nkAccQuoted) and

View file

@ -1,7 +1,7 @@
# #
# #
# The Nimrod Compiler # The Nimrod Compiler
# (c) Copyright 2009 Andreas Rumpf # (c) Copyright 2010 Andreas Rumpf
# #
# See the file "copying.txt", included in this # See the file "copying.txt", included in this
# distribution, for details about the copyright. # distribution, for details about the copyright.
@ -675,7 +675,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
if kind in OverloadableSyms: if kind in OverloadableSyms:
addInterfaceOverloadableSymAt(c, s, c.tab.tos - 2) addInterfaceOverloadableSymAt(c, s, c.tab.tos - 2)
else: 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) if n.sons[pragmasPos] != nil: pragma(c, s, n.sons[pragmasPos], validPragmas)
else: else:
if n.sons[pragmasPos] != nil: if n.sons[pragmasPos] != nil:

View file

@ -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) if s.ast == nil: liMessage(n.info, errCannotInstantiateX, s.name.s)
result = instGenericContainer(c, n, result) 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 # identifier with visibility
if n.kind == nkPostfix: if n.kind == nkPostfix:
if (sonsLen(n) == 2) and (n.sons[0].kind == nkIdent): if (sonsLen(n) == 2) and (n.sons[0].kind == nkIdent):
@ -252,14 +253,10 @@ proc semIdentWithPragma(c: PContext, kind: TSymKind, n: PNode,
case kind case kind
of skType: of skType:
# process pragmas later, because result.typ has not been set yet # process pragmas later, because result.typ has not been set yet
of skField: of skField: pragma(c, result, n.sons[1], fieldPragmas)
pragma(c, result, n.sons[1], fieldPragmas) of skVar: pragma(c, result, n.sons[1], varPragmas)
of skVar: of skConst: pragma(c, result, n.sons[1], constPragmas)
pragma(c, result, n.sons[1], varPragmas) else: nil
of skConst:
pragma(c, result, n.sons[1], constPragmas)
else:
nil
else: else:
result = semIdentVis(c, kind, n, allowed) result = semIdentVis(c, kind, n, allowed)

View file

@ -59,4 +59,5 @@ tstrutil.nim;ha/home/a1xyz/usr/bin
tvardecl.nim;44 tvardecl.nim;44
tvarnums.nim;Success! tvarnums.nim;Success!
tvartup.nim;2 3 tvartup.nim;2 3
txmlgen.nim;<h1><a href="http://force7.de/nimrod">Nimrod</a></h1>
txmltree.nim;true txmltree.nim;true

Can't render this file because it contains an unexpected character in line 57 and column 15.

View file

@ -32,6 +32,7 @@ Additions
- Added ``system.cstringArrayToSeq``. - Added ``system.cstringArrayToSeq``.
- Added ``system.lines(f: TFile)`` iterator. - Added ``system.lines(f: TFile)`` iterator.
- Added ``system.delete``, ``system.del`` and ``system.insert`` for sequences. - Added ``system.delete``, ``system.del`` and ``system.insert`` for sequences.
- Added ``system./`` for int.
- Exported ``system.newException`` template. - Exported ``system.newException`` template.
- Added ``cgi.decodeData(data: string): tuple[key, value: string]``. - Added ``cgi.decodeData(data: string): tuple[key, value: string]``.
- Added ``math.trunc``. - Added ``math.trunc``.