define aborts on AST_If: true if both branches abort
authorMihai Bazon <mihai@bazon.net>
Wed, 17 Oct 2012 13:17:14 +0000 (16:17 +0300)
committerMihai Bazon <mihai@bazon.net>
Wed, 17 Oct 2012 13:17:14 +0000 (16:17 +0300)
lib/compress.js

index 4a51a49..d2e3ffc 100644 (file)
@@ -349,9 +349,7 @@ merge(Compressor.prototype, {
                     extract_declarations_from_unreachable_code(compressor, stat, a);
                 } else {
                     a.push(stat);
-                    if (stat instanceof AST_Jump) {
-                        has_quit = true;
-                    }
+                    if (aborts(stat)) has_quit = true;
                 }
                 return a;
             }, []);
@@ -771,6 +769,9 @@ merge(Compressor.prototype, {
             var n = this.body.length;
             return n > 0 && aborts(this.body[n - 1]);
         });
+        def(AST_If, function(){
+            return this.alternative && aborts(this.body) && aborts(this.alternative);
+        });
     })(function(node, func){
         node.DEFMETHOD("aborts", func);
     });