1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

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
parent 609a0aa75d
commit 46ef333e9c
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();
});
});