LibJS: Ensure a function follows an async identifier in objects

This commit is contained in:
Timothy Flynn 2024-12-26 09:07:40 -05:00 committed by Andreas Kling
commit a5455ac121
Notes: github-actions[bot] 2024-12-26 16:24:11 +00:00
2 changed files with 15 additions and 0 deletions

View file

@ -205,6 +205,14 @@ describe("shorthanded properties with special names", () => {
expect('"use strict"; var await = 8; ({ await, })').toEval();
expect('"use strict"; var async = 7; ({ async, })').toEval();
});
test("async functions as properties", () => {
expect("({ async foo });").not.toEval();
expect("({ async foo, });").not.toEval();
expect("({ async foo() });").not.toEval();
expect("({ async foo: 0 });").not.toEval();
expect("({ async foo = 0 });").not.toEval();
});
});
describe("errors", () => {