mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibJS: Allow async functions named "async" as function properties
For example, https://locals.com/site/discover has a script with an object of the form: var f = { parser: { sync() {}, async async() {}, } }; We were previously throwing a syntax error on the async function, as we specifically did not allow using "async" as a function name here.
This commit is contained in:
committed by
Andreas Kling
parent
a5455ac121
commit
ada36e5c0a
Notes:
github-actions[bot]
2024-12-26 16:24:04 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/ada36e5c0a1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3047
@@ -207,6 +207,15 @@ describe("shorthanded properties with special names", () => {
|
||||
});
|
||||
|
||||
test("async functions as properties", () => {
|
||||
expect("({ async async() {} });").toEval();
|
||||
expect('"use strict"; ({ async async() {} });').toEval();
|
||||
|
||||
expect("({ async async });").not.toEval();
|
||||
expect("({ async async, });").not.toEval();
|
||||
expect("({ async async() });").not.toEval();
|
||||
expect("({ async async: 0 });").not.toEval();
|
||||
expect("({ async async = 0 });").not.toEval();
|
||||
|
||||
expect("({ async foo });").not.toEval();
|
||||
expect("({ async foo, });").not.toEval();
|
||||
expect("({ async foo() });").not.toEval();
|
||||
|
||||
Reference in New Issue
Block a user