for loops

This commit is contained in:
2026-06-22 20:11:18 +02:00
parent 380b5943b3
commit 27f42dd253
15 changed files with 1369 additions and 22 deletions
+8
View File
@@ -111,6 +111,7 @@ Expr_Kind :: enum u8 {
Ge,
And,
Or,
Range,
Call,
}
@@ -142,18 +143,25 @@ Stmt_Kind :: enum u8 {
Trap,
If,
While,
For,
}
Stmt :: struct {
kind: Stmt_Kind,
span: source.Span,
local: Local_Id,
index_local: Local_Id,
target: Expr_Id,
expr: Expr_Id,
iterator_type: types.Type,
pointer_capture: bool,
// `If` statements use `expr` as the condition and `then_body`/`else_body` as
// the branch statement lists.
// `While` statements use `expr` as the condition, `then_body` as the loop
// body, and `update` as the optional post-iteration statement.
// `For` statements use `expr` as the iterable, `local` as the item capture,
// `index_local` as the optional sequence index, and `iterator_type` as the
// normalized many-item pointer type for sequence iteration.
then_body: []Stmt_Id,
else_body: []Stmt_Id,
update: Stmt_Id,