Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use "async" as a function identifier. #2275

Closed
tunz opened this issue Sep 10, 2022 · 0 comments
Closed

Use "async" as a function identifier. #2275

tunz opened this issue Sep 10, 2022 · 0 comments
Labels
bug Something isn't working
Milestone

Comments

@tunz
Copy link
Contributor

tunz commented Sep 10, 2022

Describe the bug

async is a keyword, but also allowed as an identifier.
https://tc39.es/ecma262/#sec-keywords-and-reserved-words

Those that are always allowed as identifiers, but also appear as keywords within certain syntactic productions, at places where Identifier is not allowed: as, async, from, get, meta, of, set, and target.

But, currently, it raises an error when calling a function named async.

To Reproduce
Run the following code:

async();

Uncaught "SyntaxError": "expected token 'function', got '(' in async function declaration at line 1, col 6"

Expected behavior
It should be a reference error, or running ok if "async" function is defined.

Note that async should be recognized as a keyword in the following case.

let fn = async () => { };

Additional context
Mentioned in #2269

@tunz tunz added the bug Something isn't working label Sep 10, 2022
@bors bors bot closed this as completed in 2072f51 Sep 10, 2022
@Razican Razican added this to the v0.16.0 milestone Sep 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants