mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibJS: Don't treat yield after void as identifier in generator functions
This commit is contained in:
parent
a1308bfc60
commit
c8e80690a7
2 changed files with 15 additions and 0 deletions
|
@ -12,3 +12,15 @@ test("basic functionality", () => {
|
|||
expect(void (() => "hello friends")()).toBeUndefined();
|
||||
expect((() => void "hello friends")()).toBeUndefined();
|
||||
});
|
||||
|
||||
describe("errors", () => {
|
||||
test("treats yield in generator as non variable", () => {
|
||||
expect("function f() { void yield; }").toEval();
|
||||
expect("async function f() { void yield; }").toEval();
|
||||
expect("function *f() { void yield; }").not.toEval();
|
||||
expect("async function *f() { void yield; }").not.toEval();
|
||||
|
||||
expect("class C { *f() { void yield; } }").not.toEval();
|
||||
expect("var obj = { async function *f() { void yield; } }").not.toEval();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue