Skip to content

Conversation

lissein
Copy link
Contributor

@lissein lissein commented May 13, 2020

The previous implementation wasn't able to handle case like await (async () => {}) outside of "async" functions.

One problem is that the syntax can be exactly the same for two usecases:

Use case 1

await (async () => {})()

An await expression on the self-calling async function

Use case 2

function await(fn) {
  return () => {};
}
await (async () => {})(); // equivalent to: await((async () => {})())

A call to the function returned by a call to the "await" user defined function with the async () => {} argument.


We have no way to know which case we want to handle. This pull request handles Use case 2 first. If there is some identifier named "await" defined, we make this statement a function call, otherwise, we make it an await expression.

I can update this PR if someone has a better idea to handle this ambiguous case.

Fixes #38483

The previous implementation wasn't able to handle case like `await (async () => {})`
outside of "async" functions.
@lissein
Copy link
Contributor Author

lissein commented May 13, 2020

Wrong repository

@lissein lissein closed this May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Incorrect lexing of TLA await in try...catch
1 participant