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

Enable createWasm to use async/await with closure and babel #23704

Merged
merged 1 commit into from
Mar 24, 2025

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Feb 19, 2025

I really which we had a better solution here, but this makes the use of async/await independent of closure usage.

This is a workaround for #23158, but it also happens to fix #23687
which stems from the same issue.

Fixes: #23687

@kleisauke
Copy link
Collaborator

FWIW, I once successfully implemented a better solution for this, but it turned out to be a large change, see:
#17915 (comment)

@sbc100
Copy link
Collaborator Author

sbc100 commented Feb 19, 2025

FWIW, I once successfully implemented a better solution for this, but it turned out to be a large change, see: #17915 (comment)

I also implemented another approach in #23261 which actually fixes #23158, but sadly it causes code size regressions, because closure doesn't seem to be able to reason about code inside of functions the same way it can about top level code.

@sbc100 sbc100 changed the title Enable createWasm to use async/await with closure Enable createWasm to use async/await with closure and babel Feb 19, 2025
@sbc100 sbc100 force-pushed the async_createWasm branch 3 times, most recently from 821b11c to 547dcc7 Compare February 19, 2025 22:08
@sbc100 sbc100 force-pushed the async_createWasm branch from 547dcc7 to 0c943c6 Compare March 21, 2025 23:01
I really which we had a better solution here, but this makes the use
of async/await independent of closure usage.

This is a workaround for emscripten-core#23158, but it also happens to fix emscripten-core#23687
which stems from the same issue.

Fixes: emscripten-core#23687
@sbc100 sbc100 force-pushed the async_createWasm branch from 0c943c6 to 95c0d1e Compare March 21, 2025 23:37
@sbc100 sbc100 merged commit a14f471 into emscripten-core:main Mar 24, 2025
24 checks passed
@sbc100 sbc100 deleted the async_createWasm branch March 24, 2025 17:05
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.

Error: 'await' is only allowed within async functions and at the top levels of modules.
3 participants