| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-assignment/obj-rest-same-name.case |
| 3 |
// - src/dstr-assignment/default/assignment-expr.template |
| 4 |
/*--- |
| 5 |
description: Proper setting in the values for rest name equal to a property name. (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 |
info: | |
| 11 |
VariableDeclaration : BindingPattern Initializer |
| 12 |
|
| 13 |
1. Let rhs be the result of evaluating Initializer. |
| 14 |
2. Let rval be GetValue(rhs). |
| 15 |
3. ReturnIfAbrupt(rval). |
| 16 |
4. Return the result of performing BindingInitialization for |
| 17 |
BindingPattern passing rval and undefined as arguments. |
| 18 |
---*/ |
| 19 |
var o = { |
| 20 |
x: 42, |
| 21 |
y: 39, |
| 22 |
z: 'cheeseburger' |
| 23 |
}; |
| 24 |
|
| 25 |
var x, y, z; |
| 26 |
|
| 27 |
var result; |
| 28 |
var vals = o; |
| 29 |
|
| 30 |
result = { x, ...z } = vals; |
| 31 |
|
| 32 |
assert.sameValue(x, 42); |
| 33 |
assert.sameValue(y, undefined); |
| 34 |
assert.sameValue(z.y, 39); |
| 35 |
assert.sameValue(z.z, 'cheeseburger'); |
| 36 |
|
| 37 |
var keys = Object.keys(z); |
| 38 |
assert.sameValue(keys.length, 2); |
| 39 |
assert.sameValue(keys[0], 'y'); |
| 40 |
assert.sameValue(keys[1], 'z'); |
| 41 |
|
| 42 |
assert.sameValue(result, vals); |