@@ -3894,7 +3894,13 @@ merge(Compressor.prototype, {
|
|||||||
if (node instanceof AST_Unary && UNARY_POSTFIX[node.operator]) modified(node.expression);
|
if (node instanceof AST_Unary && UNARY_POSTFIX[node.operator]) modified(node.expression);
|
||||||
});
|
});
|
||||||
function modified(node) {
|
function modified(node) {
|
||||||
if (node instanceof AST_PropAccess) {
|
if (node instanceof AST_DestructuredArray) {
|
||||||
|
node.elements.forEach(modified);
|
||||||
|
} else if (node instanceof AST_DestructuredObject) {
|
||||||
|
node.properties.forEach(function(prop) {
|
||||||
|
modified(prop.value);
|
||||||
|
});
|
||||||
|
} else if (node instanceof AST_PropAccess) {
|
||||||
modified(node.expression);
|
modified(node.expression);
|
||||||
} else if (node instanceof AST_SymbolRef) {
|
} else if (node instanceof AST_SymbolRef) {
|
||||||
node.definition().references.forEach(function(ref) {
|
node.definition().references.forEach(function(ref) {
|
||||||
@@ -3928,7 +3934,6 @@ merge(Compressor.prototype, {
|
|||||||
if (!HOP(lhs, "_eval") && lhs instanceof AST_SymbolRef && lhs.fixed && lhs.definition().fixed) {
|
if (!HOP(lhs, "_eval") && lhs instanceof AST_SymbolRef && lhs.fixed && lhs.definition().fixed) {
|
||||||
node = lhs;
|
node = lhs;
|
||||||
} else if (op == "=") {
|
} else if (op == "=") {
|
||||||
lhs.walk(scan_modified);
|
|
||||||
node = this.right;
|
node = this.right;
|
||||||
} else {
|
} else {
|
||||||
node = make_node(AST_Binary, this, {
|
node = make_node(AST_Binary, this, {
|
||||||
@@ -3937,6 +3942,7 @@ merge(Compressor.prototype, {
|
|||||||
right: this.right,
|
right: this.right,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
lhs.walk(scan_modified);
|
||||||
var value = node._eval(compressor, ignore_side_effects, cached, depth);
|
var value = node._eval(compressor, ignore_side_effects, cached, depth);
|
||||||
if (typeof value == "object") return this;
|
if (typeof value == "object") return this;
|
||||||
modified(lhs);
|
modified(lhs);
|
||||||
@@ -4011,6 +4017,7 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
var def = e instanceof AST_SymbolRef && e.definition();
|
var def = e instanceof AST_SymbolRef && e.definition();
|
||||||
if (!non_converting_unary[op] && !(def && def.fixed)) depth++;
|
if (!non_converting_unary[op] && !(def && def.fixed)) depth++;
|
||||||
|
e.walk(scan_modified);
|
||||||
var v = e._eval(compressor, ignore_side_effects, cached, depth);
|
var v = e._eval(compressor, ignore_side_effects, cached, depth);
|
||||||
if (v === e) {
|
if (v === e) {
|
||||||
if (ignore_side_effects && op == "void") return;
|
if (ignore_side_effects && op == "void") return;
|
||||||
@@ -4054,6 +4061,7 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!(e instanceof AST_SymbolRef && e.definition().fixed)) depth++;
|
if (!(e instanceof AST_SymbolRef && e.definition().fixed)) depth++;
|
||||||
|
e.walk(scan_modified);
|
||||||
var v = e._eval(compressor, ignore_side_effects, cached, depth);
|
var v = e._eval(compressor, ignore_side_effects, cached, depth);
|
||||||
if (v === e) return this;
|
if (v === e) return this;
|
||||||
modified(e);
|
modified(e);
|
||||||
|
|||||||
@@ -2302,3 +2302,27 @@ issue_4485_3: {
|
|||||||
expect_stdout: true
|
expect_stdout: true
|
||||||
node_version: ">=6"
|
node_version: ">=6"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_4500: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
keep_fnames: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = function f(b) {
|
||||||
|
return [ b ] = [], b;
|
||||||
|
}("FAIL");
|
||||||
|
console.log(a || "PASS");
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = function f(b) {
|
||||||
|
return [ b ] = [], b;
|
||||||
|
}("FAIL");
|
||||||
|
console.log(a || "PASS");
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=6"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user