support nullish coalescing operator (#4678)

This commit is contained in:
Alex Lam S.L
2021-02-23 21:57:11 +00:00
committed by GitHub
parent d68d155f93
commit c885660347
16 changed files with 177 additions and 36 deletions

View File

@@ -149,6 +149,7 @@ var SUPPORT = function(matrix) {
for_of: "for (var a of []);",
generator: "function* f(){}",
let: "let a;",
nullish: "0 ?? 0",
rest: "var [...a] = [];",
rest_object: "var {...a} = {};",
spread: "[...[]];",
@@ -231,6 +232,7 @@ var BINARY_OPS = [
",",
];
BINARY_OPS = BINARY_OPS.concat(BINARY_OPS);
if (SUPPORT.nullish) BINARY_OPS.push("??");
BINARY_OPS = BINARY_OPS.concat(BINARY_OPS);
BINARY_OPS = BINARY_OPS.concat(BINARY_OPS);
if (SUPPORT.exponentiation) BINARY_OPS.push("**");