empty block to empty statement: {} ==> ;
authorMihai Bazon <mihai@bazon.net>
Mon, 17 Sep 2012 09:03:02 +0000 (12:03 +0300)
committerMihai Bazon <mihai@bazon.net>
Mon, 17 Sep 2012 09:03:02 +0000 (12:03 +0300)
lib/compress.js

index ddb4437..7b865fd 100644 (file)
@@ -759,8 +759,10 @@ function Compressor(options, false_by_default) {
     });
 
     AST_BlockStatement.DEFMETHOD("optimize", function(compressor){
-        if (this.body.length == 1)
-            return this.body[0];
+        switch (this.body.length) {
+          case 1: return this.body[0];
+          case 0: return make_node(AST_EmptyStatement, this);
+        }
         return this;
     });