@@ -5395,7 +5395,8 @@ merge(Compressor.prototype, {
|
||||
|
||||
OPT(AST_UnaryPrefix, function(self, compressor) {
|
||||
var e = self.expression;
|
||||
if (self.operator == "delete"
|
||||
if (compressor.option("evaluate")
|
||||
&& self.operator == "delete"
|
||||
&& !(e instanceof AST_SymbolRef
|
||||
|| e instanceof AST_PropAccess
|
||||
|| is_identifier_atom(e))) {
|
||||
@@ -6254,6 +6255,7 @@ merge(Compressor.prototype, {
|
||||
if (compressor.option("dead_code")
|
||||
&& self.left instanceof AST_SymbolRef
|
||||
&& (def = self.left.definition()).scope === compressor.find_parent(AST_Lambda)) {
|
||||
if (self.left.is_immutable()) return strip_assignment();
|
||||
var level = 0, node, parent = self;
|
||||
do {
|
||||
node = parent;
|
||||
@@ -6261,16 +6263,12 @@ merge(Compressor.prototype, {
|
||||
if (parent instanceof AST_Exit) {
|
||||
if (in_try(level, parent)) break;
|
||||
if (is_reachable(def.scope, [ def ])) break;
|
||||
if (self.operator == "=") return self.right.optimize(compressor);
|
||||
def.fixed = false;
|
||||
return make_node(AST_Binary, self, {
|
||||
operator: self.operator.slice(0, -1),
|
||||
left: self.left,
|
||||
right: self.right
|
||||
}).optimize(compressor);
|
||||
return strip_assignment();
|
||||
}
|
||||
} while (parent instanceof AST_Binary && parent.right === node
|
||||
|| parent instanceof AST_Sequence && parent.tail_node() === node);
|
||||
|| parent instanceof AST_Sequence && parent.tail_node() === node
|
||||
|| parent instanceof AST_UnaryPrefix);
|
||||
}
|
||||
self = self.lift_sequences(compressor);
|
||||
if (!compressor.option("assignments")) return self;
|
||||
@@ -6302,13 +6300,6 @@ merge(Compressor.prototype, {
|
||||
expression: self.left
|
||||
});
|
||||
}
|
||||
if (!compressor.option("ie8") && self.left instanceof AST_Symbol && self.left.is_immutable()) {
|
||||
return (self.operator == "=" ? self.right : make_node(AST_Binary, self, {
|
||||
operator: self.operator.slice(0, -1),
|
||||
left: self.left,
|
||||
right: self.right
|
||||
})).optimize(compressor);
|
||||
}
|
||||
return self;
|
||||
|
||||
function in_try(level, node) {
|
||||
@@ -6325,6 +6316,14 @@ merge(Compressor.prototype, {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function strip_assignment() {
|
||||
return (self.operator != "=" ? make_node(AST_Binary, self, {
|
||||
operator: self.operator.slice(0, -1),
|
||||
left: self.left,
|
||||
right: self.right
|
||||
}) : maintain_this_binding(compressor, compressor.parent(), self, self.right)).optimize(compressor);
|
||||
}
|
||||
});
|
||||
|
||||
OPT(AST_Conditional, function(self, compressor) {
|
||||
|
||||
Reference in New Issue
Block a user