fix output for division followed by regexp
authorMihai Bazon <mihai@bazon.net>
Sat, 8 Sep 2012 12:38:58 +0000 (15:38 +0300)
committerMihai Bazon <mihai@bazon.net>
Sat, 8 Sep 2012 12:38:58 +0000 (15:38 +0300)
( v1 report: https://github.com/mishoo/UglifyJS/pull/458 )

lib/output.js

index 5df1c2c..c803fba 100644 (file)
@@ -141,10 +141,10 @@ function OutputStream(options) {
             maybe_newline();
         }
         if (might_need_space) {
-            if ((is_identifier_char(last_char())
+            var prev = last_char();
+            if ((is_identifier_char(prev)
                  && (is_identifier_char(ch) || ch == "\\"))
-                ||
-                (/[\+\-]$/.test(last) && /^[\+\-]/.test(str)))
+                || (/^[\+\-\/]$/.test(ch) && ch == prev))
             {
                 OUTPUT += " ";
                 current_col++;