improve string concatenation
shuffle associative operations to minimise parentheses and aid other uglification efforts closes #1454
This commit is contained in:
@@ -2751,9 +2751,16 @@ merge(Compressor.prototype, {
|
||||
}
|
||||
// x && (y && z) ==> x && y && z
|
||||
// x || (y || z) ==> x || y || z
|
||||
// x + ("y" + z) ==> x + "y" + z
|
||||
// "x" + (y + "z")==> "x" + y + "z"
|
||||
if (self.right instanceof AST_Binary
|
||||
&& self.right.operator == self.operator
|
||||
&& (self.operator == "&&" || self.operator == "||"))
|
||||
&& (self.operator == "&&"
|
||||
|| self.operator == "||"
|
||||
|| (self.operator == "+"
|
||||
&& (self.right.left.is_string(compressor)
|
||||
|| (self.left.is_string(compressor)
|
||||
&& self.right.right.is_string(compressor))))))
|
||||
{
|
||||
self.left = make_node(AST_Binary, self.left, {
|
||||
operator : self.operator,
|
||||
|
||||
Reference in New Issue
Block a user