Fix compressing ![foo()]; as a statement

need to check whether the literal has any side effects before replacing that
with `false`.
This commit is contained in:
Mihai Bazon
2015-03-23 23:27:00 +02:00
parent 5801fa39e9
commit 276b9a31cd

View File

@@ -2480,7 +2480,7 @@ merge(Compressor.prototype, {
});
function literals_in_boolean_context(self, compressor) {
if (compressor.option("booleans") && compressor.in_boolean_context()) {
if (compressor.option("booleans") && compressor.in_boolean_context() && !self.has_side_effects(compressor)) {
return make_node(AST_True, self);
}
return self;