Merge pull request #2464 from ljharb/super_evaluation_order

super evaluation order tests
This commit is contained in:
Leo Balter 2020-01-07 14:57:19 -05:00 committed by GitHub
commit 9b426e3e2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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');