value-via-super-call.js (899B)
1 // Copyright (C) 2016 the V8 project authors. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-super-keyword-runtime-semantics-evaluation 5 es6id: 12.3.5.1 6 description: Value when invoked via SuperCall 7 info: | 8 SuperCall : super Arguments 9 10 1. Let newTarget be GetNewTarget(). 11 [...] 12 6. Let result be ? Construct(func, argList, newTarget). 13 [...] 14 features: [class, new.target] 15 ---*/ 16 17 var baseNewTarget, parentNewTarget; 18 19 class Base { 20 constructor() { 21 baseNewTarget = new.target; 22 } 23 } 24 25 class Parent extends Base { 26 constructor() { 27 parentNewTarget = new.target; 28 super(); 29 } 30 } 31 32 class Child extends Parent { 33 constructor() { 34 super(); 35 } 36 } 37 38 new Child(); 39 40 assert.sameValue(parentNewTarget, Child, 'within "parent" constructor'); 41 assert.sameValue(baseNewTarget, Child, 'within "base" constructor'); 42 43 reportCompare(0, 0);