scope.add should only record the first position

This commit is contained in:
徐志强 2020-02-18 16:03:32 +08:00
parent a6024f7f5f
commit 03cee0656c
1 changed files with 4 additions and 0 deletions

View File

@ -72,6 +72,10 @@ func (s *scope) deepLookup(n string) *symbol {
}
func (s *scope) add(name string, kind SymKind, pos token.Pos) {
if s.syms[name] != nil {
return
}
s.syms[name] = &symbol{
kind: kind,
pos: pos,