summaryrefslogtreecommitdiffhomepage
path: root/tools/go_generics/globals/scope.go
diff options
context:
space:
mode:
author徐志强 <652732310@qq.com>2020-02-18 16:03:32 +0800
committer徐志强 <652732310@qq.com>2020-02-18 16:03:32 +0800
commit03cee0656c9fd8cf9509c3a91baf72db4a8f6d28 (patch)
tree35368e38c68fd40fcf70bd7b03dfaee42e2fd772 /tools/go_generics/globals/scope.go
parenta6024f7f5f6f438c11e30be0f93657b1956fd5ba (diff)
scope.add should only record the first position
Diffstat (limited to 'tools/go_generics/globals/scope.go')
-rw-r--r--tools/go_generics/globals/scope.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/go_generics/globals/scope.go b/tools/go_generics/globals/scope.go
index 96c965ea2..eec93534b 100644
--- a/tools/go_generics/globals/scope.go
+++ b/tools/go_generics/globals/scope.go
@@ -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,