-c sequences=N suboptimal at N expression cutoff
N = 2: a; b; c; d; was: a, b; c; d; now: a, b; c, d; fixes #1455 closes #1457
This commit is contained in:
@@ -749,7 +749,10 @@ merge(Compressor.prototype, {
|
|||||||
seq = [];
|
seq = [];
|
||||||
};
|
};
|
||||||
statements.forEach(function(stat){
|
statements.forEach(function(stat){
|
||||||
if (stat instanceof AST_SimpleStatement && seqLength(seq) < compressor.sequences_limit) {
|
if (stat instanceof AST_SimpleStatement) {
|
||||||
|
if (seqLength(seq) >= compressor.sequences_limit) {
|
||||||
|
push_seq();
|
||||||
|
}
|
||||||
seq.push(stat.body);
|
seq.push(stat.body);
|
||||||
} else {
|
} else {
|
||||||
push_seq();
|
push_seq();
|
||||||
|
|||||||
@@ -169,3 +169,47 @@ for_sequences: {
|
|||||||
for (y = 5; false;);
|
for (y = 5; false;);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
limit_1: {
|
||||||
|
options = {
|
||||||
|
sequences: 3,
|
||||||
|
};
|
||||||
|
input: {
|
||||||
|
a;
|
||||||
|
b;
|
||||||
|
c;
|
||||||
|
d;
|
||||||
|
e;
|
||||||
|
f;
|
||||||
|
g;
|
||||||
|
h;
|
||||||
|
i;
|
||||||
|
j;
|
||||||
|
k;
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
a, b, c;
|
||||||
|
d, e, f;
|
||||||
|
g, h, i;
|
||||||
|
j, k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
limit_2: {
|
||||||
|
options = {
|
||||||
|
sequences: 3,
|
||||||
|
};
|
||||||
|
input: {
|
||||||
|
a, b;
|
||||||
|
c, d;
|
||||||
|
e, f;
|
||||||
|
g, h;
|
||||||
|
i, j;
|
||||||
|
k;
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
a, b, c, d;
|
||||||
|
e, f, g, h;
|
||||||
|
i, j, k;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user