@@ -6183,8 +6183,11 @@ Compressor.prototype.compress = function(node) {
|
||||
return true;
|
||||
}
|
||||
if (node instanceof AST_Scope) {
|
||||
var parent = tw.parent();
|
||||
var in_iife = parent && parent.TYPE == "Call" && parent.expression === node;
|
||||
var in_iife = false;
|
||||
if (node instanceof AST_LambdaExpression && !node.name) {
|
||||
var parent = tw.parent();
|
||||
in_iife = parent && parent.TYPE == "Call" && parent.expression === node;
|
||||
}
|
||||
if (!in_iife) {
|
||||
push();
|
||||
segment.block = node;
|
||||
|
||||
@@ -184,12 +184,12 @@ merge_vars_2: {
|
||||
expect: {
|
||||
var a = 0;
|
||||
1 && --a,
|
||||
a = function f() {
|
||||
b = function f() {
|
||||
const c = a && f;
|
||||
c.var += 0;
|
||||
}(),
|
||||
void console.log(a);
|
||||
var a;
|
||||
void console.log(b);
|
||||
var b;
|
||||
}
|
||||
expect_stdout: "undefined"
|
||||
}
|
||||
|
||||
@@ -237,12 +237,12 @@ merge_vars_2: {
|
||||
"use strict";
|
||||
var a = 0;
|
||||
1 && --a,
|
||||
a = function f() {
|
||||
b = function f() {
|
||||
let c = a && f;
|
||||
c.var += 0;
|
||||
}(),
|
||||
void console.log(a);
|
||||
var a;
|
||||
void console.log(b);
|
||||
var b;
|
||||
}
|
||||
expect_stdout: "undefined"
|
||||
node_version: ">=4"
|
||||
|
||||
@@ -3732,3 +3732,25 @@ issue_5420: {
|
||||
}
|
||||
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