@@ -6433,15 +6433,17 @@ merge(Compressor.prototype, {
|
|||||||
OPT(AST_Assign, function(self, compressor) {
|
OPT(AST_Assign, function(self, compressor) {
|
||||||
if (compressor.option("dead_code")) {
|
if (compressor.option("dead_code")) {
|
||||||
if (self.left instanceof AST_PropAccess) {
|
if (self.left instanceof AST_PropAccess) {
|
||||||
var exp = self.left.expression;
|
if (self.operator == "=") {
|
||||||
if (exp instanceof AST_Lambda
|
var exp = self.left.expression;
|
||||||
|| !compressor.has_directive("use strict")
|
if (exp instanceof AST_Lambda
|
||||||
&& exp instanceof AST_Constant
|
|| !compressor.has_directive("use strict")
|
||||||
&& !exp.may_throw_on_access(compressor)) {
|
&& exp instanceof AST_Constant
|
||||||
return self.left instanceof AST_Dot ? self.right : make_sequence(self, [
|
&& !exp.may_throw_on_access(compressor)) {
|
||||||
self.left.property,
|
return self.left instanceof AST_Dot ? self.right : make_sequence(self, [
|
||||||
self.right
|
self.left.property,
|
||||||
]).optimize(compressor);
|
self.right
|
||||||
|
]).optimize(compressor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (self.left instanceof AST_SymbolRef) {
|
} else if (self.left instanceof AST_SymbolRef) {
|
||||||
var def = self.left.definition();
|
var def = self.left.definition();
|
||||||
|
|||||||
@@ -1042,3 +1042,25 @@ function_assign: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "PASS"
|
expect_stdout: "PASS"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_3552: {
|
||||||
|
options = {
|
||||||
|
dead_code: true,
|
||||||
|
pure_getters: "strict",
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = "PASS";
|
||||||
|
(function() {
|
||||||
|
(1..p += 42) && (a = "FAIL");
|
||||||
|
})();
|
||||||
|
console.log(a);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = "PASS";
|
||||||
|
(function() {
|
||||||
|
(1..p += 42) && (a = "FAIL");
|
||||||
|
})();
|
||||||
|
console.log(a);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user