@@ -2675,9 +2675,10 @@ merge(Compressor.prototype, {
|
|||||||
if (hit_index <= end) return handle_custom_scan_order(node, tt);
|
if (hit_index <= end) return handle_custom_scan_order(node, tt);
|
||||||
hit = true;
|
hit = true;
|
||||||
if (node instanceof AST_VarDef) {
|
if (node instanceof AST_VarDef) {
|
||||||
node.value = null;
|
|
||||||
declare_only[node.name.name] = (declare_only[node.name.name] || 0) + 1;
|
declare_only[node.name.name] = (declare_only[node.name.name] || 0) + 1;
|
||||||
if (value_def) value_def.replaced++;
|
if (value_def) value_def.replaced++;
|
||||||
|
node = node.clone();
|
||||||
|
node.value = null;
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
return in_list ? List.skip : null;
|
return in_list ? List.skip : null;
|
||||||
|
|||||||
@@ -8756,3 +8756,51 @@ issue_4586_2: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4732_1: {
|
||||||
|
options = {
|
||||||
|
booleans: true,
|
||||||
|
collapse_vars: true,
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = 0;
|
||||||
|
(function(b) {
|
||||||
|
var b = a++;
|
||||||
|
var c = b ? b && console.log("PASS") : 0;
|
||||||
|
})(a++);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = 0;
|
||||||
|
(function(b) {
|
||||||
|
(b = a++) && (b && console.log("PASS"));
|
||||||
|
})(a++);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_4732_2: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
conditionals: true,
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = 0;
|
||||||
|
(function(b) {
|
||||||
|
var b = a++;
|
||||||
|
var c = b ? b && console.log("PASS") : 0;
|
||||||
|
})(a++);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = 0;
|
||||||
|
(function(b) {
|
||||||
|
(b = a++) && b && console.log("PASS");
|
||||||
|
})(a++);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user