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:
@@ -2480,7 +2480,7 @@ merge(Compressor.prototype, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function literals_in_boolean_context(self, compressor) {
|
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 make_node(AST_True, self);
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
|
|||||||
Reference in New Issue
Block a user