Fix RHS concat (raised in #330)
authorRichard van Velzen <rvanvelzen1@gmail.com>
Sat, 26 Oct 2013 16:44:52 +0000 (18:44 +0200)
committerRichard van Velzen <rvanvelzen1@gmail.com>
Sat, 26 Oct 2013 16:44:52 +0000 (18:44 +0200)
When attempting to concat the left-side of the rhs, make sure the rhs is
a string.

lib/compress.js

index 121e312..13ae7c7 100644 (file)
@@ -2067,7 +2067,8 @@ merge(Compressor.prototype, {
                     && self.left.right instanceof AST_Constant
                     && self.right instanceof AST_Binary
                     && self.right.operator == "+"
-                    && self.right.left instanceof AST_Constant) {
+                    && self.right.left instanceof AST_Constant
+                    && self.right.is_string(compressor)) {
                     self = make_node(AST_Binary, self, {
                         operator: "+",
                         left: make_node(AST_Binary, self.left, {