aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-08-17 18:33:26 +0300
committerMihai Bazon <mihai@bazon.net>2012-08-17 18:33:26 +0300
commit901f77047e581c79132f93451f057629788d0e9f (patch)
tree305e8e0d9f2eeb180a1180240e6bb0763e217fc9 /lib
parent07cbc8d3afee368ed143f62302d1b1a51e0f09bc (diff)
downloadtracifyjs-901f77047e581c79132f93451f057629788d0e9f.tar.gz
tracifyjs-901f77047e581c79132f93451f057629788d0e9f.zip
don't output both space and semicolon when beautify=false
Diffstat (limited to 'lib')
-rw-r--r--lib/output.js18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/output.js b/lib/output.js
index b7bf79d2..93aa7f6b 100644
--- a/lib/output.js
+++ b/lib/output.js
@@ -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) {