fixes #73
This commit is contained in:
parent
2997e26ee1
commit
92e49aeaaf
3 changed files with 11 additions and 7 deletions
|
|
@ -86,19 +86,23 @@ proc CloseScope*(tab: var TSymTab) =
|
||||||
s = NextIter(it, tab.stack[tab.tos-1])
|
s = NextIter(it, tab.stack[tab.tos-1])
|
||||||
astalgo.rawCloseScope(tab)
|
astalgo.rawCloseScope(tab)
|
||||||
|
|
||||||
|
proc WrongRedefinition*(info: TLineInfo, s: string) =
|
||||||
|
if gCmd != cmdInteractive:
|
||||||
|
localError(info, errAttemptToRedefine, s)
|
||||||
|
|
||||||
proc AddSym*(t: var TStrTable, n: PSym) =
|
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) =
|
proc addDecl*(c: PContext, sym: PSym) =
|
||||||
if SymTabAddUnique(c.tab, sym) == Failure:
|
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) =
|
proc addPrelimDecl*(c: PContext, sym: PSym) =
|
||||||
discard SymTabAddUnique(c.tab, sym)
|
discard SymTabAddUnique(c.tab, sym)
|
||||||
|
|
||||||
proc addDeclAt*(c: PContext, sym: PSym, at: Natural) =
|
proc addDeclAt*(c: PContext, sym: PSym, at: Natural) =
|
||||||
if SymTabAddUniqueAt(c.tab, sym, at) == Failure:
|
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) =
|
proc AddInterfaceDeclAux(c: PContext, sym: PSym) =
|
||||||
if sfExported in sym.flags:
|
if sfExported in sym.flags:
|
||||||
|
|
@ -116,7 +120,7 @@ proc addOverloadableSymAt*(c: PContext, fn: PSym, at: Natural) =
|
||||||
return
|
return
|
||||||
var check = StrTableGet(c.tab.stack[at], fn.name)
|
var check = StrTableGet(c.tab.stack[at], fn.name)
|
||||||
if check != nil and check.Kind notin OverloadableSyms:
|
if check != nil and check.Kind notin OverloadableSyms:
|
||||||
LocalError(fn.info, errAttemptToRedefine, fn.Name.s)
|
WrongRedefinition(fn.info, fn.Name.s)
|
||||||
else:
|
else:
|
||||||
SymTabAddAt(c.tab, fn, at)
|
SymTabAddAt(c.tab, fn, at)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -737,7 +737,7 @@ proc semProcAux(c: PContext, n: PNode, kind: TSymKind,
|
||||||
if n.sons[pragmasPos].kind != nkEmpty:
|
if n.sons[pragmasPos].kind != nkEmpty:
|
||||||
LocalError(n.sons[pragmasPos].info, errPragmaOnlyInHeaderOfProc)
|
LocalError(n.sons[pragmasPos].info, errPragmaOnlyInHeaderOfProc)
|
||||||
if sfForward notin proto.flags:
|
if sfForward notin proto.flags:
|
||||||
LocalError(n.info, errAttemptToRedefine, proto.name.s)
|
WrongRedefinition(n.info, proto.name.s)
|
||||||
excl(proto.flags, sfForward)
|
excl(proto.flags, sfForward)
|
||||||
closeScope(c.tab) # close scope with wrong parameter symbols
|
closeScope(c.tab) # close scope with wrong parameter symbols
|
||||||
openScope(c.tab) # open scope for old (correct) parameter symbols
|
openScope(c.tab) # open scope for old (correct) parameter symbols
|
||||||
|
|
|
||||||
4
todo.txt
4
todo.txt
|
|
@ -52,8 +52,6 @@ version 0.9.XX
|
||||||
a full blown statement; a ``try`` expression might be a good idea to make
|
a full blown statement; a ``try`` expression might be a good idea to make
|
||||||
error handling more light-weight
|
error handling more light-weight
|
||||||
- ``=`` should be overloadable; requires specialization for ``=``
|
- ``=`` 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
|
- document destructors; don't work yet when used as expression
|
||||||
- make use of ``tyIter`` to fix the implicit items/pairs issue
|
- make use of ``tyIter`` to fix the implicit items/pairs issue
|
||||||
- better support for macros that rewrite procs
|
- 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
|
- implement ``partial`` pragma for partial evaluation: easily done with AST
|
||||||
overloading
|
overloading
|
||||||
|
- ``hoist`` pragma for loop hoisting: can be easily done with
|
||||||
|
AST overloading + global
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue