aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2015-03-23 23:27:00 +0200
committerMihai Bazon <mihai.bazon@gmail.com>2015-03-23 23:27:00 +0200
commit276b9a31cda2a2ef93e7af4e966baae91a434361 (patch)
tree9a78b3d51d53bfed51670aa9ac25cffeae3a7196
parent5801fa39e9524e7b7a565a39c5efa12cdef3202f (diff)
downloadtracifyjs-276b9a31cda2a2ef93e7af4e966baae91a434361.tar.gz
tracifyjs-276b9a31cda2a2ef93e7af4e966baae91a434361.zip
Fix compressing `![foo()];` as a statement
need to check whether the literal has any side effects before replacing that with `false`.
-rw-r--r--lib/compress.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js
index a9e1da37..41e4f17f 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -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;