@@ -1818,10 +1818,7 @@ merge(Compressor.prototype, {
|
|||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
if (is_lhs(node, parent)) {
|
if (is_lhs(node, parent)) {
|
||||||
if (value_def && !hit_rhs) {
|
if (value_def && !hit_rhs) assign_used = true;
|
||||||
assign_used = true;
|
|
||||||
if (node.definition().last_ref === node) replaced++;
|
|
||||||
}
|
|
||||||
return node;
|
return node;
|
||||||
} else if (value_def) {
|
} else if (value_def) {
|
||||||
if (stop_if_hit && assign_pos == 0) assign_pos = remaining - replaced;
|
if (stop_if_hit && assign_pos == 0) assign_pos = remaining - replaced;
|
||||||
@@ -2024,7 +2021,7 @@ merge(Compressor.prototype, {
|
|||||||
statements[i].transform(scanner);
|
statements[i].transform(scanner);
|
||||||
}
|
}
|
||||||
if (value_def) {
|
if (value_def) {
|
||||||
if (!replaced || remaining > replaced) {
|
if (!replaced || remaining > replaced + assign_used) {
|
||||||
candidates.push(hit_stack);
|
candidates.push(hit_stack);
|
||||||
force_single = true;
|
force_single = true;
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -4658,7 +4658,6 @@ replace_all_var_scope: {
|
|||||||
rename = true
|
rename = true
|
||||||
options = {
|
options = {
|
||||||
collapse_vars: true,
|
collapse_vars: true,
|
||||||
reduce_vars: true,
|
|
||||||
unused: true,
|
unused: true,
|
||||||
}
|
}
|
||||||
mangle = {}
|
mangle = {}
|
||||||
@@ -4677,7 +4676,7 @@ replace_all_var_scope: {
|
|||||||
(function(c, o) {
|
(function(c, o) {
|
||||||
switch (~a) {
|
switch (~a) {
|
||||||
case (b += a):
|
case (b += a):
|
||||||
case +o:
|
case o++:
|
||||||
}
|
}
|
||||||
})(--b, a);
|
})(--b, a);
|
||||||
console.log(a, b);
|
console.log(a, b);
|
||||||
|
|||||||
@@ -6228,3 +6228,33 @@ recursive_collapse: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5025: {
|
||||||
|
options = {
|
||||||
|
collapse_vars: true,
|
||||||
|
inline: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function f(a) {
|
||||||
|
function g() {
|
||||||
|
b = 42;
|
||||||
|
}
|
||||||
|
g(b = a);
|
||||||
|
var b = this;
|
||||||
|
console.log(typeof b);
|
||||||
|
}
|
||||||
|
f();
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function f(a) {
|
||||||
|
b = a,
|
||||||
|
void (b = 42);
|
||||||
|
var b = this;
|
||||||
|
console.log(typeof b);
|
||||||
|
}
|
||||||
|
f();
|
||||||
|
}
|
||||||
|
expect_stdout: "object"
|
||||||
|
}
|
||||||
|
|||||||
@@ -1151,7 +1151,6 @@ replace_all_var_scope: {
|
|||||||
options = {
|
options = {
|
||||||
collapse_vars: true,
|
collapse_vars: true,
|
||||||
keep_fargs: false,
|
keep_fargs: false,
|
||||||
reduce_vars: true,
|
|
||||||
unused: true,
|
unused: true,
|
||||||
}
|
}
|
||||||
mangle = {}
|
mangle = {}
|
||||||
@@ -1170,7 +1169,7 @@ replace_all_var_scope: {
|
|||||||
(function(c) {
|
(function(c) {
|
||||||
switch (~a) {
|
switch (~a) {
|
||||||
case (b += a):
|
case (b += a):
|
||||||
case +c:
|
case c++:
|
||||||
}
|
}
|
||||||
})((--b, a));
|
})((--b, a));
|
||||||
console.log(a, b);
|
console.log(a, b);
|
||||||
|
|||||||
Reference in New Issue
Block a user