diff options
| author | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-17 20:11:08 -0400 |
|---|---|---|
| committer | Brad Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-09-17 20:19:52 -0400 |
| commit | 9d152084c75aa3b2f0deaaada4cb24d7f368922c (patch) | |
| tree | efcb5ad78cb489a0a1d0f3db130bf3b051640b3d | |
| parent | 7be81e2f75e79226148ca83a15bad035c71ead7c (diff) | |
Correctly handle mutability for global variables in other files
| -rw-r--r-- | src/server/analysis.odin | 8 | ||||
| -rw-r--r-- | src/server/collector.odin | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/server/analysis.odin b/src/server/analysis.odin index 8dc1877..7798be9 100644 --- a/src/server/analysis.odin +++ b/src/server/analysis.odin @@ -2458,6 +2458,12 @@ resolve_symbol_return :: proc(ast_context: ^AstContext, symbol: Symbol, ok := tr if symbol.type == .Variable { ret.type = symbol.type } + if .Variable in symbol.flags { + ret.flags |= {.Variable} + } + if .Mutable in symbol.flags { + ret.flags |= {.Mutable} + } return ret, ok } @@ -2490,7 +2496,7 @@ resolve_unresolved_symbol :: proc(ast_context: ^AstContext, symbol: ^Symbol) -> symbol.signature = ret.signature symbol.value = ret.value symbol.pkg = ret.pkg - symbol.flags = ret.flags + symbol.flags |= ret.flags } else { return false } diff --git a/src/server/collector.odin b/src/server/collector.odin index ff1c791..3b52ca2 100644 --- a/src/server/collector.odin +++ b/src/server/collector.odin @@ -745,6 +745,9 @@ collect_symbols :: proc(collection: ^SymbolCollection, file: ast.File, uri: stri symbol.flags |= {.Variable} } + if .Mutable in expr.flags { + symbol.flags |= {.Mutable} + } pkg: ^SymbolPackage ok: bool |