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

Acorn optimizer: Allow top-level await expressions #21117

Merged
merged 4 commits into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,8 @@ def test_export_es6_allows_export_in_post_js(self):
@parameterized({
'': ([],),
# load a worker before startup to check ES6 modules there as well
'pthreads': (['-pthread', '-sPTHREAD_POOL_SIZE=1'],),
# pass -O2 to ensure the worker JS file is minified with Acorn
'pthreads': (['-O2', '-pthread', '-sPTHREAD_POOL_SIZE=1'],),
})
def test_export_es6(self, args, package_json):
self.run_process([EMCC, test_file('hello_world.c'), '-sEXPORT_ES6',
Expand Down
1 change: 1 addition & 0 deletions tools/acorn-optimizer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2029,6 +2029,7 @@ try {
preserveParens: closureFriendly,
onComment: closureFriendly ? sourceComments : undefined,
sourceType: exportES6 ? 'module' : 'script',
allowAwaitOutsideFunction: true,
});
} catch (err) {
err.message += (() => {
Expand Down