From 276b9a31cda2a2ef93e7af4e966baae91a434361 Mon Sep 17 00:00:00 2001 From: Mihai Bazon Date: Mon, 23 Mar 2015 23:27:00 +0200 Subject: [PATCH] Fix compressing `![foo()];` as a statement need to check whether the literal has any side effects before replacing that with `false`. --- lib/compress.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.34.1