enhance if_return (#3232)
This commit is contained in:
@@ -1699,6 +1699,19 @@ merge(Compressor.prototype, {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ab && !stat.alternative && stat.body instanceof AST_BlockStatement && next instanceof AST_Jump) {
|
||||
var negated = stat.condition.negate(compressor);
|
||||
if (negated.print_to_string().length <= stat.condition.print_to_string().length) {
|
||||
CHANGED = true;
|
||||
stat = stat.clone();
|
||||
stat.condition = negated;
|
||||
statements[j] = stat.body;
|
||||
stat.body = next;
|
||||
statements[i] = stat.transform(compressor);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
var ab = aborts(stat.alternative);
|
||||
if (can_merge_flow(ab)) {
|
||||
if (ab.label) {
|
||||
|
||||
Reference in New Issue
Block a user