@@ -11139,9 +11139,15 @@ Compressor.prototype.compress = function(node) {
|
|||||||
&& assign instanceof AST_Assign
|
&& assign instanceof AST_Assign
|
||||||
&& assign.operator == "="
|
&& assign.operator == "="
|
||||||
&& self.left.equivalent_to(assign.left)) {
|
&& self.left.equivalent_to(assign.left)) {
|
||||||
self.right = assign.right;
|
return make_node(AST_Assign, self, {
|
||||||
assign.right = self;
|
operator: "=",
|
||||||
return assign;
|
left: assign.left,
|
||||||
|
right: make_node(AST_Binary, self, {
|
||||||
|
operator: self.operator,
|
||||||
|
left: self.left,
|
||||||
|
right: assign.right,
|
||||||
|
}),
|
||||||
|
}).optimize(compressor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (compressor.option("comparisons")) switch (self.operator) {
|
if (compressor.option("comparisons")) switch (self.operator) {
|
||||||
|
|||||||
@@ -1525,3 +1525,25 @@ issue_5385_2: {
|
|||||||
]
|
]
|
||||||
node_version: ">=10"
|
node_version: ">=10"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5425: {
|
||||||
|
options = {
|
||||||
|
assignments: true,
|
||||||
|
ie: true,
|
||||||
|
toplevel: true,
|
||||||
|
unused: true,
|
||||||
|
yields: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
var a = "FAIL";
|
||||||
|
var b = function* f() {}(a ? a = "PASS" : 42);
|
||||||
|
console.log(a, typeof f);
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
var a = "FAIL";
|
||||||
|
(function* f() {})(a && (a = "PASS"));
|
||||||
|
console.log(a, typeof f);
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS undefined"
|
||||||
|
node_version: ">=4"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user