mirror of
https://github.com/tc39/test262.git
synced 2025-07-23 05:55:36 +02:00
Update call-proto-not-ctor.js
This commit is contained in:
parent
922e27fd8c
commit
b3c94b3268
@ -2,7 +2,6 @@
|
|||||||
// This code is governed by the BSD license found in the LICENSE file.
|
// This code is governed by the BSD license found in the LICENSE file.
|
||||||
/*---
|
/*---
|
||||||
esid: sec-super-keyword
|
esid: sec-super-keyword
|
||||||
es6id: 12.3.5
|
|
||||||
description: SuperCall should evaluate Arguments prior to checking IsConstructor
|
description: SuperCall should evaluate Arguments prior to checking IsConstructor
|
||||||
info: |
|
info: |
|
||||||
SuperCall : `super` Arguments
|
SuperCall : `super` Arguments
|
||||||
@ -16,16 +15,27 @@ features: [class]
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
var evaluatedArg = false;
|
var evaluatedArg = false;
|
||||||
|
var caught;
|
||||||
class C extends Object {
|
class C extends Object {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(evaluatedArg = true);
|
try {
|
||||||
|
super(evaluatedArg = true);
|
||||||
|
} catch (err) {
|
||||||
|
caught = err;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Object.setPrototypeOf(C, parseInt);
|
Object.setPrototypeOf(C, parseInt);
|
||||||
|
|
||||||
assert.throws(TypeError, () => {
|
// When the "construct" invocation completes and the "this" value is
|
||||||
|
// uninitialized, the specification dictates that a ReferenceError must be
|
||||||
|
// thrown. That behavior is tested elsewhere, so the error is ignored (if it is
|
||||||
|
// produced at all).
|
||||||
|
try {
|
||||||
new C();
|
new C();
|
||||||
});
|
} catch (_) {}
|
||||||
|
|
||||||
|
assert.sameValue(typeof caught, 'object');
|
||||||
|
assert.sameValue(caught.constructor, TypeError);
|
||||||
assert(evaluatedArg, 'performs ArgumentsListEvaluation');
|
assert(evaluatedArg, 'performs ArgumentsListEvaluation');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user