-
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
separate keep_classnames
& keep_fnames
#2510
Conversation
This one is a bit odd: $ cat names.js
class C0 {}
function F0() {}
console.log(class C1{}, class C2{}, function F1(){}, function F2(){}); $ cat names.js | bin/uglifyjs -mc --toplevel
console.log(class c{},class c{},function(){},function(){}); I would have expected the same output as: $ cat names.js | bin/uglifyjs -mc keep_classnames=0 --toplevel
console.log(class{},class{},function(){},function(){}); |
lib/compress.js
Outdated
@@ -69,6 +69,7 @@ function Compressor(options, false_by_default) { | |||
if_return : !false_by_default, | |||
inline : !false_by_default, | |||
join_vars : !false_by_default, | |||
keep_classnames: !false_by_default, |
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 see what's going on - this should default to false
.
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 bet that extra character is annoying you to no end. :-)
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.
Thanks for catching this - I waited till just before bedtime to make this PR to alleviate my pain.
I'll make a doc PR after this is merged. |
In another PR we could have |
documented in #2511 |
add tests
Do we want some Using same code for all tests: class C1 {}
function F1() {}
console.log(class C2{}, function F2(){}); |
Done in https://github.com/mishoo/UglifyJS2/pull/2510/files#diff-7a02108b11616cdd07d36b9a138a71cbR1578 I use the subtlety of parentheses instead, just to make me feel better 😈 |
Cool. I don't know how I missed that.
|
Yeah - I go overboard with |
|
Compressor default values are not applied in |
They are if they are not associated with |
I see. The next release will be 3.2.0 because of this new option and hoist_props defaulting to true, I'm assuming? |
Yes ✖️ 2 |
fixes #2418