Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-rest-ary-rest.case
3 // - src/dstr-binding/default/try.template
4 /*---
5 description: Rest element containing a rest element (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 var values = [1, 2, 3];
31
32 var ranCatch = false;
33
34 try {
35 throw values;
36 } catch ([...[...x]]) {
37 assert(Array.isArray(x));
38 assert.sameValue(x.length, 3);
39 assert.sameValue(x[0], 1);
40 assert.sameValue(x[1], 2);
41 assert.sameValue(x[2], 3);
42 assert.notSameValue(x, values);
43
44 ranCatch = true;
45 }
46
47 assert(ranCatch, 'executed `catch` block');
48
49 reportCompare(0, 0);