diff options
| author | Marc Vertes <mvertes@free.fr> | 2023-10-13 18:32:13 +0200 |
|---|---|---|
| committer | Marc Vertes <mvertes@free.fr> | 2023-10-13 18:32:13 +0200 |
| commit | 36149e5828df1bb35e06905c65f007dd5869aaec (patch) | |
| tree | 9dcd79d401f7c0dedb62ba33e459765831a10044 /parser/symbol.go | |
| parent | 40a03025bc1883051c921e6619d751cddcaedeeb (diff) | |
parser: include absolute paths in symbols
Diffstat (limited to 'parser/symbol.go')
| -rw-r--r-- | parser/symbol.go | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/parser/symbol.go b/parser/symbol.go index 9975c24..f83ec4e 100644 --- a/parser/symbol.go +++ b/parser/symbol.go @@ -34,14 +34,12 @@ func (p *Parser) addSym(i int, name string, v any, k symKind, t reflect.Type, lo // getSym searches for an existing symbol starting from the deepest scope. func (p *Parser) getSym(name, scope string) (sym *symbol, sc string, ok bool) { for { - if sym, ok = p.symbols[scope+name]; ok { + if sym, ok = p.symbols[scope+"/"+name]; ok { return sym, scope, ok } - scope = strings.TrimSuffix(scope, "/") i := strings.LastIndex(scope, "/") if i == -1 { - scope = "" - break + i = 0 } if scope = scope[:i]; scope == "" { break |
