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