@@ -6183,8 +6183,11 @@ 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) {
|
||||||
var parent = tw.parent();
|
var parent = tw.parent();
|
||||||
var in_iife = parent && parent.TYPE == "Call" && parent.expression === node;
|
in_iife = parent && parent.TYPE == "Call" && parent.expression === node;
|
||||||
|
}
|
||||||
if (!in_iife) {
|
if (!in_iife) {
|
||||||
push();
|
push();
|
||||||
segment.block = node;
|
segment.block = node;
|
||||||
|
|||||||
@@ -184,12 +184,12 @@ merge_vars_2: {
|
|||||||
expect: {
|
expect: {
|
||||||
var a = 0;
|
var a = 0;
|
||||||
1 && --a,
|
1 && --a,
|
||||||
a = function f() {
|
b = function f() {
|
||||||
const c = a && f;
|
const c = a && f;
|
||||||
c.var += 0;
|
c.var += 0;
|
||||||
}(),
|
}(),
|
||||||
void console.log(a);
|
void console.log(b);
|
||||||
var a;
|
var b;
|
||||||
}
|
}
|
||||||
expect_stdout: "undefined"
|
expect_stdout: "undefined"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -237,12 +237,12 @@ merge_vars_2: {
|
|||||||
"use strict";
|
"use strict";
|
||||||
var a = 0;
|
var a = 0;
|
||||||
1 && --a,
|
1 && --a,
|
||||||
a = function f() {
|
b = function f() {
|
||||||
let c = a && f;
|
let c = a && f;
|
||||||
c.var += 0;
|
c.var += 0;
|
||||||
}(),
|
}(),
|
||||||
void console.log(a);
|
void console.log(b);
|
||||||
var a;
|
var b;
|
||||||
}
|
}
|
||||||
expect_stdout: "undefined"
|
expect_stdout: "undefined"
|
||||||
node_version: ">=4"
|
node_version: ">=4"
|
||||||
|
|||||||
@@ -3732,3 +3732,25 @@ issue_5420: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5451: {
|
||||||
|
options = {
|
||||||
|
merge_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
A = 1;
|
||||||
|
var a = 1, b;
|
||||||
|
console.log(function f() {
|
||||||
|
return a-- && f(b = A, b);
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
A = 1;
|
||||||
|
var a = 1, b;
|
||||||
|
console.log(function f() {
|
||||||
|
return a-- && f(b = A, b);
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect_stdout: "0"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user