mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +00:00
LibJS: Make class definition evaluation more spec like in ordering
This commit is contained in:
parent
d3ef08217b
commit
1245512c50
6 changed files with 258 additions and 131 deletions
|
@ -170,3 +170,32 @@ test("issue #7045, super constructor call from child class in catch {}", () => {
|
|||
const c = new Child();
|
||||
expect(c.x).toBe("Error in Child constructor");
|
||||
});
|
||||
|
||||
test("Issue #7044, super property access before super() call", () => {
|
||||
class Foo {
|
||||
constructor() {
|
||||
super.bar;
|
||||
}
|
||||
}
|
||||
|
||||
new Foo();
|
||||
});
|
||||
|
||||
test("Issue #8574, super property access before super() call", () => {
|
||||
var hit = false;
|
||||
|
||||
class Foo extends Object {
|
||||
constructor() {
|
||||
expect(() => {
|
||||
const foo = super.bar();
|
||||
}).toThrowWithMessage(ReferenceError, "|this| has not been initialized");
|
||||
hit = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Note: We catch two exceptions here.
|
||||
expect(() => {
|
||||
new Foo();
|
||||
}).toThrowWithMessage(ReferenceError, "|this| has not been initialized");
|
||||
expect(hit).toBeTrue();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue