mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:27:45 +00:00
LibJS: Stop parsing an expression on comma after a yield
This commit is contained in:
parent
156dfe3d62
commit
4d7e79fb72
2 changed files with 7 additions and 1 deletions
|
@ -12,6 +12,12 @@ describe("parsing freestanding generators", () => {
|
|||
expect(`function foo() { yield; }`).toEval();
|
||||
expect(`function foo() { yield 3; }`).not.toEval();
|
||||
});
|
||||
|
||||
test("yield expression only gets the first expression", () => {
|
||||
expect("function* foo() { yield 2,3 }").toEval();
|
||||
expect("function* foo() { ({...yield yield, }) }").toEval();
|
||||
});
|
||||
|
||||
test("yield-from expression", () => {
|
||||
expect(`function* foo() { yield *bar; }`).toEval();
|
||||
expect(`function* foo() { yield *(yield); }`).toEval();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue