aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai@bazon.net>2012-10-03 12:49:47 +0300
committerMihai Bazon <mihai@bazon.net>2012-10-03 12:49:47 +0300
commite0f5075e45b8914d2543238565f771d4822117ca (patch)
treec50627312c6d8011a1625bb8aaf3b39d54649cfc
parentbd94eeb6f7ba5a6cbc8f9547766857d9873f862a (diff)
downloadtracifyjs-e0f5075e45b8914d2543238565f771d4822117ca.tar.gz
tracifyjs-e0f5075e45b8914d2543238565f771d4822117ca.zip
fix endless loop in tests
-rw-r--r--lib/compress.js6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/compress.js b/lib/compress.js
index 16812571..e318038a 100644
--- a/lib/compress.js
+++ b/lib/compress.js
@@ -325,9 +325,9 @@ merge(Compressor.prototype, {
function eliminate_dead_code(statements, compressor) {
var has_quit = false;
- return statements.reduce(function(a, stat){
+ var orig = statements.length;
+ statements = statements.reduce(function(a, stat){
if (has_quit) {
- CHANGED = true;
extract_declarations_from_unreachable_code(compressor, stat, a);
} else {
a.push(stat);
@@ -337,6 +337,8 @@ merge(Compressor.prototype, {
}
return a;
}, []);
+ CHANGED = statements.length != orig;
+ return statements;
};
function sequencesize(statements, compressor) {