aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-10-17 16:17:14 +0300
committerMihai Bazon <mihai@bazon.net>2012-10-17 16:17:14 +0300
commit6a099fba66eba896755f5a723a9d08034faee615 (patch)
tree5c281e2da39284dfb6d823b964636803f16f39ba
parenta21f3c6cdd27696770b5cc605b5f02d81f0a32af (diff)
downloadtracifyjs-6a099fba66eba896755f5a723a9d08034faee615.tar.gz
tracifyjs-6a099fba66eba896755f5a723a9d08034faee615.zip
define aborts on AST_If: true if both branches abort
-rw-r--r--lib/compress.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 4a51a49f..d2e3ffc7 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -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);
});