aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 95dd64d6..4c52f4dd 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1811,9 +1811,15 @@ merge(Compressor.prototype, {
}
if (compressor.option("cascade")) {
if (self.car instanceof AST_Assign
- && !self.car.left.has_side_effects(compressor)
- && self.car.left.equivalent_to(self.cdr)) {
- return self.car;
+ && !self.car.left.has_side_effects(compressor)) {
+ if (self.car.left.equivalent_to(self.cdr)) {
+ return self.car;
+ }
+ if (self.cdr instanceof AST_Call
+ && self.cdr.expression.equivalent_to(self.car.left)) {
+ self.cdr.expression = self.car;
+ return self.cdr;
+ }
}
if (!self.car.has_side_effects(compressor)
&& !self.cdr.has_side_effects(compressor)