@@ -10436,7 +10436,7 @@ merge(Compressor.prototype, {
|
|||||||
} else {
|
} else {
|
||||||
value = fixed.optimize(compressor);
|
value = fixed.optimize(compressor);
|
||||||
}
|
}
|
||||||
if (value === fixed) value = value.transform(new TreeTransformer(function(node, descend) {
|
value = value.transform(new TreeTransformer(function(node, descend) {
|
||||||
if (node instanceof AST_Scope) return node;
|
if (node instanceof AST_Scope) return node;
|
||||||
node = node.clone();
|
node = node.clone();
|
||||||
descend(node, this);
|
descend(node, this);
|
||||||
|
|||||||
@@ -60,3 +60,33 @@ issue_4590: {
|
|||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
node_version: ">=10"
|
node_version: ">=10"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4801: {
|
||||||
|
options = {
|
||||||
|
booleans: true,
|
||||||
|
collapse_vars: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
try {
|
||||||
|
(function(a) {
|
||||||
|
A = 42;
|
||||||
|
a || A;
|
||||||
|
})(!(0 == 42 >> 0o644n));
|
||||||
|
} catch (e) {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
try {
|
||||||
|
(function(a) {
|
||||||
|
0 != (A = 42) >> 0o644n || A;
|
||||||
|
})();
|
||||||
|
} catch (e) {
|
||||||
|
console.log("PASS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=10"
|
||||||
|
}
|
||||||
|
|||||||
@@ -419,36 +419,36 @@ reduce_vars_3: {
|
|||||||
}
|
}
|
||||||
input: {
|
input: {
|
||||||
"use strict";
|
"use strict";
|
||||||
(function(scope) {
|
(function(a) {
|
||||||
let i = 1;
|
let i = 1;
|
||||||
function f() {
|
function f() {
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
for (let i = 0, x = 0; i < scope.length; i++, x++) {
|
for (let i = 0, x = 0; i < a.length; i++, x++) {
|
||||||
if (x != i) {
|
if (x != i) {
|
||||||
console.log("FAIL");
|
console.log("FAIL");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
f();
|
f();
|
||||||
console.log(scope[i]);
|
console.log(a[i]);
|
||||||
}
|
}
|
||||||
console.log(i);
|
console.log(i);
|
||||||
})([ 4, 2 ]);
|
})([ 4, 2 ]);
|
||||||
}
|
}
|
||||||
expect: {
|
expect: {
|
||||||
"use strict";
|
"use strict";
|
||||||
(function(scope) {
|
(function(a) {
|
||||||
let i = 1;
|
let i = 1;
|
||||||
function f() {
|
function f() {
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
for (let i = 0, x = 0; i < scope.length; i++, x++) {
|
for (let i = 0, x = 0; i < a.length; i++, x++) {
|
||||||
if (x != i) {
|
if (x != i) {
|
||||||
console.log("FAIL");
|
console.log("FAIL");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
f();
|
f();
|
||||||
console.log(scope[i]);
|
console.log(a[i]);
|
||||||
}
|
}
|
||||||
console.log(i);
|
console.log(i);
|
||||||
})([ 4, 2 ]);
|
})([ 4, 2 ]);
|
||||||
|
|||||||
Reference in New Issue
Block a user