Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-binding/obj-ptrn-rest-val-obj.case
3 // - src/dstr-binding/default/try.template
4 /*---
5 description: Rest object contains just unextracted data (try statement)
6 esid: sec-runtime-semantics-catchclauseevaluation
7 features: [object-rest, destructuring-binding]
8 flags: [generated]
9 includes: [propertyHelper.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
19 var ranCatch = false;
20
21 try {
22 throw {x: 1, y: 2, a: 5, b: 3};
23 } catch ({a, b, ...rest}) {
24 assert.sameValue(rest.a, undefined);
25 assert.sameValue(rest.b, undefined);
26
27 verifyProperty(rest, "x", {
28 enumerable: true,
29 writable: true,
30 configurable: true,
31 value: 1
32 });
33
34 verifyProperty(rest, "y", {
35 enumerable: true,
36 writable: true,
37 configurable: true,
38 value: 2
39 });
40 ranCatch = true;
41 }
42
43 assert(ranCatch, 'executed `catch` block');
44
45 reportCompare(0, 0);