Debian Codegraph @

js/src/tests/test262/language/statements/try/dstr/ary-ptrn-rest-ary-empty.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-rest-ary-empty.case
3 // - src/dstr-binding/default/try.template
4 /*---
5 description: Rest element containing an "empty" array pattern (try statement)
6 esid: sec-runtime-semantics-catchclauseevaluation
7 features: [generators, destructuring-binding]
8 flags: [generated]
9 info: |
10 Catch : catch ( CatchParameter ) Block
11
12 [...]
13 5. Let status be the result of performing BindingInitialization for
14 CatchParameter passing thrownValue and catchEnv as arguments.
15 [...]
16
17 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
18
19 BindingRestElement : ... BindingPattern
20
21 1. Let A be ArrayCreate(0).
22 [...]
23 3. Repeat
24 [...]
25 b. If iteratorRecord.[[done]] is true, then
26 i. Return the result of performing BindingInitialization of
27 BindingPattern with A and environment as the arguments.
28 [...]
29
30 13.3.3.6 Runtime Semantics: IteratorBindingInitialization
31
32 ArrayBindingPattern : [ ]
33
34 1. Return NormalCompletion(empty).
35
36 ---*/
37 var iterations = 0;
38 var iter = function*() {
39 iterations += 1;
40 }();
41
42 var ranCatch = false;
43
44 try {
45 throw iter;
46 } catch ([...[]]) {
47 assert.sameValue(iterations, 1);
48 ranCatch = true;
49 }
50
51 assert(ranCatch, 'executed `catch` block');
52
53 reportCompare(0, 0);