Fix output when semicolons is off.
authorMihai Bazon <mihai@bazon.net>
Fri, 21 Dec 2012 09:57:08 +0000 (11:57 +0200)
committerMihai Bazon <mihai@bazon.net>
Fri, 21 Dec 2012 09:57:08 +0000 (11:57 +0200)
(need to force a semicolon for the empty body of an `if`)

Close #72

lib/output.js

index ee5e9d9..464a459 100644 (file)
@@ -728,7 +728,7 @@ function OutputStream(options) {
         // to the inner IF).  This function checks for this case and
         // adds the block brackets if needed.
         if (!self.body)
-            return output.semicolon();
+            return output.force_semicolon();
         if (self.body instanceof AST_Do
             && output.option("ie_proof")) {
             // https://github.com/mishoo/UglifyJS/issues/#issue/57 IE
@@ -752,7 +752,7 @@ function OutputStream(options) {
             }
             else break;
         }
-        self.body.print(output);
+        force_statement(self.body, output);
     };
     DEFPRINT(AST_If, function(self, output){
         output.print("if");