From a5b60217cede3f214153e62087d32274aa0859e5 Mon Sep 17 00:00:00 2001 From: Mihai Bazon Date: Mon, 18 May 2015 13:56:04 +0300 Subject: Fix compressing conditionals Only transform foo() ? EXP(x) : EXP(y) into EXP(foo() ? x : y) if EXP has no side effects. Fix #710 --- lib/compress.js | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/compress.js') diff --git a/lib/compress.js b/lib/compress.js index 944db1d2..530e7c2f 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -2356,6 +2356,7 @@ merge(Compressor.prototype, { if (consequent instanceof AST_Call && alternative.TYPE === consequent.TYPE && consequent.args.length == alternative.args.length + && !consequent.expression.has_side_effects(compressor) && consequent.expression.equivalent_to(alternative.expression)) { if (consequent.args.length == 0) { return make_node(AST_Seq, self, { -- cgit v1.2.3