aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2015-04-13 17:29:48 +0300
committerMihai Bazon <mihai.bazon@gmail.com>2015-04-13 17:29:48 +0300
commit18c63ff3d806439bfb4df613156563ec050e12e9 (patch)
treef32e310e8bdba11ce51c762f5154767a89dc9b88 /lib/compress.js
parente04ef562435547e286019fdee46dd0b89b9822df (diff)
downloadtracifyjs-18c63ff3d806439bfb4df613156563ec050e12e9.tar.gz
tracifyjs-18c63ff3d806439bfb4df613156563ec050e12e9.zip
Fix compression of conditionals
Don't move the condition on the right side of an assignment when the left side may have side effects. Fix #677
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 41e4f17f..fa89c322 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -2343,6 +2343,7 @@ merge(Compressor.prototype, {
&& alternative instanceof AST_Assign
&& consequent.operator == alternative.operator
&& consequent.left.equivalent_to(alternative.left)
+ && !consequent.left.has_side_effects(compressor)
) {
/*
* Stuff like this: