labeled block statements

This commit is contained in:
2026-06-28 09:07:09 +02:00
parent eaa66511a0
commit 3007910526
5 changed files with 181 additions and 21 deletions
+10 -3
View File
@@ -391,9 +391,16 @@
loop, a labeled one searches by label). The checker tracks a `loop_labels` stack and a
`Yield_Target.defer_floor`; a `yield :L v` desugars to `slot = v; flush defers to L's body;
break :L`, reusing the milestone-18 break lowering — **no new IR opcode, no emitter change**
- deferred (`// ponytail:`): a labeled bare block as a *plain statement* with `break :blk`;
`none`-before-concrete typing in an untyped block whose first concrete yield references a
block local (annotate instead)
- a labeled bare block as a *plain statement* is also exitable with `break :blk` (a HIR
`.Block` break target; not a loop, so unlabeled `break`/`continue` and `continue :blk` skip
it). The checker tracks a parallel `loop_is_loop` stack so labeled `break` reaches a loop or
block while `continue` and unlabeled `break`/`continue` reach only the innermost loop
- untyped block `none`-before-concrete typing now builds the block's leading (yield-free)
statements first (a throwaway probe), so a first concrete `yield :blk` that references a
block local still resolves the result to `?T`
- deferred (`// ponytail:`): the same `none`-before-concrete typing in an untyped block (or
loop) whose concrete yield references a local declared *past* the first yield (annotate);
same-label loop/block shadowing resolves innermost-wins
21. unions and tagged unions