Bug 1288459 - Split variable-statement parsing into its own parser function. r=arai

--HG--
extra : rebase_source : 574f08e92b8e8e9f0f35e86a48986e956828c09a
This commit is contained in:
Jeff Walden 2016-08-24 17:28:39 -07:00
Родитель 978e38289a
Коммит 151707db5d
2 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -6424,6 +6424,18 @@ Parser<ParseHandler>::peekShouldParseLetDeclaration(bool* parseDeclOut,
return true;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::variableStatement(YieldHandling yieldHandling)
{
Node vars = declarationList(yieldHandling, PNK_VAR);
if (!vars)
return null();
if (!MatchOrInsertSemicolonAfterExpression(tokenStream))
return null();
return vars;
}
template <typename ParseHandler>
typename ParseHandler::Node
Parser<ParseHandler>::statement(YieldHandling yieldHandling, bool canHaveDirectives)
@ -6442,14 +6454,8 @@ Parser<ParseHandler>::statement(YieldHandling yieldHandling, bool canHaveDirecti
return blockStatement(yieldHandling);
// VariableStatement[?Yield]
case TOK_VAR: {
Node pn = declarationList(yieldHandling, PNK_VAR);
if (!pn)
return null();
if (!MatchOrInsertSemicolonAfterExpression(tokenStream))
return null();
return pn;
}
case TOK_VAR:
return variableStatement(yieldHandling);
// EmptyStatement
case TOK_SEMI:

Просмотреть файл

@ -1046,6 +1046,8 @@ class Parser final : private JS::AutoGCRooter, public StrictModeGetter
Node catchBlockStatement(YieldHandling yieldHandling, HandlePropertyName simpleCatchParam);
Node debuggerStatement();
Node variableStatement(YieldHandling yieldHandling);
Node lexicalDeclaration(YieldHandling yieldHandling, bool isConst);
Node importDeclaration();
Node exportDeclaration();