call-spread-sngl-iter.js (1828B)
1 // This file was procedurally generated from the following sources: 2 // - src/spread/sngl-iter.case 3 // - src/spread/default/super-call.template 4 /*--- 5 description: Spread operator applied to the only argument with a valid iterator (SuperCall) 6 esid: sec-super-keyword-runtime-semantics-evaluation 7 features: [Symbol.iterator] 8 flags: [generated] 9 info: | 10 SuperCall : super Arguments 11 12 1. Let newTarget be GetNewTarget(). 13 2. If newTarget is undefined, throw a ReferenceError exception. 14 3. Let func be GetSuperConstructor(). 15 4. ReturnIfAbrupt(func). 16 5. Let argList be ArgumentListEvaluation of Arguments. 17 [...] 18 19 12.3.6.1 Runtime Semantics: ArgumentListEvaluation 20 21 ArgumentList : ... AssignmentExpression 22 23 1. Let list be an empty List. 24 2. Let spreadRef be the result of evaluating AssignmentExpression. 25 3. Let spreadObj be GetValue(spreadRef). 26 4. Let iterator be GetIterator(spreadObj). 27 5. ReturnIfAbrupt(iterator). 28 6. Repeat 29 a. Let next be IteratorStep(iterator). 30 b. ReturnIfAbrupt(next). 31 c. If next is false, return list. 32 d. Let nextArg be IteratorValue(next). 33 e. ReturnIfAbrupt(nextArg). 34 f. Append nextArg as the last element of list. 35 ---*/ 36 var iter = {}; 37 iter[Symbol.iterator] = function() { 38 var nextCount = 0; 39 return { 40 next: function() { 41 nextCount += 1; 42 return { done: nextCount === 3, value: nextCount }; 43 } 44 }; 45 }; 46 47 var callCount = 0; 48 49 class Test262ParentClass { 50 constructor() { 51 assert.sameValue(arguments.length, 2); 52 assert.sameValue(arguments[0], 1); 53 assert.sameValue(arguments[1], 2); 54 callCount += 1; 55 } 56 } 57 58 class Test262ChildClass extends Test262ParentClass { 59 constructor() { 60 super(...iter); 61 } 62 } 63 64 new Test262ChildClass(); 65 assert.sameValue(callCount, 1); 66 67 reportCompare(0, 0);