| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/spread/mult-literal.case |
| 3 |
// - src/spread/default/member-expr.template |
| 4 |
/*--- |
| 5 |
description: Spread operator applied to AssignmentExpression following other elements (`new` operator) |
| 6 |
esid: sec-new-operator-runtime-semantics-evaluation |
| 7 |
es6id: 12.3.3.1 |
| 8 |
flags: [generated] |
| 9 |
info: | |
| 10 |
MemberExpression : new MemberExpression Arguments |
| 11 |
|
| 12 |
1. Return EvaluateNew(MemberExpression, Arguments). |
| 13 |
|
| 14 |
12.3.3.1.1 Runtime Semantics: EvaluateNew |
| 15 |
|
| 16 |
6. If arguments is empty, let argList be an empty List. |
| 17 |
7. Else, |
| 18 |
a. Let argList be ArgumentListEvaluation of arguments. |
| 19 |
[...] |
| 20 |
|
| 21 |
12.3.6.1 Runtime Semantics: ArgumentListEvaluation |
| 22 |
|
| 23 |
ArgumentList : ArgumentList , ... AssignmentExpression |
| 24 |
|
| 25 |
1. Let precedingArgs be the result of evaluating ArgumentList. |
| 26 |
2. Let spreadRef be the result of evaluating AssignmentExpression. |
| 27 |
3. Let iterator be GetIterator(GetValue(spreadRef) ). |
| 28 |
4. ReturnIfAbrupt(iterator). |
| 29 |
5. Repeat |
| 30 |
a. Let next be IteratorStep(iterator). |
| 31 |
b. ReturnIfAbrupt(next). |
| 32 |
c. If next is false, return precedingArgs. |
| 33 |
---*/ |
| 34 |
|
| 35 |
var callCount = 0; |
| 36 |
|
| 37 |
new function() { |
| 38 |
assert.sameValue(arguments.length, 5); |
| 39 |
assert.sameValue(arguments[0], 5); |
| 40 |
assert.sameValue(arguments[1], 6); |
| 41 |
assert.sameValue(arguments[2], 7); |
| 42 |
assert.sameValue(arguments[3], 8); |
| 43 |
assert.sameValue(arguments[4], 9); |
| 44 |
callCount += 1; |
| 45 |
}(5, ...[6, 7, 8], 9); |
| 46 |
|
| 47 |
assert.sameValue(callCount, 1); |