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 | |
parent | 2997e26ee1225cbe63a8327f55af4b0fe88e73c7 (diff) | |
download | Nim-92e49aeaafdfc896a90e5939d05b678db0e275f7.tar.gz |
fixes #73
-rwxr-xr-x | compiler/lookups.nim | 12 | ||||
-rwxr-xr-x | compiler/semstmts.nim | 2 | ||||
-rwxr-xr-x | todo.txt | 4 |
3 files changed, 11 insertions, 7 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 diff --git a/todo.txt b/todo.txt index 53bd9d714..f2ff040d5 100755 --- a/todo.txt +++ b/todo.txt @@ -52,8 +52,6 @@ version 0.9.XX a full blown statement; a ``try`` expression might be a good idea to make error handling more light-weight - ``=`` should be overloadable; requires specialization for ``=`` -- ``hoist`` pragma for loop hoisting: can be easily done with - AST overloading + global - document destructors; don't work yet when used as expression - make use of ``tyIter`` to fix the implicit items/pairs issue - better support for macros that rewrite procs @@ -174,4 +172,6 @@ Version 2 and beyond - implement ``partial`` pragma for partial evaluation: easily done with AST overloading +- ``hoist`` pragma for loop hoisting: can be easily done with + AST overloading + global |