call-spread-obj-override-immutable.js (1367B)
1 // This file was procedurally generated from the following sources: 2 // - src/spread/obj-override-immutable.case 3 // - src/spread/default/super-call.template 4 /*--- 5 description: Object Spread overriding immutable properties (SuperCall) 6 esid: sec-super-keyword-runtime-semantics-evaluation 7 features: [object-spread] 8 flags: [generated] 9 includes: [propertyHelper.js] 10 info: | 11 SuperCall : super Arguments 12 13 1. Let newTarget be GetNewTarget(). 14 2. If newTarget is undefined, throw a ReferenceError exception. 15 3. Let func be GetSuperConstructor(). 16 4. ReturnIfAbrupt(func). 17 5. Let argList be ArgumentListEvaluation of Arguments. 18 [...] 19 ---*/ 20 21 let o = {b: 2}; 22 Object.defineProperty(o, "a", {value: 1, enumerable: true, writable: false, configurable: true}); 23 24 25 var callCount = 0; 26 27 class Test262ParentClass { 28 constructor(obj) { 29 assert.sameValue(obj.a, 3) 30 assert.sameValue(obj.b, 2); 31 32 verifyProperty(obj, "a", { 33 enumerable: true, 34 writable: true, 35 configurable: true, 36 value: 3 37 }); 38 39 verifyProperty(obj, "b", { 40 enumerable: true, 41 writable: true, 42 configurable: true, 43 value: 2 44 }); 45 callCount += 1; 46 } 47 } 48 49 class Test262ChildClass extends Test262ParentClass { 50 constructor() { 51 super({...o, a: 3}); 52 } 53 } 54 55 new Test262ChildClass(); 56 assert.sameValue(callCount, 1); 57 58 reportCompare(0, 0);