-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix Closure await import mangling regression
#27173
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
Changes from 2 commits
dd6b2c8
f0ecb68
1d0ccd2
7eff01a
2283dfc
8fb7c06
66ec26c
de815bf
43012c2
546051e
e466e04
2e08062
d6a77b9
d8c0b9a
f50c1ac
c0d52e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -468,6 +468,19 @@ def test_esm_worker_single_file(self): | |
| self.assertContained("new Worker(new URL('hello_world.mjs', import.meta.url), {", src) | ||
| self.assertContained('Hello, world!', self.run_js('hello_world.mjs')) | ||
|
|
||
| def test_esm_worker_closure(self): | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. test_esm_pthread_closure?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is an extend of |
||
| self.run_process([EMCC, '-o', 'hello_world.mjs', | ||
| '-sEXIT_RUNTIME', '-sPROXY_TO_PTHREAD', '-pthread', '-O2', | ||
| test_file('hello_world.c'), '--closure=1']) | ||
| src = read_file('hello_world.mjs') | ||
| self.assertContained('new URL("hello_world.wasm",import.meta.url)', src) | ||
| self.assertContained('(await import("node:worker_threads")).workerData==="em-pthread"', src) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are these assertions needed? i.e. won't the program fail if we the get the mangling wrong?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| create_file('run.mjs', ''' | ||
| import Module from './hello_world.mjs'; | ||
| await Module(); | ||
| ''') | ||
| self.assertContained('Hello, world!', self.run_js('run.mjs')) | ||
|
|
||
| def test_esm_closure(self): | ||
| self.run_process([EMCC, '-o', 'hello_world.mjs', | ||
| '--extern-post-js', test_file('modularize_post_js.js'), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need even more explanation here. Why we not what to rewrite those, and how do moving the re-writing prevent that? Are they not run through
preprocess?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a better fix for this, PTAL (the PR description has been updated accordingly).