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