@@ -2546,12 +2546,7 @@ merge(Compressor.prototype, {
|
||||
if (parent instanceof AST_PropAccess) {
|
||||
var exp = parent.expression;
|
||||
if (exp === node) return find_stop_unused(parent, level + 1);
|
||||
var sym = root_expr(exp);
|
||||
if (!(sym instanceof AST_SymbolRef)) return find_stop_unused(parent, level + 1);
|
||||
var lvalue = lvalues.get(sym.name);
|
||||
return !lvalue || all(lvalue, function(lhs) {
|
||||
return !(lhs instanceof AST_PropAccess);
|
||||
}) ? find_stop_unused(parent, level + 1) : node;
|
||||
return check_expr(exp);
|
||||
}
|
||||
if (parent instanceof AST_Sequence) return find_stop_unused(parent, level + 1);
|
||||
if (parent instanceof AST_SimpleStatement) return find_stop_unused(parent, level + 1);
|
||||
@@ -2562,16 +2557,14 @@ merge(Compressor.prototype, {
|
||||
if (parent instanceof AST_Yield) return node;
|
||||
return null;
|
||||
|
||||
function check_assignment(lhs) {
|
||||
if (may_throw(parent)) return node;
|
||||
if (lhs !== node && lhs instanceof AST_Destructured) {
|
||||
function check_expr(expr) {
|
||||
var replace = can_replace;
|
||||
can_replace = false;
|
||||
var after = stop_after;
|
||||
var if_hit = stop_if_hit;
|
||||
var stack = scanner.stack;
|
||||
scanner.stack = [ parent ];
|
||||
lhs.transform(scanner);
|
||||
expr.transform(scanner);
|
||||
scanner.stack = stack;
|
||||
stop_if_hit = if_hit;
|
||||
stop_after = after;
|
||||
@@ -2580,7 +2573,12 @@ merge(Compressor.prototype, {
|
||||
abort = false;
|
||||
return node;
|
||||
}
|
||||
return find_stop_unused(parent, level + 1);
|
||||
}
|
||||
|
||||
function check_assignment(lhs) {
|
||||
if (may_throw(parent)) return node;
|
||||
if (lhs !== node && lhs instanceof AST_Destructured) return check_expr(lhs);
|
||||
return find_stop_unused(parent, level + 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9171,3 +9171,26 @@ issue_4914: {
|
||||
}
|
||||
expect_stdout: "function"
|
||||
}
|
||||
|
||||
issue_4918: {
|
||||
options = {
|
||||
collapse_vars: true,
|
||||
}
|
||||
input: {
|
||||
var a = "FAIL";
|
||||
({
|
||||
get 42() {
|
||||
console.log(a);
|
||||
}
|
||||
}[a = "PASS", 42] += "PASS");
|
||||
}
|
||||
expect: {
|
||||
var a = "FAIL";
|
||||
({
|
||||
get 42() {
|
||||
console.log(a);
|
||||
}
|
||||
}[a = "PASS", 42] += "PASS");
|
||||
}
|
||||
expect_stdout: "PASS"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user