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

Closure only runs on the subset of the generated JS code not, for example, modularized code #23158

Open
sbc100 opened this issue Dec 13, 2024 · 0 comments · May be fixed by #23261
Open

Closure only runs on the subset of the generated JS code not, for example, modularized code #23158

sbc100 opened this issue Dec 13, 2024 · 0 comments · May be fixed by #23261

Comments

@sbc100
Copy link
Collaborator

sbc100 commented Dec 13, 2024

Since we do modularization after we run closure compiler this can lead to some strange effects. For example, if we try to use await in the main out closure will see it as a top-level-await, even though in modularize mode its inside the factory function.

@sbc100 sbc100 changed the title Closure only run on the subset of the generated JS code not, for example, modularized code Closure only runs on the subset of the generated JS code not, for example, modularized code Dec 13, 2024
sbc100 added a commit to sbc100/emscripten that referenced this issue Dec 30, 2024
Prior to this change the mudularization was done as a post-processing
step in python.  This complicated things since acorn and closure passes
would only see the inner code and not the whole module.

One concrete benefit is that we can now use `await` in the body of the
factory function since closure no longer sees it as top level (which it
isn't).

Fixes: emscripten-core#23158
@sbc100 sbc100 linked a pull request Dec 30, 2024 that will close this issue
sbc100 added a commit to sbc100/emscripten that referenced this issue Dec 31, 2024
Prior to this change the mudularization was done as a post-processing
step in python.  This complicated things since acorn and closure passes
would only see the inner code and not the whole module.

One concrete benefit is that we can now use `await` in the body of the
factory function since closure no longer sees it as top level (which it
isn't).

Fixes: emscripten-core#23158
sbc100 added a commit to sbc100/emscripten that referenced this issue Dec 31, 2024
Prior to this change the mudularization was done as a post-processing
step in python.  This complicated things since acorn and closure passes
would only see the inner code and not the whole module.

One concrete benefit is that we can now use `await` in the body of the
factory function since closure no longer sees it as top level (which it
isn't).

Fixes: emscripten-core#23158
sbc100 added a commit to sbc100/emscripten that referenced this issue Jan 2, 2025
Prior to this change the mudularization was done as a post-processing
step in python.  This complicated things since acorn and closure passes
would only see the inner code and not the whole module.

One concrete benefit is that we can now use `await` in the body of the
factory function since closure no longer sees it as top level (which it
isn't).

Fixes: emscripten-core#23158
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 a pull request may close this issue.

1 participant