Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-rest-ary-elision.case
3 // - src/dstr-binding/default/try.template
4 /*---
5 description: Rest element containing an elision (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 : [ Elision ]
33
34 1. Return the result of performing
35 IteratorDestructuringAssignmentEvaluation of Elision with iteratorRecord
36 as the argument.
37
38 12.14.5.3 Runtime Semantics: IteratorDestructuringAssignmentEvaluation
39
40 Elision : ,
41
42 1. If iteratorRecord.[[done]] is false, then
43 a. Let next be IteratorStep(iteratorRecord.[[iterator]]).
44 b. If next is an abrupt completion, set iteratorRecord.[[done]] to true.
45 c. ReturnIfAbrupt(next).
46 d. If next is false, set iteratorRecord.[[done]] to true.
47 2. Return NormalCompletion(empty).
48
49 ---*/
50 var first = 0;
51 var second = 0;
52 function* g() {
53 first += 1;
54 yield;
55 second += 1;
56 };
57
58 var ranCatch = false;
59
60 try {
61 throw g();
62 } catch ([...[,]]) {
63 assert.sameValue(first, 1);
64 assert.sameValue(second, 1);
65 ranCatch = true;
66 }
67
68 assert(ranCatch, 'executed `catch` block');
69
70 reportCompare(0, 0);