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

Investigate called CallExpressions situation #1

Closed
Andarist opened this issue Sep 24, 2017 · 1 comment
Closed

Investigate called CallExpressions situation #1

Andarist opened this issue Sep 24, 2017 · 1 comment
Labels

Comments

@Andarist
Copy link
Owner

Decide how to annotate this one:

fn()()()

At the moment it produces:

/*#__PURE__*//*#__PURE__*//*#__PURE__*/fn()()()

Which needs to be changed somehow.

@Andarist
Copy link
Owner Author

mishoo/UglifyJS#2331
At the moment pure callable expressions are considered as completely pure - this means that:

  • it is sufficient to annotate only the outermost callable expression
  • if callable expression is used as callee in pure callable expression its contents are considered pure, even if containing other, possibly impure, call expressions

The latter is quite a mouthful, so let's illustrate it with an example:

input code

// ./file.js
var b = /*#__PURE__*/fn(arg1())(arg2())(arg3())

output code

$ uglifyjs --toplevel -mc passes=3 ./file.js
arg3();

Andarist added a commit that referenced this issue Sep 30, 2017
Annotate only the outermost callable expressions (fixes #1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant