mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:48:12 +00:00
LibJS: Extend class 'extends' RHS expression parsing
Instead of only parsing a primary expression, we should also allow member expressions, call expressions, and tagged template literals (and optional chains, which we don't have yet). In the spec, all of this is covered by `LeftHandSideExpression` (https://tc39.es/ecma262/#prod-LeftHandSideExpression).
This commit is contained in:
parent
b975a74a1d
commit
08a303172d
2 changed files with 34 additions and 0 deletions
|
@ -132,6 +132,24 @@ test("super constructor call from child class with argument", () => {
|
|||
expect(c.x).toBe(10);
|
||||
});
|
||||
|
||||
test("advanced 'extends' RHS", () => {
|
||||
const foo = {
|
||||
bar() {
|
||||
return {
|
||||
baz() {
|
||||
return function () {
|
||||
return function () {
|
||||
return { quux: Number };
|
||||
};
|
||||
};
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
class Foo extends foo.bar()["baz"]()`qux`().quux {}
|
||||
expect(new Foo()).toBeInstanceOf(Number);
|
||||
});
|
||||
|
||||
test("issue #7045, super constructor call from child class in catch {}", () => {
|
||||
class Parent {
|
||||
constructor(x) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue