Bug 1424946 - Move GeneralParser::finishLexicalScope into a baser class. r=arai

This commit is contained in:
Jeff Walden 2017-12-12 15:20:59 -06:00
parent 6fd90e2703
commit ab8b5a5759
2 changed files with 8 additions and 17 deletions

View File

@ -2079,9 +2079,9 @@ ParserBase::newLexicalScopeData(ParseContext::Scope& scope)
return Some(bindings);
}
template <typename CharT>
template <>
SyntaxParseHandler::Node
Parser<SyntaxParseHandler, CharT>::finishLexicalScope(ParseContext::Scope& scope, Node body)
PerHandlerParser<SyntaxParseHandler>::finishLexicalScope(ParseContext::Scope& scope, Node body)
{
if (!propagateFreeNamesAndMarkClosedOverBindings(scope))
return null();
@ -2089,9 +2089,9 @@ Parser<SyntaxParseHandler, CharT>::finishLexicalScope(ParseContext::Scope& scope
return body;
}
template <typename CharT>
template <>
ParseNode*
Parser<FullParseHandler, CharT>::finishLexicalScope(ParseContext::Scope& scope, ParseNode* body)
PerHandlerParser<FullParseHandler>::finishLexicalScope(ParseContext::Scope& scope, ParseNode* body)
{
if (!propagateFreeNamesAndMarkClosedOverBindings(scope))
return nullptr;
@ -2103,13 +2103,6 @@ Parser<FullParseHandler, CharT>::finishLexicalScope(ParseContext::Scope& scope,
return handler.newLexicalScope(*bindings, body);
}
template <class ParseHandler, typename CharT>
inline typename ParseHandler::Node
GeneralParser<ParseHandler, CharT>::finishLexicalScope(ParseContext::Scope& scope, Node body)
{
return asFinalParser()->finishLexicalScope(scope, body);
}
template <typename CharT>
ParseNode*
Parser<FullParseHandler, CharT>::evalBody(EvalSharedContext* evalsc)

View File

@ -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<DeclarationKind>& maybeDecl, Node propList,
PropertyType* propType, MutableHandleAtom propAtom);
@ -1073,8 +1074,6 @@ class Parser<SyntaxParseHandler, CharT> 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<SyntaxParser*>(0x1)
@ -1168,6 +1167,7 @@ class Parser<FullParseHandler, CharT> 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<FullParseHandler, CharT> 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<FullParseHandler, CharT>.