Debian Codegraph @

js/src/tests/test262/language/statements/const/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/const-stmt.template
4 /*---
5 description: Rest object contains just unextracted data (`const` statement)
6 esid: sec-let-and-const-declarations-runtime-semantics-evaluation
7 features: [object-rest, destructuring-binding]
8 flags: [generated]
9 includes: [propertyHelper.js]
10 info: |
11 LexicalBinding : BindingPattern Initializer
12
13 1. Let rhs be the result of evaluating Initializer.
14 2. Let value be GetValue(rhs).
15 3. ReturnIfAbrupt(value).
16 4. Let env be the running execution context's LexicalEnvironment.
17 5. Return the result of performing BindingInitialization for BindingPattern
18 using value and env as the arguments.
19 ---*/
20
21 const {a, b, ...rest} = {x: 1, y: 2, a: 5, b: 3};
22
23 assert.sameValue(rest.a, undefined);
24 assert.sameValue(rest.b, undefined);
25
26 verifyProperty(rest, "x", {
27 enumerable: true,
28 writable: true,
29 configurable: true,
30 value: 1
31 });
32
33 verifyProperty(rest, "y", {
34 enumerable: true,
35 writable: true,
36 configurable: true,
37 value: 2
38 });
39
40 reportCompare(0, 0);