From f96f796f71a1eb4657f42c23513c59eaf11bf401 Mon Sep 17 00:00:00 2001 From: Richard van Velzen Date: Mon, 12 Nov 2012 15:41:03 +0100 Subject: [PATCH] Add simple optimization for empty-string concats. ref. #43 --- lib/compress.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/compress.js b/lib/compress.js index a4a53f5a..fce0757c 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -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; }); -- 2.34.1