diff options
| author | Bradley Lewis <22850972+BradLewis@users.noreply.github.com> | 2025-11-06 04:07:46 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-06 04:07:46 -0500 |
| commit | 10ea97356964e04bfe522a8ad276528bdac35d48 (patch) | |
| tree | c2d7084f93f278717e06078cee33b2fadf1206da /src/server | |
| parent | 7269da0e81c5887d444a77872613bc2b10b893d6 (diff) | |
| parent | 37f295d84abce9f587e3f8ebf5929ef67188e5a3 (diff) | |
Merge pull request #1156 from BradLewis/fix/crash-for-loop
Fix crash with typing for for in statement
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/locals.odin | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/server/locals.odin b/src/server/locals.odin index 800e01d..a68c5b7 100644 --- a/src/server/locals.odin +++ b/src/server/locals.odin @@ -677,21 +677,23 @@ get_locals_for_range_stmt :: proc( case SymbolProcedureValue: calls := make(map[int]struct{}, context.temp_allocator) get_generic_assignment(file, stmt.expr, ast_context, &results, &calls, {}, false) - for val, i in stmt.vals { - if ident, ok := unwrap_ident(val); ok { - result_i := min(len(results) - 1, i) - store_local( - ast_context, - ident, - results[result_i], - ident.pos.offset, - ident.name, - ast_context.non_mutable_only, - false, - {.Mutable}, - symbol.pkg, - false, - ) + if len(results) > 0 { + for val, i in stmt.vals { + if ident, ok := unwrap_ident(val); ok { + result_i := min(len(results) - 1, i) + store_local( + ast_context, + ident, + results[result_i], + ident.pos.offset, + ident.name, + ast_context.non_mutable_only, + false, + {.Mutable}, + symbol.pkg, + false, + ) + } } } case SymbolUntypedValue: |