match statements
This commit is contained in:
@@ -134,6 +134,8 @@ Stmt_Kind :: enum u8 {
|
||||
Block,
|
||||
Defer,
|
||||
Yield,
|
||||
Match,
|
||||
Match_Arm,
|
||||
}
|
||||
|
||||
Assignment_Op :: enum u8 {
|
||||
@@ -175,6 +177,10 @@ Stmt :: struct {
|
||||
// `Block` statements (a bare `{ ... }` scope) use `body` as their statements.
|
||||
// `Defer` statements use `update` as the deferred statement (which may itself
|
||||
// be a `Block`).
|
||||
// `Match` statements use `expr` as the subject and `body` as the list of arm
|
||||
// statements (each a `Match_Arm`). A `Match_Arm` uses `expr` as its pattern
|
||||
// (`INVALID_EXPR` marks the `else` arm), `captures` for the optional payload
|
||||
// capture (0 or 1 name, tagged-union variants only), and `body` as the arm body.
|
||||
captures: []symbol.Id,
|
||||
guard: Expr_Id,
|
||||
body: []Stmt_Id,
|
||||
|
||||
Reference in New Issue
Block a user