aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 43ee1126..26d17295 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -6673,7 +6673,7 @@ merge(Compressor.prototype, {
&& alt_tail instanceof AST_Assign
&& seq_tail.operator == alt_tail.operator
&& seq_tail.left.equivalent_to(alt_tail.left)
- && (is_eq && !seq_tail.left.has_side_effects(compressor)
+ && (is_eq && seq_tail.left instanceof AST_SymbolRef
|| !condition.has_side_effects(compressor)
&& can_shift_lhs_of_tail(consequent)
&& can_shift_lhs_of_tail(alternative))) {
@@ -6842,16 +6842,9 @@ merge(Compressor.prototype, {
}
function can_shift_lhs_of_tail(node) {
- if (node === node.tail_node()) return true;
- var exprs = node.expressions;
- for (var i = exprs.length - 1; --i >= 0;) {
- var expr = exprs[i];
- if (!(expr instanceof AST_Assign) && expr.has_side_effects(compressor)
- || expr.operator != "="
- || expr.left.has_side_effects(compressor)
- || expr.right.has_side_effects(compressor)) return false;
- }
- return true;
+ return node === node.tail_node() || all(node.expressions.slice(0, -1), function(expr) {
+ return !expr.has_side_effects(compressor);
+ });
}
function pop_lhs(node) {