[sequencesize] Actually even better:

do create the sequence even if the stat list is bigger than 2000 statements,
but limit the sequence itself to 2000 expressions.

Ref #414
This commit is contained in:
Mihai Bazon
2015-03-22 13:01:42 +02:00
parent f0ab1b02e6
commit 5801fa39e9

View File

@@ -479,7 +479,7 @@ merge(Compressor.prototype, {
}; };
function sequencesize(statements, compressor) { function sequencesize(statements, compressor) {
if (statements.length < 2 || statements.length > 2000) return statements; if (statements.length < 2) return statements;
var seq = [], ret = []; var seq = [], ret = [];
function push_seq() { function push_seq() {
seq = AST_Seq.from_array(seq); seq = AST_Seq.from_array(seq);
@@ -489,7 +489,7 @@ merge(Compressor.prototype, {
seq = []; seq = [];
}; };
statements.forEach(function(stat){ statements.forEach(function(stat){
if (stat instanceof AST_SimpleStatement) seq.push(stat.body); if (stat instanceof AST_SimpleStatement && seq.length < 2000) seq.push(stat.body);
else push_seq(), ret.push(stat); else push_seq(), ret.push(stat);
}); });
push_seq(); push_seq();