| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/spread/obj-mult-spread.case |
| 3 |
// - src/spread/default/array.template |
| 4 |
/*--- |
| 5 |
description: Multiple Object Spread operation (Array initializer) |
| 6 |
esid: sec-runtime-semantics-arrayaccumulation |
| 7 |
features: [object-spread] |
| 8 |
flags: [generated] |
| 9 |
info: | |
| 10 |
SpreadElement : ...AssignmentExpression |
| 11 |
|
| 12 |
1. Let spreadRef be the result of evaluating AssignmentExpression. |
| 13 |
2. Let spreadObj be ? GetValue(spreadRef). |
| 14 |
3. Let iterator be ? GetIterator(spreadObj). |
| 15 |
4. Repeat |
| 16 |
a. Let next be ? IteratorStep(iterator). |
| 17 |
b. If next is false, return nextIndex. |
| 18 |
c. Let nextValue be ? IteratorValue(next). |
| 19 |
d. Let status be CreateDataProperty(array, ToString(ToUint32(nextIndex)), |
| 20 |
nextValue). |
| 21 |
e. Assert: status is true. |
| 22 |
f. Let nextIndex be nextIndex + 1. |
| 23 |
|
| 24 |
Pending Runtime Semantics: PropertyDefinitionEvaluation |
| 25 |
|
| 26 |
PropertyDefinition:...AssignmentExpression |
| 27 |
|
| 28 |
1. Let exprValue be the result of evaluating AssignmentExpression. |
| 29 |
2. Let fromValue be GetValue(exprValue). |
| 30 |
3. ReturnIfAbrupt(fromValue). |
| 31 |
4. Let excludedNames be a new empty List. |
| 32 |
5. Return CopyDataProperties(object, fromValue, excludedNames). |
| 33 |
|
| 34 |
---*/ |
| 35 |
|
| 36 |
let o = {a: 2, b: 3}; |
| 37 |
let o2 = {c: 4, d: 5}; |
| 38 |
|
| 39 |
|
| 40 |
var callCount = 0; |
| 41 |
|
| 42 |
(function(obj) { |
| 43 |
assert.sameValue(obj.a, 2); |
| 44 |
assert.sameValue(obj.b, 3); |
| 45 |
assert.sameValue(obj.c, 4); |
| 46 |
assert.sameValue(obj.d, 5); |
| 47 |
assert.sameValue(Object.keys(obj).length, 4); |
| 48 |
callCount += 1; |
| 49 |
}.apply(null, [{...o, ...o2}])); |
| 50 |
|
| 51 |
assert.sameValue(callCount, 1); |
| 52 |
|
| 53 |
reportCompare(0, 0); |