Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-rest-ary-elem.case
3 // - src/dstr-binding/default/try.template
4 /*---
5 description: Rest element containing an array BindingElementList pattern (try statement)
6 esid: sec-runtime-semantics-catchclauseevaluation
7 features: [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 SingleNameBinding : BindingIdentifier Initializeropt
33
34 [...]
35 4. If iteratorRecord.[[done]] is false, then
36 a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
37 b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
38 c. ReturnIfAbrupt(next).
39 d. If next is false, set iteratorRecord.[[done]] to true.
40 e. Else,
41 [...]
42 i. Let v be IteratorValue(next).
43 ii. If v is an abrupt completion, set
44 iteratorRecord.[[done]] to true.
45 iii. ReturnIfAbrupt(v).
46 5. If iteratorRecord.[[done]] is true, let v be undefined.
47 [...]
48 8. Return InitializeReferencedBinding(lhs, v).
49 ---*/
50
51 var ranCatch = false;
52
53 try {
54 throw [3, 4, 5];
55 } catch ([...[x, y, z]]) {
56 assert.sameValue(x, 3);
57 assert.sameValue(y, 4);
58 assert.sameValue(z, 5);
59 ranCatch = true;
60 }
61
62 assert(ranCatch, 'executed `catch` block');
63
64 reportCompare(0, 0);