| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/dstr-assignment/obj-rest-skip-non-enumerable.case |
| 3 |
// - src/dstr-assignment/default/assignment-expr.template |
| 4 |
/*--- |
| 5 |
description: Rest object doesn't contain non-enumerable properties (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; |
| 21 |
var obj = {a: 3, b: 4}; |
| 22 |
Object.defineProperty(obj, "x", { value: 4, enumerable: false }); |
| 23 |
|
| 24 |
var result; |
| 25 |
var vals = obj; |
| 26 |
|
| 27 |
result = {...rest} = vals; |
| 28 |
|
| 29 |
assert.sameValue(Object.getOwnPropertyDescriptor(rest, "x"), undefined); |
| 30 |
|
| 31 |
verifyProperty(rest, "a", { |
| 32 |
enumerable: true, |
| 33 |
writable: true, |
| 34 |
configurable: true, |
| 35 |
value: 3 |
| 36 |
}); |
| 37 |
|
| 38 |
verifyProperty(rest, "b", { |
| 39 |
enumerable: true, |
| 40 |
writable: true, |
| 41 |
configurable: true, |
| 42 |
value: 4 |
| 43 |
}); |
| 44 |
|
| 45 |
assert.sameValue(result, vals); |