mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-04 22:58:46 +00:00
Fix #4005
This commit is contained in:
+5
-1
@@ -1637,6 +1637,7 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags)
|
|||||||
|
|
||||||
Ast *expr = unparen_expr(rs->expr);
|
Ast *expr = unparen_expr(rs->expr);
|
||||||
|
|
||||||
|
bool is_range = false;
|
||||||
bool is_possibly_addressable = true;
|
bool is_possibly_addressable = true;
|
||||||
isize max_val_count = 2;
|
isize max_val_count = 2;
|
||||||
if (is_ast_range(expr)) {
|
if (is_ast_range(expr)) {
|
||||||
@@ -1645,6 +1646,7 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags)
|
|||||||
Operand y = {};
|
Operand y = {};
|
||||||
|
|
||||||
is_possibly_addressable = false;
|
is_possibly_addressable = false;
|
||||||
|
is_range = true;
|
||||||
|
|
||||||
bool ok = check_range(ctx, expr, true, &x, &y, nullptr);
|
bool ok = check_range(ctx, expr, true, &x, &y, nullptr);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
@@ -1889,7 +1891,9 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags)
|
|||||||
}
|
}
|
||||||
if (found == nullptr) {
|
if (found == nullptr) {
|
||||||
entity = alloc_entity_variable(ctx->scope, token, type, EntityState_Resolved);
|
entity = alloc_entity_variable(ctx->scope, token, type, EntityState_Resolved);
|
||||||
entity->flags |= EntityFlag_ForValue;
|
if (!is_range) {
|
||||||
|
entity->flags |= EntityFlag_ForValue;
|
||||||
|
}
|
||||||
entity->flags |= EntityFlag_Value;
|
entity->flags |= EntityFlag_Value;
|
||||||
entity->identifier = name;
|
entity->identifier = name;
|
||||||
entity->Variable.for_loop_parent_type = type_of_expr(expr);
|
entity->Variable.for_loop_parent_type = type_of_expr(expr);
|
||||||
|
|||||||
Reference in New Issue
Block a user