@@ -6719,9 +6719,11 @@ Compressor.prototype.compress = function(node) {
|
|||||||
segments.consequent = scan_branches(level + 1, condition.left, condition.right).consequent;
|
segments.consequent = scan_branches(level + 1, condition.left, condition.right).consequent;
|
||||||
break;
|
break;
|
||||||
case "||":
|
case "||":
|
||||||
case "??":
|
|
||||||
segments.alternative = scan_branches(level + 1, condition.left, null, condition.right).alternative;
|
segments.alternative = scan_branches(level + 1, condition.left, null, condition.right).alternative;
|
||||||
break;
|
break;
|
||||||
|
case "??":
|
||||||
|
segments.alternative = scan_branches(level + 1, condition.left, condition.right, condition.right).alternative;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
condition.walk(tw);
|
condition.walk(tw);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -344,3 +344,43 @@ issue_5266: {
|
|||||||
]
|
]
|
||||||
node_version: ">=14"
|
node_version: ">=14"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
issue_5829_1: {
|
||||||
|
options = {
|
||||||
|
merge_vars: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(function f(a) {
|
||||||
|
var b;
|
||||||
|
(!a ?? (b = 0)) || console.log(b || "PASS");
|
||||||
|
})("FAIL");
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function f(a) {
|
||||||
|
var b;
|
||||||
|
(!a ?? (b = 0)) || console.log(b || "PASS");
|
||||||
|
})("FAIL");
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=14"
|
||||||
|
}
|
||||||
|
|
||||||
|
issue_5829_2: {
|
||||||
|
options = {
|
||||||
|
merge_vars: true,
|
||||||
|
}
|
||||||
|
input: {
|
||||||
|
(function f(a) {
|
||||||
|
var b;
|
||||||
|
(a ?? (b = 0)) && console.log(b || "PASS");
|
||||||
|
})("FAIL");
|
||||||
|
}
|
||||||
|
expect: {
|
||||||
|
(function f(a) {
|
||||||
|
var b;
|
||||||
|
(a ?? (b = 0)) && console.log(b || "PASS");
|
||||||
|
})("FAIL");
|
||||||
|
}
|
||||||
|
expect_stdout: "PASS"
|
||||||
|
node_version: ">=14"
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user