Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/ary-ptrn-rest-id-direct.case
3 // - src/dstr-binding/default/try.template
4 /*---
5 description: Lone rest element (direct binding) (try statement)
6 esid: sec-runtime-semantics-catchclauseevaluation
7 features: [destructuring-binding]
8 flags: [generated]
9 includes: [compareArray.js]
10 info: |
11 Catch : catch ( CatchParameter ) Block
12
13 [...]
14 5. Let status be the result of performing BindingInitialization for
15 CatchParameter passing thrownValue and catchEnv as arguments.
16 [...]
17
18 Runtime Semantics: IteratorBindingInitialization
19
20 BindingRestElement : ... BindingIdentifier
21
22 [...]
23 2. Let A be ! ArrayCreate(0).
24 3. Let n be 0.
25 4. Repeat,
26 [...]
27 f. Perform ! CreateDataPropertyOrThrow(A, ! ToString(n), nextValue).
28 g. Set n to n + 1.
29
30 ---*/
31
32 var ranCatch = false;
33
34 try {
35 throw [1];
36 } catch ([...x]) {
37 assert(Array.isArray(x));
38 assert.compareArray(x, [1]);
39 ranCatch = true;
40 }
41
42 assert(ranCatch, 'executed `catch` block');
43
44 reportCompare(0, 0);