super-reference-resolution.js (590B)
1 // Copyright (C) 2020 Rick Waldron. All rights reserved. 2 // This code is governed by the BSD license found in the LICENSE file. 3 /*--- 4 esid: sec-super-keyword 5 description: Binds the "this" value to value returned by "parent" constructor 6 info: | 7 6. Let result be ? Construct(func, argList, newTarget). 8 7. Let thisER be GetThisEnvironment( ). 9 8. Return ? thisER.BindThisValue(result). 10 features: [class] 11 ---*/ 12 13 class X { 14 method() { return this; } 15 } 16 17 class Y extends X { 18 method() { return super.method(); } 19 } 20 21 const y = new Y(); 22 23 assert.sameValue(y.method(), y); 24 25 reportCompare(0, 0);