diff options
author | Araq <rumpf_a@web.de> | 2012-06-21 19:00:09 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-06-21 19:00:09 +0200 |
commit | 05c981ea9b906292063c0b24dd6d387d4e666e8a (patch) | |
tree | 5b6d39e0b8c7e624c1d2e952ac9c2cd3124949b1 | |
parent | d1c84328a7ca460a002933720089eefca378a28c (diff) | |
download | Nim-05c981ea9b906292063c0b24dd6d387d4e666e8a.tar.gz |
fixes #134
-rwxr-xr-x | compiler/importer.nim | 18 | ||||
-rwxr-xr-x | tests/compile/tmacro1.nim | 2 |
2 files changed, 11 insertions, 9 deletions
diff --git a/compiler/importer.nim b/compiler/importer.nim index 84e265246..86511f228 100755 --- a/compiler/importer.nim +++ b/compiler/importer.nim @@ -73,21 +73,21 @@ proc rawImportSymbol(c: PContext, s: PSym) = elif s.kind == skConverter: addConverter(c, s) # rodgen assures that converters are no stubs -proc importSymbol(c: PContext, ident: PNode, fromMod: PSym) = - if (ident.kind != nkIdent): InternalError(ident.info, "importSymbol") - var s = StrTableGet(fromMod.tab, ident.ident) - if s == nil: GlobalError(ident.info, errUndeclaredIdentifier, ident.ident.s) +proc importSymbol(c: PContext, n: PNode, fromMod: PSym) = + let ident = lookups.considerAcc(n) + let s = StrTableGet(fromMod.tab, ident) + if s == nil: GlobalError(n.info, errUndeclaredIdentifier, ident.s) if s.kind == skStub: loadStub(s) - if not (s.Kind in ExportableSymKinds): - InternalError(ident.info, "importSymbol: 2") + if s.Kind notin ExportableSymKinds: + InternalError(n.info, "importSymbol: 2") # for an enumeration we have to add all identifiers case s.Kind - of skProc, skMethod, skIterator, skMacro, skTemplate, skConverter: + of skProc, skMethod, skIterator, skMacro, skTemplate, skConverter: # for a overloadable syms add all overloaded routines var it: TIdentIter var e = InitIdentIter(it, fromMod.tab, s.name) - while e != nil: - if (e.name.id != s.Name.id): InternalError(ident.info, "importSymbol: 3") + while e != nil: + if e.name.id != s.Name.id: InternalError(n.info, "importSymbol: 3") rawImportSymbol(c, e) e = NextIdentIter(it, fromMod.tab) else: rawImportSymbol(c, s) diff --git a/tests/compile/tmacro1.nim b/tests/compile/tmacro1.nim index e96997c47..520b64e67 100755 --- a/tests/compile/tmacro1.nim +++ b/tests/compile/tmacro1.nim @@ -1,5 +1,7 @@ import macros +from uri import `/` + macro test*(a: stmt): stmt = var nodes: tuple[a, b: int] nodes.a = 4 |