зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1599163 - fix nullish coalescing operator for (void 0) case; r=jorendorff
Differential Revision: https://phabricator.services.mozilla.com/D54775 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
bb66a7c88e
Коммит
eb71df2dc9
|
@ -718,6 +718,7 @@ static bool FoldAndOrCoalesce(JSContext* cx, ParseNode** nodePtr) {
|
|||
|
||||
bool isTruthyCoalesceNode =
|
||||
isCoalesceNode && !((*elem)->isKind(ParseNodeKind::NullExpr) ||
|
||||
(*elem)->isKind(ParseNodeKind::VoidExpr) ||
|
||||
(*elem)->isKind(ParseNodeKind::RawUndefinedExpr));
|
||||
bool canShortCircuit = (isOrNode && t == Truthy) ||
|
||||
(isAndNode && t == Falsy) || isTruthyCoalesceNode;
|
||||
|
|
|
@ -67,6 +67,7 @@ shouldBe(1 * null ?? 3, 0);
|
|||
shouldBe(1 / null ?? 3, Infinity);
|
||||
shouldBe(isNaN(1 % null ?? 3), true);
|
||||
shouldBe(1 ** null ?? 3, 1);
|
||||
shouldBe((void 0) ?? 3, 3);
|
||||
|
||||
const obj = {
|
||||
count: 0,
|
||||
|
|
Загрузка…
Ссылка в новой задаче