diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index f2601f243ae4..da5d47cb1ecf 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -2079,9 +2079,9 @@ ParserBase::newLexicalScopeData(ParseContext::Scope& scope) return Some(bindings); } -template +template <> SyntaxParseHandler::Node -Parser::finishLexicalScope(ParseContext::Scope& scope, Node body) +PerHandlerParser::finishLexicalScope(ParseContext::Scope& scope, Node body) { if (!propagateFreeNamesAndMarkClosedOverBindings(scope)) return null(); @@ -2089,9 +2089,9 @@ Parser::finishLexicalScope(ParseContext::Scope& scope return body; } -template +template <> ParseNode* -Parser::finishLexicalScope(ParseContext::Scope& scope, ParseNode* body) +PerHandlerParser::finishLexicalScope(ParseContext::Scope& scope, ParseNode* body) { if (!propagateFreeNamesAndMarkClosedOverBindings(scope)) return nullptr; @@ -2103,13 +2103,6 @@ Parser::finishLexicalScope(ParseContext::Scope& scope, return handler.newLexicalScope(*bindings, body); } -template -inline typename ParseHandler::Node -GeneralParser::finishLexicalScope(ParseContext::Scope& scope, Node body) -{ - return asFinalParser()->finishLexicalScope(scope, body); -} - template ParseNode* Parser::evalBody(EvalSharedContext* evalsc) diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h index 449928e8bdd8..b55b8667e6d5 100644 --- a/js/src/frontend/Parser.h +++ b/js/src/frontend/Parser.h @@ -312,6 +312,8 @@ class PerHandlerParser // Required on Scope exit. bool propagateFreeNamesAndMarkClosedOverBindings(ParseContext::Scope& scope); + Node finishLexicalScope(ParseContext::Scope& scope, Node body); + bool declareFunctionThis(); inline Node newName(PropertyName* name); @@ -376,6 +378,7 @@ class GeneralParser #if DEBUG using Base::checkOptionsCalled; #endif + using Base::finishLexicalScope; using Base::foldConstants; using Base::getFilename; using Base::hasUsedFunctionSpecialName; @@ -908,8 +911,6 @@ class GeneralParser bool checkLexicalDeclarationDirectlyWithinBlock(ParseContext::Statement& stmt, DeclarationKind kind, TokenPos pos); - inline Node finishLexicalScope(ParseContext::Scope& scope, Node body); - Node propertyName(YieldHandling yieldHandling, const mozilla::Maybe& maybeDecl, Node propList, PropertyType* propType, MutableHandleAtom propAtom); @@ -1073,8 +1074,6 @@ class Parser final bool skipLazyInnerFunction(Node funcNode, uint32_t toStringStart, FunctionSyntaxKind kind, bool tryAnnexB); - Node finishLexicalScope(ParseContext::Scope& scope, Node body); - bool finishFunction(bool isStandaloneFunction = false); #define ABORTED_SYNTAX_PARSE_SENTINEL reinterpret_cast(0x1) @@ -1168,6 +1167,7 @@ class Parser final using Base::error; using Base::errorAt; using Base::finishFunctionScopes; + using Base::finishLexicalScope; using Base::innerFunction; using Base::innerFunctionForFunctionBox; using Base::keepAtoms; @@ -1225,8 +1225,6 @@ class Parser final bool skipLazyInnerFunction(Node funcNode, uint32_t toStringStart, FunctionSyntaxKind kind, bool tryAnnexB); - Node finishLexicalScope(ParseContext::Scope& scope, Node body); - bool finishFunction(bool isStandaloneFunction = false); // Functions present only in Parser.