summaryrefslogtreecommitdiffstats
path: root/js/src/builtin/ReflectParse.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@wolfbeast.com>2020-02-29 10:54:34 +0100
committerwolfbeast <mcwerewolf@wolfbeast.com>2020-02-29 10:54:34 +0100
commit81c36a25e50bd50ee14ce235a2acde7b6d09838c (patch)
treef41e7b3c8812c6d0731abc7b9de010fc49d496c4 /js/src/builtin/ReflectParse.cpp
parent665a4000cda78f90c641a6a237def9fee6765766 (diff)
parent9f04e24a502d32a0633fe0945bf285c6ac0b6e87 (diff)
downloadUXP-81c36a25e50bd50ee14ce235a2acde7b6d09838c.tar
UXP-81c36a25e50bd50ee14ce235a2acde7b6d09838c.tar.gz
UXP-81c36a25e50bd50ee14ce235a2acde7b6d09838c.tar.lz
UXP-81c36a25e50bd50ee14ce235a2acde7b6d09838c.tar.xz
UXP-81c36a25e50bd50ee14ce235a2acde7b6d09838c.zip
Merge branch 'release' into Pale_Moon-release
Diffstat (limited to 'js/src/builtin/ReflectParse.cpp')
-rw-r--r--js/src/builtin/ReflectParse.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/js/src/builtin/ReflectParse.cpp b/js/src/builtin/ReflectParse.cpp
index 8e8bb2417..e7a84c7c3 100644
--- a/js/src/builtin/ReflectParse.cpp
+++ b/js/src/builtin/ReflectParse.cpp
@@ -1547,7 +1547,7 @@ NodeBuilder::catchClause(HandleValue var, HandleValue guard, HandleValue body, T
{
RootedValue cb(cx, callbacks[AST_CATCH]);
if (!cb.isNull())
- return callback(cb, var, opt(guard), body, pos, dst);
+ return callback(cb, opt(var), opt(guard), body, pos, dst);
return newNode(AST_CATCH, pos,
"param", var,
@@ -1803,6 +1803,14 @@ class ASTSerializer
bool identifier(ParseNode* pn, MutableHandleValue dst);
bool literal(ParseNode* pn, MutableHandleValue dst);
+ bool optPattern(ParseNode* pn, MutableHandleValue dst) {
+ if (!pn) {
+ dst.setMagic(JS_SERIALIZE_NO_NODE);
+ return true;
+ }
+ return pattern(pn, dst);
+ }
+
bool pattern(ParseNode* pn, MutableHandleValue dst);
bool arrayPattern(ParseNode* pn, MutableHandleValue dst);
bool objectPattern(ParseNode* pn, MutableHandleValue dst);
@@ -2265,13 +2273,13 @@ ASTSerializer::switchStatement(ParseNode* pn, MutableHandleValue dst)
bool
ASTSerializer::catchClause(ParseNode* pn, bool* isGuarded, MutableHandleValue dst)
{
- MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid1->pn_pos));
+ MOZ_ASSERT_IF(pn->pn_kid1, pn->pn_pos.encloses(pn->pn_kid1->pn_pos));
MOZ_ASSERT_IF(pn->pn_kid2, pn->pn_pos.encloses(pn->pn_kid2->pn_pos));
MOZ_ASSERT(pn->pn_pos.encloses(pn->pn_kid3->pn_pos));
RootedValue var(cx), guard(cx), body(cx);
- if (!pattern(pn->pn_kid1, &var) ||
+ if (!optPattern(pn->pn_kid1, &var) ||
!optExpression(pn->pn_kid2, &guard)) {
return false;
}