@@ -3295,11 +3295,8 @@ merge(Compressor.prototype, {
|
|||||||
if (node instanceof AST_Unary && unary_arithmetic[node.operator]) modified(node.expression);
|
if (node instanceof AST_Unary && unary_arithmetic[node.operator]) modified(node.expression);
|
||||||
});
|
});
|
||||||
function modified(node) {
|
function modified(node) {
|
||||||
if (node instanceof AST_Dot) {
|
if (node instanceof AST_PropAccess) {
|
||||||
modified(node.expression);
|
modified(node.expression);
|
||||||
} else if (node instanceof AST_Sub) {
|
|
||||||
modified(node.expression);
|
|
||||||
node.property.walk(scan_modified);
|
|
||||||
} else if (node instanceof AST_SymbolRef) {
|
} else if (node instanceof AST_SymbolRef) {
|
||||||
node.definition().references.forEach(function(ref) {
|
node.definition().references.forEach(function(ref) {
|
||||||
delete ref._eval;
|
delete ref._eval;
|
||||||
@@ -3329,14 +3326,17 @@ merge(Compressor.prototype, {
|
|||||||
}
|
}
|
||||||
var op = this.operator;
|
var op = this.operator;
|
||||||
var node;
|
var node;
|
||||||
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 = op == "=" ? this.right : make_node(AST_Binary, this, {
|
node = lhs;
|
||||||
|
} else if (op == "=") {
|
||||||
|
lhs.walk(scan_modified);
|
||||||
|
node = this.right;
|
||||||
|
} else {
|
||||||
|
node = make_node(AST_Binary, this, {
|
||||||
operator: op.slice(0, -1),
|
operator: op.slice(0, -1),
|
||||||
left: lhs,
|
left: lhs,
|
||||||
right: this.right,
|
right: this.right,
|
||||||
});
|
});
|
||||||
} else {
|
|
||||||
node = lhs;
|
|
||||||
}
|
}
|
||||||
var value = node._eval(compressor, ignore_side_effects, cached, depth);
|
var value = node._eval(compressor, ignore_side_effects, cached, depth);
|
||||||
if (value === node) return this;
|
if (value === node) return this;
|
||||||
|
|||||||
@@ -2812,3 +2812,24 @@ operator_in: {
|
|||||||
"true",
|
"true",
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3997: {
|
||||||
|
options = {
|
||||||
|
evaluate: true,
|
||||||
|
reduce_vars: true,
|
||||||
|
toplevel: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = function f(b) {
|
||||||
|
return b[b += this] = b;
|
||||||
|
}(0);
|
||||||
|
console.log(typeof a);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = function f(b) {
|
||||||
|
return b[b += this] = b;
|
||||||
|
}(0);
|
||||||
|
console.log(typeof a);
|
||||||
|
}
|
||||||
|
expect_stdout: "string"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user