@@ -3620,7 +3620,7 @@ Compressor.prototype.compress = function(node) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (jump && jump === next) eliminate_returns(stat);
|
if (declare_only && jump && jump === next) eliminate_returns(stat);
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
|
|
||||||
@@ -3787,6 +3787,7 @@ Compressor.prototype.compress = function(node) {
|
|||||||
if (stat instanceof AST_Exit) {
|
if (stat instanceof AST_Exit) {
|
||||||
var mode = match_return(stat, true);
|
var mode = match_return(stat, true);
|
||||||
if (mode) {
|
if (mode) {
|
||||||
|
changed = true;
|
||||||
var value = trim_return(stat.value, mode);
|
var value = trim_return(stat.value, mode);
|
||||||
if (value) return make_node(AST_SimpleStatement, value, { body: value });
|
if (value) return make_node(AST_SimpleStatement, value, { body: value });
|
||||||
return in_block ? null : make_node(AST_EmptyStatement, stat);
|
return in_block ? null : make_node(AST_EmptyStatement, stat);
|
||||||
|
|||||||
@@ -2305,3 +2305,56 @@ issue_5597: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5619_1: {
|
||||||
|
options = {
|
||||||
|
if_return: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
console.log(function() {
|
||||||
|
if (console)
|
||||||
|
if (console)
|
||||||
|
return "PASS";
|
||||||
|
var a = FAIL;
|
||||||
|
return "PASS";
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log(function() {
|
||||||
|
if (console)
|
||||||
|
if (console)
|
||||||
|
return "PASS";
|
||||||
|
var a = FAIL;
|
||||||
|
return "PASS";
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5619_2: {
|
||||||
|
options = {
|
||||||
|
dead_code: true,
|
||||||
|
if_return: true,
|
||||||
|
loops: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
console.log(function() {
|
||||||
|
if (console)
|
||||||
|
while (console)
|
||||||
|
return "PASS";
|
||||||
|
var a = FAIL;
|
||||||
|
return "PASS";
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log(function() {
|
||||||
|
if (console) {
|
||||||
|
if (console)
|
||||||
|
return "PASS";
|
||||||
|
}
|
||||||
|
var a = FAIL;
|
||||||
|
return "PASS";
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user