don't output both space and semicolon when beautify=false

This commit is contained in:
Mihai Bazon
2012-08-17 18:33:26 +03:00
parent 07cbc8d3af
commit 901f77047e

View File

@@ -82,6 +82,16 @@ function OutputStream(options) {
last = str;
str = String(str);
var ch = str.charAt(0);
if (might_need_semicolon) {
if (";}".indexOf(ch) < 0 && !/[;]$/.test(OUTPUT)) {
OUTPUT += ";";
current_col++;
current_pos++;
if (!options.beautify)
might_need_space = false;
}
might_need_semicolon = false;
}
if (might_need_space) {
if ((is_identifier_char(last_char())
&& (is_identifier_char(ch) || ch == "\\"))
@@ -94,14 +104,6 @@ function OutputStream(options) {
}
might_need_space = false;
}
if (might_need_semicolon) {
if (";}".indexOf(ch) < 0 && !/[;]$/.test(OUTPUT)) {
OUTPUT += ";";
current_col++;
current_pos++;
}
might_need_semicolon = false;
}
var a = str.split(/\r?\n/), n = a.length;
current_line += n;
if (n == 1) {