diff options
| author | DanielGavin <danielgavin5@hotmail.com> | 2025-06-10 20:43:32 +0200 |
|---|---|---|
| committer | DanielGavin <danielgavin5@hotmail.com> | 2025-06-10 20:43:32 +0200 |
| commit | cf982cc36be6852c5d0d8bb9f8458c18ab86b9b9 (patch) | |
| tree | 18d528992c526a4d107f2c24b6862b92c561830e /src | |
| parent | 26e1e197903655b40f180e17e7d51af7a38c9b59 (diff) | |
| parent | 23541aaa499aec0249f08a0e9fcb26f173952881 (diff) | |
Merge branch 'BradLewis-fix/local-identification'
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/analysis.odin | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 4a07f10..952e991 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -1141,7 +1141,12 @@ get_local :: proc(ast_context: AstContext, ident: ast.Ident) -> (DocumentLocal, local_stack := locals[ident.name] or_continue #reverse for local in local_stack { - if local.offset <= ident.pos.offset || local.local_global || local.lhs.pos.offset == ident.pos.offset { + if local.local_global { + return local, true + } + // Ensure that if the identifier has a file, the local is also part of the same file + correct_file := ident.pos.file == "" || local.lhs.pos.file == ident.pos.file + if correct_file && (local.offset <= ident.pos.offset || local.lhs.pos.offset == ident.pos.offset) { // checking equal offsets is a hack to allow matching lhs ident in var decls // because otherwise minimal offset begins after the decl return local, true |