return cond.negate(compressor);
case "??":
return make_node(AST_Binary, self, {
- operator: "===",
- left: make_node(AST_Undefined, self).transform(compressor),
+ operator: "==",
+ left: make_node(AST_Null, self),
right: cond,
});
}
})();
}
expect: {
- if (void 0 === function() {
+ if (null == function() {
while (console.log("foo"));
}())
while (console.log("bar"));
expect_stdout: "PASS"
node_version: ">=14"
}
+
+issue_5266: {
+ options = {
+ inline: true,
+ }
+ input: {
+ [
+ 42,
+ null,
+ false,
+ void 0,
+ "FAIL",
+ ].forEach(function (a) {
+ a ?? function() {
+ while (console.log(a));
+ }();
+ });
+ }
+ expect: {
+ [
+ 42,
+ null,
+ false,
+ void 0,
+ "FAIL",
+ ].forEach(function (a) {
+ if (null == a) {
+ while (console.log(a));
+ return;
+ } else
+ return;
+ });
+ }
+ expect_stdout: [
+ "null",
+ "undefined",
+ ]
+ node_version: ">=14"
+}