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

Compressor not handling combination of conditional and boolean properly #137

Closed
tonylukasavage opened this issue Mar 1, 2013 · 0 comments

Comments

@tonylukasavage
Copy link

Node 0.8.17, uglify-js 2.2.5

var u = require('uglify-js');
var ast = u.parse('var a = "string" === "string"');
ast.figure_out_scope();
ast.transform(u.Compressor({
    // should be defaults, but just in case...
    booleans: true,
    conditionals: true,
    comparisons: true
}));
console.log(ast.print_to_string());

I would expect that this would result in the following code:

var a=!0;

It instead generates the following code:

var a=true;

This conversion occurs just fine separately, meaning that if I used var a=true; as my source code, it would compress to var a=!0;. It just seems as though nodes are not being re-evaluated after manipulation in some cases. It's also worth noting that this compression worked as expected in uglify-js v1.

@mishoo mishoo closed this as completed in 8880f48 Mar 1, 2013
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