aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-11-06 04:04:00 -0500
committerBrad Lewis <22850972+BradLewis@users.noreply.github.com>2025-11-06 04:04:00 -0500
commit37f295d84abce9f587e3f8ebf5929ef67188e5a3 (patch)
treec2d7084f93f278717e06078cee33b2fadf1206da /src
parent7269da0e81c5887d444a77872613bc2b10b893d6 (diff)
Fix crash with typing for for in statement
Diffstat (limited to 'src')
-rw-r--r--src/server/locals.odin32
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: