@@ -6161,15 +6161,8 @@ Compressor.prototype.compress = function(node) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (node instanceof AST_Scope) {
|
if (node instanceof AST_Scope) {
|
||||||
var in_iife = false;
|
|
||||||
if (node instanceof AST_LambdaExpression && !node.name && !is_async(node) && !is_generator(node)) {
|
|
||||||
var parent = tw.parent();
|
|
||||||
in_iife = parent && parent.TYPE == "Call" && parent.expression === node;
|
|
||||||
}
|
|
||||||
if (!in_iife) {
|
|
||||||
push();
|
push();
|
||||||
segment.block = node;
|
segment.block = node;
|
||||||
}
|
|
||||||
if (node === self) root = segment;
|
if (node === self) root = segment;
|
||||||
if (node instanceof AST_Lambda) {
|
if (node instanceof AST_Lambda) {
|
||||||
if (node.name) references[node.name.definition().id] = false;
|
if (node.name) references[node.name.definition().id] = false;
|
||||||
@@ -6186,7 +6179,7 @@ Compressor.prototype.compress = function(node) {
|
|||||||
in_arg.pop();
|
in_arg.pop();
|
||||||
}
|
}
|
||||||
walk_lambda(node, tw);
|
walk_lambda(node, tw);
|
||||||
if (!in_iife) pop();
|
pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (node instanceof AST_Sub) {
|
if (node instanceof AST_Sub) {
|
||||||
|
|||||||
@@ -726,8 +726,8 @@ issue_4401: {
|
|||||||
expect: {
|
expect: {
|
||||||
(function() {
|
(function() {
|
||||||
var a = (b => b(a))(console.log || a);
|
var a = (b => b(a))(console.log || a);
|
||||||
var a = console.log;
|
var c = console.log;
|
||||||
a && a(typeof b);
|
c && c(typeof b);
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
expect_stdout: [
|
expect_stdout: [
|
||||||
|
|||||||
@@ -2986,15 +2986,15 @@ issue_5456: {
|
|||||||
var a = true;
|
var a = true;
|
||||||
(function() {
|
(function() {
|
||||||
b = (i = a, console.log("foo") && i),
|
b = (i = a, console.log("foo") && i),
|
||||||
i = async function() {
|
d = async function() {
|
||||||
c = await null;
|
c = await null;
|
||||||
}(),
|
}(),
|
||||||
e = function() {
|
e = function() {
|
||||||
if (c) console.log(typeof i);
|
if (c) console.log(typeof d);
|
||||||
while (b);
|
while (b);
|
||||||
}(),
|
}(),
|
||||||
void 0;
|
void 0;
|
||||||
var b, c, i, e;
|
var b, c, d, e;
|
||||||
var i;
|
var i;
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3754,3 +3754,94 @@ issue_5451: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "0"
|
expect_stdout: "0"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5471_1: {
|
||||||
|
options = {
|
||||||
|
conditionals: true,
|
||||||
|
inline: true,
|
||||||
|
merge_vars: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
sequences: true,
|
||||||
|
side_effects: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = "FAIL 1";
|
||||||
|
function f(b, c) {
|
||||||
|
function g() {
|
||||||
|
if (console)
|
||||||
|
return 42;
|
||||||
|
else
|
||||||
|
c = "FAIL 2";
|
||||||
|
}
|
||||||
|
var d = g();
|
||||||
|
console.log(c || "PASS");
|
||||||
|
var e = function h() {
|
||||||
|
while (b && e);
|
||||||
|
}();
|
||||||
|
}
|
||||||
|
f(a++) && a;
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = "FAIL 1";
|
||||||
|
var b, c, e;
|
||||||
|
b = +a,
|
||||||
|
function() {
|
||||||
|
if (console)
|
||||||
|
return;
|
||||||
|
c = "FAIL 2";
|
||||||
|
}(),
|
||||||
|
console.log(c || "PASS"),
|
||||||
|
e = function() {
|
||||||
|
while (b && e);
|
||||||
|
}();
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5471_2: {
|
||||||
|
options = {
|
||||||
|
conditionals: true,
|
||||||
|
evaluate: true,
|
||||||
|
inline: true,
|
||||||
|
merge_vars: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
sequences: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = "FAIL 1";
|
||||||
|
function f(b, c) {
|
||||||
|
function g() {
|
||||||
|
if (console)
|
||||||
|
return 42;
|
||||||
|
else
|
||||||
|
c = "FAIL 2";
|
||||||
|
}
|
||||||
|
var d = g();
|
||||||
|
console.log(c || "PASS");
|
||||||
|
var e = function h() {
|
||||||
|
while (b && e);
|
||||||
|
}();
|
||||||
|
}
|
||||||
|
f(a++) && a;
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = "FAIL 1";
|
||||||
|
var b, c, e;
|
||||||
|
b = +a,
|
||||||
|
function() {
|
||||||
|
if (console)
|
||||||
|
return;
|
||||||
|
c = "FAIL 2";
|
||||||
|
}(),
|
||||||
|
console.log(c || "PASS"),
|
||||||
|
e = function() {
|
||||||
|
while (b && e);
|
||||||
|
}(),
|
||||||
|
void 0;
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
@@ -1574,15 +1574,15 @@ issue_5456: {
|
|||||||
var a = true;
|
var a = true;
|
||||||
(function() {
|
(function() {
|
||||||
b = (i = a, console.log("foo") && i),
|
b = (i = a, console.log("foo") && i),
|
||||||
i = function*() {
|
d = function*() {
|
||||||
c = null;
|
c = null;
|
||||||
}(),
|
}(),
|
||||||
e = function() {
|
e = function() {
|
||||||
if (c) console.log(typeof i);
|
if (c) console.log(typeof d);
|
||||||
while (b);
|
while (b);
|
||||||
}(),
|
}(),
|
||||||
void 0;
|
void 0;
|
||||||
var b, c, i, e;
|
var b, c, d, e;
|
||||||
var i;
|
var i;
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user