block labels

This commit is contained in:
2026-06-28 08:51:01 +02:00
parent 3e54c6f9ad
commit eaa66511a0
7 changed files with 352 additions and 60 deletions
+6
View File
@@ -156,6 +156,9 @@ Stmt_Kind :: enum u8 {
For,
Break,
Continue,
// A labeled value block (`blk: { … yield :blk v }`): lowers to its `then_body`
// followed by an exit label, so a `yield :blk` (a labeled break) lands after it.
Block,
}
Assignment_Op :: enum u8 {
@@ -172,6 +175,9 @@ Stmt :: struct {
span: source.Span,
local: Local_Id,
index_local: Local_Id,
// `While`/`For`/`Block` may carry a label; a labeled `Break`/`Continue` targets the
// matching enclosing loop or value block. `INVALID` when absent.
label: symbol.Id,
target: Expr_Id,
expr: Expr_Id,
iterator_type: types.Type,