call-spread-obj-mult-spread-getter.js (1548B)
1 // This file was procedurally generated from the following sources: 2 // - src/spread/obj-mult-spread-getter.case 3 // - src/spread/default/super-call.template 4 /*--- 5 description: Multiple Object Spread usage calls getter multiple times (SuperCall) 6 esid: sec-super-keyword-runtime-semantics-evaluation 7 features: [object-spread] 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 Pending Runtime Semantics: PropertyDefinitionEvaluation 20 21 PropertyDefinition:...AssignmentExpression 22 23 1. Let exprValue be the result of evaluating AssignmentExpression. 24 2. Let fromValue be GetValue(exprValue). 25 3. ReturnIfAbrupt(fromValue). 26 4. Let excludedNames be a new empty List. 27 5. Return CopyDataProperties(object, fromValue, excludedNames). 28 29 ---*/ 30 let getterCallCount = 0; 31 let o = { 32 get a() { 33 return ++getterCallCount; 34 } 35 }; 36 37 38 var callCount = 0; 39 40 class Test262ParentClass { 41 constructor(obj) { 42 assert.sameValue(obj.a, 2); 43 assert.sameValue(obj.c, 4); 44 assert.sameValue(obj.d, 5); 45 assert.sameValue(Object.keys(obj).length, 3); 46 callCount += 1; 47 } 48 } 49 50 class Test262ChildClass extends Test262ParentClass { 51 constructor() { 52 super({...o, c: 4, d: 5, a: 42, ...o}); 53 } 54 } 55 56 new Test262ChildClass(); 57 assert.sameValue(callCount, 1); 58 59 reportCompare(0, 0);