| 1 |
// This file was procedurally generated from the following sources: |
| 2 |
// - src/spread/sngl-expr.case |
| 3 |
// - src/spread/default/member-expr.template |
| 4 |
/*--- |
| 5 |
description: Spread operator applied to AssignmentExpression as only element (`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 : ... AssignmentExpression |
| 24 |
|
| 25 |
1. Let list be an empty List. |
| 26 |
2. Let spreadRef be the result of evaluating AssignmentExpression. |
| 27 |
3. Let spreadObj be GetValue(spreadRef). |
| 28 |
4. Let iterator be GetIterator(spreadObj). |
| 29 |
5. ReturnIfAbrupt(iterator). |
| 30 |
6. Repeat |
| 31 |
a. Let next be IteratorStep(iterator). |
| 32 |
b. ReturnIfAbrupt(next). |
| 33 |
c. If next is false, return list. |
| 34 |
d. Let nextArg be IteratorValue(next). |
| 35 |
e. ReturnIfAbrupt(nextArg). |
| 36 |
f. Append nextArg as the last element of list. |
| 37 |
---*/ |
| 38 |
var source = [2, 3, 4]; |
| 39 |
var target; |
| 40 |
|
| 41 |
var callCount = 0; |
| 42 |
|
| 43 |
new function() { |
| 44 |
assert.sameValue(arguments.length, 3); |
| 45 |
assert.sameValue(arguments[0], 2); |
| 46 |
assert.sameValue(arguments[1], 3); |
| 47 |
assert.sameValue(arguments[2], 4); |
| 48 |
assert.sameValue(target, source); |
| 49 |
callCount += 1; |
| 50 |
}(...target = source); |
| 51 |
|
| 52 |
assert.sameValue(callCount, 1); |