| 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 |
| 5 |
es6id: 12.3.5 |
| 6 |
description: Abrupt completion from re-binding "this" value |
| 7 |
info: | |
| 8 |
[...] |
| 9 |
6. Let result be ? Construct(func, argList, newTarget). |
| 10 |
7. Let thisER be GetThisEnvironment( ). |
| 11 |
8. Return ? thisER.BindThisValue(result). |
| 12 |
|
| 13 |
8.1.1.3.1 BindThisValue |
| 14 |
|
| 15 |
1. Let envRec be the function Environment Record for which the method was |
| 16 |
invoked. |
| 17 |
2. Assert: envRec.[[ThisBindingStatus]] is not "lexical". |
| 18 |
3. If envRec.[[ThisBindingStatus]] is "initialized", throw a ReferenceError |
| 19 |
exception. |
| 20 |
features: [class] |
| 21 |
---*/ |
| 22 |
|
| 23 |
var caught; |
| 24 |
function Parent() {} |
| 25 |
|
| 26 |
class Child extends Parent { |
| 27 |
constructor() { |
| 28 |
super(); |
| 29 |
try { |
| 30 |
super(); |
| 31 |
} catch (err) { |
| 32 |
caught = err; |
| 33 |
} |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
new Child(); |
| 38 |
|
| 39 |
assert.sameValue(typeof caught, 'object'); |
| 40 |
assert.sameValue(caught.constructor, ReferenceError); |