Fix semicolon printing when restricting max line length

Fixes #755
This commit is contained in:
Richard van Velzen
2015-07-29 17:57:18 +02:00
parent f8684f418a
commit 170e8b519e

View File

@@ -161,6 +161,8 @@ function OutputStream(options) {
str = String(str);
var ch = str.charAt(0);
if (might_need_semicolon) {
might_need_semicolon = false;
if ((!ch || ";}".indexOf(ch) < 0) && !/[;]$/.test(last)) {
if (options.semicolons || requireSemicolonChars(ch)) {
OUTPUT += ";";
@@ -171,11 +173,14 @@ function OutputStream(options) {
current_pos++;
current_line++;
current_col = 0;
// reset the semicolon flag, since we didn't print one now and
// might still have to later
might_need_semicolon = true;
}
if (!options.beautify)
might_need_space = false;
}
might_need_semicolon = false;
}
if (!options.beautify && options.preserve_line && stack[stack.length - 1]) {