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
This commit is contained in:
Mihai Bazon
2015-04-13 17:29:48 +03:00
parent e04ef56243
commit 18c63ff3d8
2 changed files with 13 additions and 2 deletions

View File

@@ -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: