From e7841ab5d740eb70f2975212de4a1066d8714438 Mon Sep 17 00:00:00 2001 From: wolfbeast Date: Thu, 27 Feb 2020 20:09:26 +0100 Subject: Issue #1465 - Implement optional catch binding. --- js/src/frontend/ParseNode.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'js/src/frontend/ParseNode.cpp') diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp index 42ae9451a..e01a41067 100644 --- a/js/src/frontend/ParseNode.cpp +++ b/js/src/frontend/ParseNode.cpp @@ -409,13 +409,14 @@ PushNodeChildren(ParseNode* pn, NodeStack* stack) return PushResult::Recyclable; } - // A catch node has first kid as catch-variable pattern, the second kid - // as catch condition (which, if non-null, records the || in - // SpiderMonkey's |catch (e if )| extension), and third kid as the - // statements in the catch block. + // A catch node has an (optional) first kid as catch-variable pattern, + // the second kid as (optional) catch condition (which, records the + // || in SpiderMonkey's |catch (e if )| extension), and + // third kid as the statements in the catch block. case PNK_CATCH: { MOZ_ASSERT(pn->isArity(PN_TERNARY)); - stack->push(pn->pn_kid1); + if (pn->pn_kid1) + stack->push(pn->pn_kid1); if (pn->pn_kid2) stack->push(pn->pn_kid2); stack->push(pn->pn_kid3); -- cgit v1.2.3