| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-assignment/obj-rest-order.case |
| 3 |
// - src/dstr-assignment/default/assignment-expr.template |
| 4 |
/*--- |
| 5 |
description: Rest operation follows [[OwnPropertyKeys]] order (AssignmentExpression) |
| 6 |
esid: sec-variable-statement-runtime-semantics-evaluation |
| 7 |
es6id: 13.3.2.4 |
| 8 |
features: [Symbol, object-rest, destructuring-binding] |
| 9 |
flags: [generated] |
| 10 |
includes: [compareArray.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; |
| 21 |
var calls = []; |
| 22 |
var o = { get z() { calls.push('z') }, get a() { calls.push('a') } }; |
| 23 |
Object.defineProperty(o, 1, { get: () => { calls.push(1) }, enumerable: true }); |
| 24 |
Object.defineProperty(o, Symbol('foo'), { get: () => { calls.push("Symbol(foo)") }, enumerable: true }); |
| 25 |
|
| 26 |
var result; |
| 27 |
var vals = o; |
| 28 |
|
| 29 |
result = {...rest} = vals; |
| 30 |
|
| 31 |
assert(compareArray(calls, [1, 'z', 'a', "Symbol(foo)"])); |
| 32 |
assert.sameValue(Object.keys(rest).length, 3); |
| 33 |
|
| 34 |
assert.sameValue(result, vals); |