From 36149e5828df1bb35e06905c65f007dd5869aaec Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Fri, 13 Oct 2023 18:32:13 +0200 Subject: parser: include absolute paths in symbols --- parser/symbol.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'parser/symbol.go') 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 -- cgit v1.2.3