for loops
This commit is contained in:
@@ -92,6 +92,7 @@ Expr_Kind :: enum u8 {
|
||||
Ge,
|
||||
And,
|
||||
Or,
|
||||
Range,
|
||||
Call,
|
||||
}
|
||||
|
||||
@@ -104,6 +105,7 @@ Expr :: struct {
|
||||
left: Expr_Id,
|
||||
right: Expr_Id,
|
||||
diagnostic: source.Diagnostic_Id,
|
||||
parenthesized: bool,
|
||||
kind: Expr_Kind,
|
||||
}
|
||||
|
||||
@@ -121,14 +123,17 @@ Stmt_Kind :: enum u8 {
|
||||
Expression,
|
||||
If,
|
||||
While,
|
||||
For,
|
||||
}
|
||||
|
||||
Stmt :: struct {
|
||||
kind: Stmt_Kind,
|
||||
span: source.Span,
|
||||
name: symbol.Id,
|
||||
index_name: symbol.Id,
|
||||
type: Type_Syntax,
|
||||
immutable: bool,
|
||||
pointer_capture: bool,
|
||||
target: Expr_Id,
|
||||
expr: Expr_Id,
|
||||
// `If` statements use `expr` as the condition, `body` as the then-block, and
|
||||
@@ -136,6 +141,9 @@ Stmt :: struct {
|
||||
// `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.
|
||||
// `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.
|
||||
body: []Stmt_Id,
|
||||
else_body: []Stmt_Id,
|
||||
update: Stmt_Id,
|
||||
|
||||
Reference in New Issue
Block a user