-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
invert reduce_vars
tracking flag
#1519
Conversation
I see the need for the PR, but be aware that negative variable names lead to all sorts of bugs down the road - especially when the negative variable is negated with |
@kzc agreed with the suboptimal naming - how about |
reduce_vars
tracking flagreduce_vars
tracking flag
I'm afraid I do not know the purpose of this property. If you think that name matches its purpose, then sure. |
It marks the variable as not being assigned/modified outside of |
I'm stumped to come up with a positive name for
|
c875434
to
0bea291
Compare
I've picked |
OT: making a release for |
reduce_vars
tracking flagreduce_vars
tracking flag
So this will re-enable |
It re-enables |
I see. That makes sense. Downstream low level Uglify API users would still have to update that line of code to make use of the compress options |
That is something to bear in mind going forward if/when somebody reports an issue about sub-optimal minification. But better that than completely broken output... (I'm waiting on Travis CI, which seems to be experiencing major outage.) |
Can you add this patch to this PR? --- a/README.md
+++ b/README.md
@@ -621,7 +621,7 @@ function uglify(ast, options, mangle) {
// Compression
uAST.figure_out_scope();
- uAST = uAST.transform(UglifyJS.Compressor(options));
+ uAST = UglifyJS.Compressor(options).compress(uAST);
// Mangling (optional)
if (mangle) {
@@ -865,7 +865,7 @@ toplevel.figure_out_scope()
Like this:
```javascript
var compressor = UglifyJS.Compressor(options);
-var compressed_ast = toplevel.transform(compressor);
+var compressed_ast = compressor.compress(toplevel);
The `options` can be missing. Available options are discussed above in |
Modules like webpack and grunt-contrib-uglify still uses `ast.transform(compressor)` before `Compressor.compress(ast)` was introduced. Workaround this compatibility issue by deactivating `reduce_vars` in such case. Also fix use case with omitted `options` when calling `Compressor()`. fixes mishoo#1516
bf542bd
to
748d5e2
Compare
Pending the Travis CI tests, I assume you'll make a 2.8.2 release with this PR shortly? |
That is my current thinking, unless you'd like a grace period in order to get some quality sleep, for instance? |
I think it's fine for a 2.8.2 release once Travis CI runs successfully. |
(CI testing took 30 min 25 sec) Edit: battery of |
@alexlamsl Since master has been tagged with v2.8.2 would you mind merging master into harmony and tagging |
Modules like webpack and grunt-contrib-uglify still uses
ast.transform(compressor)
beforeCompressor.compress(ast)
was introduced.Workaround this compatibility issue by deactivating
reduce_vars
in such case.fixes #1516