Locate 'attempt to redefine' errors at the import statement rather than at the first line of the imported module. Fixes #4541.

This commit is contained in:
Kier Davis 2016-07-30 14:22:24 +01:00
commit 2bea2bdbbf
2 changed files with 7 additions and 3 deletions

View file

@ -162,6 +162,10 @@ proc wrongRedefinition*(info: TLineInfo, s: string) =
if gCmd != cmdInteractive:
localError(info, errAttemptToRedefine, s)
proc addDecl*(c: PContext, sym: PSym, info: TLineInfo) =
if not c.currentScope.addUniqueSym(sym):
wrongRedefinition(info, sym.name.s)
proc addDecl*(c: PContext, sym: PSym) =
if not c.currentScope.addUniqueSym(sym):
wrongRedefinition(sym.info, sym.name.s)