Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-rest-id-elision.case
3 // - src/dstr-binding/default/try.template
4 /*---
5 description: Rest element following elision elements (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 ArrayBindingPattern : [ Elisionopt BindingRestElement ]
19 1. If Elision is present, then
20 a. Let status be the result of performing
21 IteratorDestructuringAssignmentEvaluation of Elision with
22 iteratorRecord as the argument.
23 b. ReturnIfAbrupt(status).
24 2. Return the result of performing IteratorBindingInitialization for
25 BindingRestElement with iteratorRecord and environment as arguments.
26 ---*/
27 var values = [1, 2, 3, 4, 5];
28
29 var ranCatch = false;
30
31 try {
32 throw values;
33 } catch ([ , , ...x]) {
34 assert(Array.isArray(x));
35 assert.sameValue(x.length, 3);
36 assert.sameValue(x[0], 3);
37 assert.sameValue(x[1], 4);
38 assert.sameValue(x[2], 5);
39 assert.notSameValue(x, values);
40 ranCatch = true;
41 }
42
43 assert(ranCatch, 'executed `catch` block');
44
45 reportCompare(0, 0);