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