diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2026-02-17 11:11:56 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-17 11:11:56 +0000 |
| commit | a7ed7ccd0c392cfbb6cb2e486fc7c75b16791902 (patch) | |
| tree | 8a325415e65ad09cf81547b957753b99d867aaf9 /src/check_stmt.cpp | |
| parent | bfe1f234ec763fc79359f7614ae4cccab88780e7 (diff) | |
| parent | 58deab46a3e2423789f2af5e6ec7a4ef69ce810e (diff) | |
Merge pull request #6259 from odin-lang/bill/range-init
`for init; x in y {}` style loops (proof of concept)
Diffstat (limited to 'src/check_stmt.cpp')
| -rw-r--r-- | src/check_stmt.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/check_stmt.cpp b/src/check_stmt.cpp index 8f17e66c4..bfa68ca78 100644 --- a/src/check_stmt.cpp +++ b/src/check_stmt.cpp @@ -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; |