@@ -3469,8 +3469,10 @@ merge(Compressor.prototype, {
|
|||||||
while (left instanceof AST_PropAccess) {
|
while (left instanceof AST_PropAccess) {
|
||||||
left = left.expression;
|
left = left.expression;
|
||||||
}
|
}
|
||||||
if (left instanceof AST_Symbol) return this;
|
if (left.is_constant_expression(compressor.find_parent(AST_Scope))) {
|
||||||
return this.right.drop_side_effect_free(compressor);
|
return this.right.drop_side_effect_free(compressor);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
});
|
});
|
||||||
def(AST_Conditional, function(compressor){
|
def(AST_Conditional, function(compressor){
|
||||||
var consequent = this.consequent.drop_side_effect_free(compressor);
|
var consequent = this.consequent.drop_side_effect_free(compressor);
|
||||||
|
|||||||
@@ -694,3 +694,30 @@ issue_2678: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_2838: {
|
||||||
|
options = {
|
||||||
|
pure_getters: true,
|
||||||
|
side_effects: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
function f(a, b) {
|
||||||
|
(a || b).c = "PASS";
|
||||||
|
(function() {
|
||||||
|
return f(a, b);
|
||||||
|
}).prototype.foo = "bar";
|
||||||
|
}
|
||||||
|
var o = {};
|
||||||
|
f(null, o);
|
||||||
|
console.log(o.c);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
function f(a, b) {
|
||||||
|
(a || b).c = "PASS";
|
||||||
|
}
|
||||||
|
var o = {};
|
||||||
|
f(null, o);
|
||||||
|
console.log(o.c);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user