summaryrefslogtreecommitdiff
path: root/js/src/frontend/FullParseHandler.h
diff options
context:
space:
mode:
Diffstat (limited to 'js/src/frontend/FullParseHandler.h')
-rw-r--r--js/src/frontend/FullParseHandler.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h
index f346351255..a5a5bd16a0 100644
--- a/js/src/frontend/FullParseHandler.h
+++ b/js/src/frontend/FullParseHandler.h
@@ -213,6 +213,18 @@ class FullParseHandler
if (expr->isKind(PNK_ELEM))
return newUnary(PNK_DELETEELEM, JSOP_NOP, begin, expr);
+ if (expr->isKind(PNK_OPTCHAIN)) {
+ ParseNode* kid = expr->pn_kid;
+ // Handle property deletion explicitly. OptionalCall is handled
+ // via DeleteExpr.
+ if (kid->isKind(PNK_DOT) ||
+ kid->isKind(PNK_OPTDOT) ||
+ kid->isKind(PNK_ELEM) ||
+ kid->isKind(PNK_OPTELEM)) {
+ return newUnary(PNK_DELETEOPTCHAIN, JSOP_NOP, begin, kid);
+ }
+ }
+
return newUnary(PNK_DELETEEXPR, JSOP_NOP, begin, expr);
}
@@ -319,6 +331,10 @@ class FullParseHandler
return newList(PNK_CALL, JSOP_CALL);
}
+ ParseNode* newOptionalCall() {
+ return newList(PNK_OPTCALL, JSOP_CALL);
+ }
+
ParseNode* newTaggedTemplate() {
return newList(PNK_TAGGED_TEMPLATE, JSOP_CALL);
}
@@ -459,6 +475,11 @@ class FullParseHandler
return new_<UnaryNode>(PNK_AWAIT, JSOP_AWAIT, pos, value);
}
+ ParseNode* newOptionalChain(uint32_t begin, ParseNode* value) {
+ TokenPos pos(begin, value->pn_pos.end);
+ return new_<UnaryNode>(PNK_OPTCHAIN, JSOP_NOP, pos, value);
+ }
+
// Statements
ParseNode* newStatementList(const TokenPos& pos) {
@@ -678,6 +699,14 @@ class FullParseHandler
return new_<PropertyByValue>(lhs, index, lhs->pn_pos.begin, end);
}
+ ParseNode* newOptionalPropertyAccess(ParseNode* pn, PropertyName* name, uint32_t end) {
+ return new_<OptionalPropertyAccess>(pn, name, pn->pn_pos.begin, end);
+ }
+
+ ParseNode* newOptionalPropertyByValue(ParseNode* lhs, ParseNode* index, uint32_t end) {
+ return new_<OptionalPropertyByValue>(lhs, index, lhs->pn_pos.begin, end);
+ }
+
inline MOZ_MUST_USE bool addCatchBlock(ParseNode* catchList, ParseNode* lexicalScope,
ParseNode* catchName, ParseNode* catchGuard,
ParseNode* catchBody);