@@ -1068,7 +1068,9 @@ merge(Compressor.prototype, {
|
||||
}
|
||||
|
||||
function can_merge_flow(ab) {
|
||||
if (!ab) return false;
|
||||
if (!ab || !all(ret, function(stat) {
|
||||
return !(stat instanceof AST_Const || stat instanceof AST_Let);
|
||||
})) return false;
|
||||
var lct = ab instanceof AST_LoopControl ? compressor.loopcontrol_target(ab) : null;
|
||||
return ab instanceof AST_Return && in_lambda && is_return_void(ab.value)
|
||||
|| ab instanceof AST_Continue && self === loop_body(lct)
|
||||
|
||||
@@ -326,3 +326,61 @@ issue_512: {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
issue_1317: {
|
||||
options = {
|
||||
if_return: true,
|
||||
}
|
||||
input: {
|
||||
!function(a) {
|
||||
if (a) return;
|
||||
let b = 1;
|
||||
function g() {
|
||||
return b;
|
||||
}
|
||||
console.log(g());
|
||||
}();
|
||||
}
|
||||
expect: {
|
||||
!function(a) {
|
||||
if (a) return;
|
||||
let b = 1;
|
||||
function g() {
|
||||
return b;
|
||||
}
|
||||
console.log(g());
|
||||
}();
|
||||
}
|
||||
expect_stdout: "1"
|
||||
node_version: ">=6"
|
||||
}
|
||||
|
||||
issue_1317_strict: {
|
||||
options = {
|
||||
if_return: true,
|
||||
}
|
||||
input: {
|
||||
"use strict";
|
||||
!function(a) {
|
||||
if (a) return;
|
||||
let b = 1;
|
||||
function g() {
|
||||
return b;
|
||||
}
|
||||
console.log(g());
|
||||
}();
|
||||
}
|
||||
expect: {
|
||||
"use strict";
|
||||
!function(a) {
|
||||
if (a) return;
|
||||
let b = 1;
|
||||
function g() {
|
||||
return b;
|
||||
}
|
||||
console.log(g());
|
||||
}();
|
||||
}
|
||||
expect_stdout: "1"
|
||||
node_version: ">=4"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user