Skip to content

Fix issue with generating async functions inside loops.#6479

Merged
cristianoc merged 1 commit into
masterfrom
async_inside_loop
Nov 9, 2023
Merged

Fix issue with generating async functions inside loops.#6479
cristianoc merged 1 commit into
masterfrom
async_inside_loop

Conversation

@cristianoc

@cristianoc cristianoc commented Nov 8, 2023

Copy link
Copy Markdown
Collaborator

Fixes #6444

The example comes from a code transformation that deals with closures inside loops. Specifically, since var is function scope, and immediately-executed function is generated to capture the variable.
The generated code was missing an async in the returned function, but also an await on the outside.

Note this entire transformation becomes unnecessary after #6102

@cristianoc

Copy link
Copy Markdown
Collaborator Author

@zth @cknitt can you think of other tests to try? Asking as this becomes the only test that triggers this issue, and 2 changes were required in the generated code, so making sure nothing is missing.

@zth zth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing I can think of OTOH. Landing let support is going to be great, so we can get rid of these things.

@cristianoc cristianoc merged commit 182c6e8 into master Nov 9, 2023
@cristianoc cristianoc deleted the async_inside_loop branch November 9, 2023 09:02
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.

Async await syntax breaks in compiled JS when declaring an async closure inside a loop that has access to a scoped value

2 participants