@@ -242,11 +242,10 @@ All control flow structures, except `case`, are statements.
242
242
* ` if_else ` : if statement with then and else bodies
243
243
* ` br ` : branch to a given label in an enclosing construct (see below)
244
244
* ` br_if ` : conditionally branch to a given label in an enclosing construct
245
- * ` tableswitch ` : a jump table which may jump either to enclosed ` case ` blocks
246
- or to labels in enclosing constructs (see below for a more
247
- detailed description)
248
- * ` case ` : must be an immediate child of ` tableswitch ` ; has a label declared
249
- in the ` tableswitch ` 's table and a body (as above, see below)
245
+ * ` tableswitch ` : a jump table which may jump either to an immediate ` case `
246
+ child or to a label in an enclosing construct (see below for
247
+ a more detailed description)
248
+ * ` case ` : must be an immediate child of ` tableswitch ` (as above, see below)
250
249
* ` return ` : return zero or more values from this function
251
250
252
251
References to labels must occur within an * enclosing construct* that defined
@@ -257,17 +256,14 @@ one can arrange `block`s to put labels wherever one wants to jump to, except
257
256
for one restriction: one can't jump into the middle of a loop from outside
258
257
it. This restriction ensures the well-structured property discussed below.
259
258
260
- ` tableswitch ` instructions have a zero-based array of labels, a "default"
261
- label, an index operand, and a list of ` case ` nodes. A ` tableswitch `
262
- selects which label to branch to by looking up the index value in the label
263
- array, and transferring control to that label. If the index is out of bounds,
264
- it transfers control to the "default" label.
265
-
266
- ` case ` nodes can only appear as immediate children of ` tableswitch ` statements.
267
- They have a label, which must be declared in the immediately enclosing
268
- ` tableswitch ` 's array, and a body which can contain arbitrary code. Control
269
- falls through the end of a ` case ` block into the following ` case ` block, or
270
- the end of the ` tableswitch ` in the case of the last ` case ` .
259
+ A ` tableswitch ` has a zero-based array of targets, a "default" target, an index
260
+ operand, and a list of ` case ` nodes. It jumps to the target indexed in the
261
+ array, or the default if the index is out of bounds. ` tableswitch ` targets may
262
+ be either labels or ` case ` nodes.
263
+
264
+ A ` case ` node consists of a statement, and may be referenced in the parent
265
+ ` tableswitch ` 's array. Unless exited explicitly, control falls through into the
266
+ next ` case ` or the end of the ` tableswitch ` .
271
267
272
268
273
269
## Calls
0 commit comments