Skip to content

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Sep 4, 2025

This polyfill is code a duplicate of the emGlobalThis polyfill.

@sbc100 sbc100 force-pushed the exportWasmSymbols branch 2 times, most recently from 3e6a7c1 to 8f4370c Compare September 4, 2025 19:48
@sbc100 sbc100 requested review from RReverser, kripken and juj September 4, 2025 19:48
@sbc100 sbc100 enabled auto-merge (squash) September 4, 2025 19:49
sbc100 added a commit to sbc100/emscripten that referenced this pull request Sep 4, 2025
This will allow us to use it from other places.

Split out from emscripten-core#25172
@sbc100
Copy link
Collaborator Author

sbc100 commented Sep 4, 2025

I split out the moving of the function so it can be separated from the usage with exportWasmSymbols.

sbc100 added a commit that referenced this pull request Sep 4, 2025
This will allow us to use it from other places.

Split out from #25172
@sbc100
Copy link
Collaborator Author

sbc100 commented Sep 5, 2025

OK, so I was wrong about the strict JS mode. Because exportWasmSymbols is an arrow function it actual does get its lexically scoped this .. strange.

I added a new test anyway just to confirm.

I think its still probably work landing this, if only to remove the duplication here.

Copy link
Collaborator Author

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

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

OK, to land this?

The emGlobalThis should be going away real soon, and only exists for users using -sLEGACY_BROWSER_SUPPORT so most users won't be effected.

But converting this codepath to use emGlobalThis it means it will automatically get cleaned up when emGlobalThis goes away.

Copy link
Collaborator

@juj juj left a comment

Choose a reason for hiding this comment

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

Yeh, lgtm

@sbc100 sbc100 merged commit 98aabf2 into emscripten-core:main Sep 8, 2025
30 checks passed
@sbc100 sbc100 deleted the exportWasmSymbols branch September 8, 2025 23:38
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.

2 participants