Debian Codegraph @

tests/auto/qml/ecmascripttests/test262/test/language/expressions/assignment/dstr-obj-rest-valid-object.js

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-assignment/obj-rest-valid-object.case
3 // - src/dstr-assignment/default/assignment-expr.template
4 /*---
5 description: Rest object contains just unextracted data (AssignmentExpression)
6 esid: sec-variable-statement-runtime-semantics-evaluation
7 es6id: 13.3.2.4
8 features: [object-rest, destructuring-binding]
9 flags: [generated]
10 includes: [propertyHelper.js]
11 info: |
12 VariableDeclaration : BindingPattern Initializer
13
14 1. Let rhs be the result of evaluating Initializer.
15 2. Let rval be GetValue(rhs).
16 3. ReturnIfAbrupt(rval).
17 4. Return the result of performing BindingInitialization for
18 BindingPattern passing rval and undefined as arguments.
19 ---*/
20 var rest, a, b;
21
22
23 var result;
24 var vals = {x: 1, y: 2, a: 5, b: 3};
25
26 result = {a, b, ...rest} = vals;
27
28 assert.sameValue(rest.a, undefined);
29 assert.sameValue(rest.b, undefined);
30
31 verifyProperty(rest, "x", {
32 enumerable: true,
33 writable: true,
34 configurable: true,
35 value: 1
36 });
37
38 verifyProperty(rest, "y", {
39 enumerable: true,
40 writable: true,
41 configurable: true,
42 value: 2
43 });
44
45 assert.sameValue(result, vals);