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

Compiling post.js with >O1 leads to extra parentheses #6847

Closed
Polevata opened this issue Jul 12, 2018 · 2 comments
Closed

Compiling post.js with >O1 leads to extra parentheses #6847

Polevata opened this issue Jul 12, 2018 · 2 comments

Comments

@Polevata
Copy link

define(function (require) {
"use strict";
return Module;
});

turns into

define((function(require){"use strict";return Module}))

This is using version 1.38.8 and the compile command:
"em++ -Os --bind a.cpp b.cpp -o src/cpp/gen/out.js --post-js src/cpp/post.js --memory-init-file 0 -s WASM=0"

@kripken
Copy link
Member

kripken commented Jul 12, 2018

The Uglify1 JS AST that our optimizer currently uses does seem to add extra parentheses in some cases. If you build with --closure 1 for closure compiler it should optimize away such things. Otherwise, to fix this we'd need to update our underlying JS AST, #6000.

@Polevata
Copy link
Author

Perfect! I use minimal pre and post-js, so enabling closure compiler was just the solution I was looking for. Thanks!

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

No branches or pull requests

2 participants