Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions AstSemantics.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,16 @@ a value and may appear as children of other expressions.
### Branches and nesting

The `br` and `br_if` constructs express low-level branching.
Branches that exit a `block`, `loop`, or `tableswitch` may take a subexpression
that yields a value for the exited construct.
Branches may only reference labels defined by an outer *enclosing construct*.
This means that, for example, references to a `block`'s label can only occur
within the `block`'s body. In practice, outer `block`s can be used to place labels for any
given branching pattern, except for one restriction: one can't branch into the middle of a
loop from outside it. This restriction ensures all control flow graphs are well-structured.

Branches that exit a `block`, `loop`, or `tableswitch` may take a subexpression
that yields a value for the exited construct. If present, it is the first operand
before any others.

### Yielding values from control constructs

The `nop`, `if`, `br`, `br_if`, `case`, and `return` constructs do not yield values.
Expand Down Expand Up @@ -550,10 +552,9 @@ outside the range which rounds to an integer in range) traps.

## Type-parameterized operators.

* `select`: a ternary operator with a boolean (i32) condition and two
additional operands, which must have the same type as each other. `select`
returns the the first of these two operands if the condition operand is
non-zero, or the second otherwise.
* `select`: a ternary operator with two operands, which have the same type as
each other, plus a boolean (i32) condition. `select` returns the first
operand if the condition operand is non-zero, or the second otherwise.

## Feature test

Expand Down