diff options
author | FranklinDM <mrmineshafter17@gmail.com> | 2022-04-26 01:16:59 +0800 |
---|---|---|
committer | FranklinDM <mrmineshafter17@gmail.com> | 2022-05-04 14:57:16 +0800 |
commit | 97dcd8009ae0b59355c5a9022fa6273825d5010d (patch) | |
tree | 21c1334fb04d17769588f58a91f95dfabe8ac6ad /js/src/frontend/FoldConstants.cpp | |
parent | e1fc99d6efdddb3ed0eef82281a8662bf3b1a344 (diff) | |
download | uxp-97dcd8009ae0b59355c5a9022fa6273825d5010d.tar.gz |
Issue #1658 - Part 2: Implement bytecode for optional chaining
Partially based on:
Bug 1566143 - Implement the Optional Chaining operator (?.) proposal
Bug 1650340 - Fix deleteElementInOptionalChain
Bug 1644839 - Fix return value of emitOptionalChain on failure
Diffstat (limited to 'js/src/frontend/FoldConstants.cpp')
-rw-r--r-- | js/src/frontend/FoldConstants.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/js/src/frontend/FoldConstants.cpp b/js/src/frontend/FoldConstants.cpp index d0e88581ea..979af29b42 100644 --- a/js/src/frontend/FoldConstants.cpp +++ b/js/src/frontend/FoldConstants.cpp @@ -369,6 +369,10 @@ ContainsHoistedDeclaration(ExclusiveContext* cx, ParseNode* node, bool* result) case PNK_DOT: case PNK_ELEM: case PNK_CALL: + case PNK_OPTCHAIN: + case PNK_OPTDOT: + case PNK_OPTELEM: + case PNK_OPTCALL: case PNK_NAME: case PNK_TEMPLATE_STRING: case PNK_TEMPLATE_STRING_LIST: @@ -1529,7 +1533,9 @@ static bool FoldCall(ExclusiveContext* cx, ParseNode* node, Parser<FullParseHandler>& parser, bool inGenexpLambda) { - MOZ_ASSERT(node->isKind(PNK_CALL) || node->isKind(PNK_SUPERCALL) || + MOZ_ASSERT(node->isKind(PNK_CALL) || + node->isKind(PNK_OPTCALL) || + node->isKind(PNK_SUPERCALL) || node->isKind(PNK_TAGGED_TEMPLATE)); MOZ_ASSERT(node->isArity(PN_LIST)); @@ -1826,6 +1832,7 @@ Fold(ExclusiveContext* cx, ParseNode** pnp, Parser<FullParseHandler>& parser, bo return FoldAdd(cx, pnp, parser, inGenexpLambda); case PNK_CALL: + case PNK_OPTCALL: case PNK_SUPERCALL: case PNK_TAGGED_TEMPLATE: return FoldCall(cx, pn, parser, inGenexpLambda); |