@@ -3889,3 +3889,56 @@ issue_5714: {
|
||||
"42",
|
||||
]
|
||||
}
|
||||
|
||||
issue_5770_1: {
|
||||
options = {
|
||||
dead_code: true,
|
||||
loops: true,
|
||||
merge_vars: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
L: do {
|
||||
if (console)
|
||||
for (var a = "FAIL 1"; a; a--)
|
||||
continue L;
|
||||
var b = "FAIL 2";
|
||||
} while (console.log(b || "PASS"));
|
||||
}
|
||||
expect: {
|
||||
L: do {
|
||||
if (console) {
|
||||
var a = "FAIL 1";
|
||||
if (a)
|
||||
continue L;
|
||||
}
|
||||
var b = "FAIL 2";
|
||||
} while (console.log(b || "PASS"));
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
issue_5770_2: {
|
||||
options = {
|
||||
conditionals: true,
|
||||
dead_code: true,
|
||||
if_return: true,
|
||||
loops: true,
|
||||
merge_vars: true,
|
||||
toplevel: true,
|
||||
}
|
||||
input: {
|
||||
L: do {
|
||||
for (var a = "FAIL 1"; a; a--)
|
||||
continue L;
|
||||
var b = "FAIL 2";
|
||||
} while (console.log(b || "PASS"));
|
||||
}
|
||||
expect: {
|
||||
L: do {
|
||||
var a = "FAIL 1";
|
||||
var b;
|
||||
} while (a || (b = "FAIL 2"), console.log(b || "PASS"));
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
@@ -363,9 +363,17 @@ module.exports = function reduce_test(testcase, minify_options, reduce_options)
|
||||
node.condition,
|
||||
node.body,
|
||||
node.alternative,
|
||||
][ (node.start._permute * steps | 0) % 3 ];
|
||||
node,
|
||||
][ (node.start._permute * steps | 0) % 4 ];
|
||||
node.start._permute += step;
|
||||
if (expr) {
|
||||
if (expr === node) {
|
||||
if (node.alternative) {
|
||||
expr = node.clone();
|
||||
expr.alternative = null;
|
||||
CHANGED = true;
|
||||
return expr;
|
||||
}
|
||||
} else if (expr) {
|
||||
// replace if statement with its condition, then block or else block
|
||||
CHANGED = true;
|
||||
return to_statement(expr);
|
||||
|
||||
Reference in New Issue
Block a user