conditionally unwrapping while loops

This commit is contained in:
2026-08-11 18:33:54 +02:00
parent ba6052eef3
commit fa53ca2219
8 changed files with 486 additions and 307 deletions
+6 -7
View File
@@ -202,13 +202,12 @@ Stmt :: struct {
assignment_op: Assignment_Op,
target: Expr_Id,
expr: Expr_Id,
// `If` statements use `expr` as the condition, `captures` as optional
// unwrap binding names, `guard` as the optional post-unwrap boolean
// condition, `body` as the then-block, and `else_body` as the else-block.
// An `else if` chain is represented as an `else_body` holding a single
// nested `If` statement.
// `While` statements use `expr` as the condition, `body` as the loop body,
// and `update` as the optional post-iteration statement.
// `If` and `While` statements use `expr` as the condition, `captures` as
// optional unwrap binding names, and `guard` as the optional post-unwrap
// boolean condition. `If` uses `body` as the then-block and `else_body` as
// the else-block; an `else if` chain is represented as an `else_body`
// holding a single nested `If` statement. `While` uses `body` as the loop
// body and `update` as the optional post-iteration statement.
// `For` statements use `expr` as the iterable, `name` as the item capture,
// `index_name` as the optional index capture, and `pointer_capture` to
// distinguish `|@item|` from copy capture.