diff options
author | Araq <rumpf_a@web.de> | 2012-09-23 01:18:13 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2012-09-23 01:18:13 +0200 |
commit | 92e49aeaafdfc896a90e5939d05b678db0e275f7 (patch) | |
tree | 78e49a8346d11623105a64e67529c35f1854d6bb /compiler | |
parent | 2997e26ee1225cbe63a8327f55af4b0fe88e73c7 (diff) | |
download | Nim-92e49aeaafdfc896a90e5939d05b678db0e275f7.tar.gz |
fixes #73
Diffstat (limited to 'compiler')
-rwxr-xr-x | compiler/lookups.nim | 12 | ||||
-rwxr-xr-x | compiler/semstmts.nim | 2 |
2 files changed, 9 insertions, 5 deletions
diff --git a/compiler/lookups.nim b/compiler/lookups.nim index 1717ab4fb..c0e3ea880 100755 --- a/compiler/lookups.nim +++ b/compiler/lookups.nim @@ -86,19 +86,23 @@ proc CloseScope*(tab: var TSymTab) = s = NextIter(it, tab.stack[tab.tos-1]) astalgo.rawCloseScope(tab) +proc WrongRedefinition*(info: TLineInfo, s: string) = + if gCmd != cmdInteractive: + localError(info, errAttemptToRedefine, s) + proc AddSym*(t: var TStrTable, n: PSym) = - if StrTableIncl(t, n): LocalError(n.info, errAttemptToRedefine, n.name.s) + if StrTableIncl(t, n): WrongRedefinition(n.info, n.name.s) proc addDecl*(c: PContext, sym: PSym) = if SymTabAddUnique(c.tab, sym) == Failure: - LocalError(sym.info, errAttemptToRedefine, sym.Name.s) + WrongRedefinition(sym.info, sym.Name.s) proc addPrelimDecl*(c: PContext, sym: PSym) = discard SymTabAddUnique(c.tab, sym) proc addDeclAt*(c: PContext, sym: PSym, at: Natural) = if SymTabAddUniqueAt(c.tab, sym, at) == Failure: - LocalError(sym.info, errAttemptToRedefine, sym.Name.s) + WrongRedefinition(sym.info, sym.Name.s) proc AddInterfaceDeclAux(c: PContext, sym: PSym) = if sfExported in sym.flags: @@ -116,7 +120,7 @@ proc addOverloadableSymAt*(c: PContext, fn: PSym, at: Natural) = return var check = StrTableGet(c.tab.stack[at], fn.name) if check != nil and check.Kind notin OverloadableSyms: - LocalError(fn.info, errAttemptToRedefine, fn.Name.s) + WrongRedefinition(fn.info, fn.Name.s) else: SymTabAddAt(c.tab, fn, at) diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 2bd5898a7..2dad56272 100755 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -737,7 +737,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind, if n.sons[pragmasPos].kind != nkEmpty: LocalError(n.sons[pragmasPos].info, errPragmaOnlyInHeaderOfProc) if sfForward notin proto.flags: - LocalError(n.info, errAttemptToRedefine, proto.name.s) + WrongRedefinition(n.info, proto.name.s) excl(proto.flags, sfForward) closeScope(c.tab) # close scope with wrong parameter symbols openScope(c.tab) # open scope for old (correct) parameter symbols |