Merge pull request #6259 from odin-lang/bill/range-init

`for init; x in y {}` style loops (proof of concept)
This commit is contained in:
gingerBill
2026-02-17 11:11:56 +00:00
committed by GitHub
11 changed files with 297 additions and 35 deletions

View File

@@ -1705,11 +1705,17 @@ gb_internal void check_range_stmt(CheckerContext *ctx, Ast *node, u32 mod_flags)
TEMPORARY_ALLOCATOR_GUARD();
u32 new_flags = mod_flags | Stmt_BreakAllowed | Stmt_ContinueAllowed;
check_open_scope(ctx, node);
check_label(ctx, rs->label, node);
Operand init = {};
if (rs->init != nullptr) {
check_stmt(ctx, rs->init, mod_flags);
}
u32 new_flags = mod_flags | Stmt_BreakAllowed | Stmt_ContinueAllowed;
auto vals = array_make<Type *>(temporary_allocator(), 0, 2);
auto entities = array_make<Entity *>(temporary_allocator(), 0, 2);
bool is_map = false;