@@ -9174,17 +9174,20 @@ Compressor.prototype.compress = function(node) {
|
|||||||
child = parent;
|
child = parent;
|
||||||
parent = compressor.parent(level++);
|
parent = compressor.parent(level++);
|
||||||
if (parent instanceof AST_Binary) {
|
if (parent instanceof AST_Binary) {
|
||||||
var op = parent.operator;
|
switch (child) {
|
||||||
if (!lazy_op[op]) return;
|
case parent.left:
|
||||||
var left = parent.left;
|
if (lazy_op[parent.operator]) continue;
|
||||||
if (left === child) continue;
|
|
||||||
if (match(left)) switch (op) {
|
|
||||||
case "&&":
|
|
||||||
node[negated ? "falsy" : "truthy"] = true;
|
|
||||||
break;
|
break;
|
||||||
case "||":
|
case parent.right:
|
||||||
case "??":
|
if (match(parent.left)) switch (parent.operator) {
|
||||||
node[negated ? "truthy" : "falsy"] = true;
|
case "&&":
|
||||||
|
node[negated ? "falsy" : "truthy"] = true;
|
||||||
|
break;
|
||||||
|
case "||":
|
||||||
|
case "??":
|
||||||
|
node[negated ? "truthy" : "falsy"] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (parent instanceof AST_Conditional) {
|
} else if (parent instanceof AST_Conditional) {
|
||||||
|
|||||||
@@ -762,3 +762,27 @@ issue_5228: {
|
|||||||
}
|
}
|
||||||
expect_stdout: "true"
|
expect_stdout: "true"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5469: {
|
||||||
|
options = {
|
||||||
|
assignments: true,
|
||||||
|
booleans: true,
|
||||||
|
conditionals: true,
|
||||||
|
dead_code: true,
|
||||||
|
evaluate: true,
|
||||||
|
pure_getters: "strict",
|
||||||
|
side_effects: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
console.log(function f(a) {
|
||||||
|
a && 42[a = A && null];
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
console.log(function f(a) {
|
||||||
|
a && A,
|
||||||
|
0;
|
||||||
|
}());
|
||||||
|
}
|
||||||
|
expect_stdout: "undefined"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user