blob: 091daebbb8cb1613b2eb634ac1ffd4087f135b23 [file] [log] [blame]
keith_miller@apple.combcc77f22016-07-15 06:03:25 +00001// This file was procedurally generated from the following sources:
2// - src/spread/sngl-expr.case
3// - src/spread/default/array.template
4/*---
5description: Spread operator applied to AssignmentExpression as only element (Array initializer)
6esid: sec-runtime-semantics-arrayaccumulation
7es6id: 12.2.5.2
8flags: [generated]
9info: |
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 12.3.6.1 Runtime Semantics: ArgumentListEvaluation
25
26 ArgumentList : ... AssignmentExpression
27
28 1. Let list be an empty List.
29 2. Let spreadRef be the result of evaluating AssignmentExpression.
30 3. Let spreadObj be GetValue(spreadRef).
31 4. Let iterator be GetIterator(spreadObj).
32 5. ReturnIfAbrupt(iterator).
33 6. Repeat
34 a. Let next be IteratorStep(iterator).
35 b. ReturnIfAbrupt(next).
36 c. If next is false, return list.
37 d. Let nextArg be IteratorValue(next).
38 e. ReturnIfAbrupt(nextArg).
39 f. Append nextArg as the last element of list.
40---*/
41var source = [2, 3, 4];
42var target;
43
44var callCount = 0;
45
46(function() {
47 assert.sameValue(arguments.length, 3);
48 assert.sameValue(arguments[0], 2);
49 assert.sameValue(arguments[1], 3);
50 assert.sameValue(arguments[2], 4);
51 assert.sameValue(target, source);
52 callCount += 1;
53}.apply(null, [...target = source]));
54
55assert.sameValue(callCount, 1);