Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-rest-id.case
3 // - src/dstr-binding/default/try.template
4 /*---
5 description: Lone 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 BindingRestElement : ... BindingIdentifier
19 [...] 3. Let A be ArrayCreate(0). [...] 5. Repeat
20 [...]
21 f. Let status be CreateDataProperty(A, ToString (n), nextValue).
22 [...]
23 ---*/
24 var values = [1, 2, 3];
25
26 var ranCatch = false;
27
28 try {
29 throw values;
30 } catch ([...x]) {
31 assert(Array.isArray(x));
32 assert.sameValue(x.length, 3);
33 assert.sameValue(x[0], 1);
34 assert.sameValue(x[1], 2);
35 assert.sameValue(x[2], 3);
36 assert.notSameValue(x, values);
37 ranCatch = true;
38 }
39
40 assert(ranCatch, 'executed `catch` block');
41
42 reportCompare(0, 0);