SuperProperty evaluation order, must first call super()

- Invalid: super[super()]. Expects super() to be called prior to super property access.
This commit is contained in:
Rick Waldron 2018-06-04 10:52:31 -04:00
parent 85a4484c52
commit ecea13b04a
1 changed files with 5 additions and 4 deletions

View File

@ -3,14 +3,15 @@
/*---
esid: sec-makesuperpropertyreference
description: >
SuperProperty evaluation order: super() thisBinding initialization occurs first.
SuperProperty evaluation order: super() thisBinding initialization must occur first.
---*/
class Derived extends Object {
constructor() {
super[super()];
throw new Test262Error();
}
}
var derived = new Derived();
assert.sameValue(derived instanceof Derived, true);
assert.sameValue(derived instanceof Object, true);
assert.throws(ReferenceError, function() {
new Derived();
}, '`super[super()]` via `new Derived()` throws a ReferenceError');