define aborts on AST_If: true if both branches abort

This commit is contained in:
Mihai Bazon
2012-10-17 16:17:14 +03:00
parent a21f3c6cdd
commit 6a099fba66

View File

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