This commit is contained in:
Araq
2012-09-23 01:18:13 +02:00
parent 2997e26ee1
commit 92e49aeaaf
3 changed files with 11 additions and 7 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -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