aboutsummaryrefslogtreecommitdiff
path: root/lib/compress.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/compress.js')
-rw-r--r--lib/compress.js25
1 files changed, 23 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index dafed5db..37aba41e 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -1965,7 +1965,7 @@ merge(Compressor.prototype, {
self = make_node(AST_Binary, self, {
operator: "+",
left: make_node(AST_String, null, {
- value: self.left.getValue() + self.right.left.getValue(),
+ value: "" + self.left.getValue() + self.right.left.getValue(),
start: self.left.start,
end: self.right.left.end
}),
@@ -1981,12 +1981,33 @@ merge(Compressor.prototype, {
operator: "+",
left: self.left.left,
right: make_node(AST_String, null, {
- value: self.left.right.getValue() + self.right.getValue(),
+ value: "" + self.left.right.getValue() + self.right.getValue(),
start: self.left.right.start,
end: self.right.end
})
});
}
+ if (self.left instanceof AST_Binary
+ && self.left.operator == "+"
+ && self.left.is_string(compressor)
+ && self.left.right instanceof AST_Constant
+ && self.right instanceof AST_Binary
+ && self.right.operator == "+"
+ && self.right.left instanceof AST_Constant) {
+ self = make_node(AST_Binary, self, {
+ operator: "+",
+ left: make_node(AST_Binary, self.left, {
+ operator: "+",
+ left: self.left.left,
+ right: make_node(AST_String, null, {
+ value: "" + self.left.right.getValue() + self.right.left.getValue(),
+ start: self.left.right.start,
+ end: self.right.left.end
+ })
+ }),
+ right: self.right.right
+ });
+ }
}
}
return self.evaluate(compressor)[0];