Debian Codegraph @

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

raw
1 // This file was procedurally generated from the following sources:
2 // - src/dstr-assignment/obj-rest-to-property.case
3 // - src/dstr-assignment/default/assignment-expr.template
4 /*---
5 description: When DestructuringAssignmentTarget is an object property, its value should be binded as rest object. (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 src = {};
21
22 var result;
23 var vals = { x: 1, y: 2};
24
25 result = {...src.y} = vals;
26
27 assert.sameValue(src.y.x, 1);
28 assert.sameValue(src.y.y, 2);
29
30 verifyProperty(src, "y", {
31 enumerable: true,
32 writable: true,
33 configurable: true
34 });
35
36 assert.sameValue(result, vals);