Add simple optimization for empty-string concats.

ref. #43
This commit is contained in:
Richard van Velzen
2012-11-12 15:41:03 +01:00
parent a9fa178f86
commit f96f796f71

View File

@@ -1642,6 +1642,11 @@ merge(Compressor.prototype, {
case "<=": reverse(">="); break;
}
}
if (self.operator == "+" && self.right instanceof AST_String
&& self.right.getValue() === "" && self.left instanceof AST_Binary
&& self.left.operator == "+" && self.left.left instanceof AST_String) {
return self.left;
}
return self;
});