LibJS: Parse generator functions in class expressions too

This commit is contained in:
Ali Mohammad Pur 2021-07-02 14:37:00 +04:30 committed by Andreas Kling
commit 46ef333e9c
Notes: sideshowbarker 2024-07-18 11:07:48 +09:00
2 changed files with 29 additions and 3 deletions

View file

@ -39,3 +39,13 @@ describe("parsing object literal generator functions", () => {
foo() { yield (yield); } }`).toEval();
});
});
describe("parsing classes with generator methods", () => {
test("simple", () => {
expect(`class Foo { *foo() {} }`).toEval();
expect(`class Foo { static *foo() {} }`).toEval();
expect(`class Foo { *foo() { yield; } }`).toEval();
expect(`class Foo { *foo() { yield 42; } }`).toEval();
expect(`class Foo { *constructor() { yield 42; } }`).not.toEval();
});
});