diff options
author | Mihai Bazon <mihai.bazon@gmail.com> | 2015-11-16 12:07:15 +0200 |
---|---|---|
committer | Mihai Bazon <mihai.bazon@gmail.com> | 2015-11-16 12:08:24 +0200 |
commit | 7f48d5b33cc2a130afead79cd09482cc833d17bb (patch) | |
tree | 113fc4f725f04a9917fbf4b65e19eb88a5663b4a | |
parent | b6968b6bd2a740281e03e804ae68b3f5e63ce5ed (diff) | |
download | tracifyjs-7f48d5b33cc2a130afead79cd09482cc833d17bb.tar.gz tracifyjs-7f48d5b33cc2a130afead79cd09482cc833d17bb.zip |
Fix endless loop
Close #866
-rw-r--r-- | lib/compress.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/compress.js b/lib/compress.js index c384e997..32833ebf 100644 --- a/lib/compress.js +++ b/lib/compress.js @@ -384,7 +384,12 @@ merge(Compressor.prototype, { continue loop; } //--- - if (ret.length == 1 && in_lambda && ret[0] instanceof AST_SimpleStatement + // XXX: what was the intention of this case? + // if sequences is not enabled, this can lead to an endless loop (issue #866). + // however, with sequences on this helps producing slightly better output for + // the example code. + if (compressor.option("sequences") + && ret.length == 1 && in_lambda && ret[0] instanceof AST_SimpleStatement && (!stat.alternative || stat.alternative instanceof AST_SimpleStatement)) { CHANGED = true; ret.push(make_node(AST_Return, ret[0], { |