aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRichard van Velzen <rvanvelzen@expert-shops.com>2012-11-12 15:41:03 +0100
committerRichard van Velzen <rvanvelzen@expert-shops.com>2012-11-12 15:41:03 +0100
commitf96f796f71a1eb4657f42c23513c59eaf11bf401 (patch)
tree45d350de271cdc51d26f900560fa438b3f7f3ac1 /lib
parenta9fa178f86b36959ea9b86b591e22f4406aa7ce3 (diff)
downloadtracifyjs-f96f796f71a1eb4657f42c23513c59eaf11bf401.tar.gz
tracifyjs-f96f796f71a1eb4657f42c23513c59eaf11bf401.zip
Add simple optimization for empty-string concats.
ref. #43
Diffstat (limited to 'lib')
-rw-r--r--lib/compress.js5
1 files changed, 5 insertions, 0 deletions
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;
});