super evaluation order tests

For https://github.com/tc39/ecma262/pull/1775
This commit is contained in:
Jordan Harband 2020-01-06 11:15:26 -08:00
parent 40884c1195
commit 5cb381cbe0
No known key found for this signature in database
GPG Key ID: 9F6A681E35EF8B56
1 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,29 @@
// Copyright (C) 2020 Jordan Harband. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: prod-SuperCall
description: SuperCall should evaluate Arguments prior to checking IsConstructable
info: |
GetSuperConstructor ( )
[...]
1. Let _func_ be ! GetSuperConstructor().
2. Let _argList_ be ? ArgumentListEvaluation of |Arguments|.
3. If IsConstructor(_func_) is *false*, throw a *TypeError* exception.
[...]
features: [default-parameters]
---*/
var x = 0;
class C extends Object {
constructor() {
super(x = 123);
}
}
Object.setPrototypeOf(C, parseInt);
assert.throws(TypeError, () => {
new C();
});
assert.sameValue(x, 123, 'via ArgumentListEvaluation');