diff options
author | Richard van Velzen <rvanvelzen@experty.com> | 2015-07-29 17:57:18 +0200 |
---|---|---|
committer | Richard van Velzen <rvanvelzen@experty.com> | 2015-07-29 17:57:18 +0200 |
commit | 170e8b519e64463a39d293480e52f97b64d8ab89 (patch) | |
tree | 36d2eb332159411e712efabf35d8a0f1e152db88 /lib/output.js | |
parent | f8684f418a1801927fcdf9a205817fe07ff89720 (diff) | |
download | tracifyjs-170e8b519e64463a39d293480e52f97b64d8ab89.tar.gz tracifyjs-170e8b519e64463a39d293480e52f97b64d8ab89.zip |
Fix semicolon printing when restricting max line length
Fixes #755
Diffstat (limited to 'lib/output.js')
-rw-r--r-- | lib/output.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/output.js b/lib/output.js index 1d67b1b9..44d5df6e 100644 --- a/lib/output.js +++ b/lib/output.js @@ -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]) { |