mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 883333, part 12 - Factor block parsing out of Parser::statement. r=Waldo.
--HG-- extra : rebase_source : 1af9d3df561cb5d9bc2c16c77451d070f48bccf4
This commit is contained in:
parent
ea3d94b648
commit
4b8a5826f3
@ -3327,6 +3327,25 @@ PushBlocklikeStatement(StmtInfoPC *stmt, StmtType type, ParseContext<ParseHandle
|
||||
return GenerateBlockId(pc, stmt->blockid);
|
||||
}
|
||||
|
||||
template <typename ParseHandler>
|
||||
typename ParseHandler::Node
|
||||
Parser<ParseHandler>::blockStatement()
|
||||
{
|
||||
JS_ASSERT(tokenStream.currentToken().type == TOK_LC);
|
||||
|
||||
StmtInfoPC stmtInfo(context);
|
||||
if (!PushBlocklikeStatement(&stmtInfo, STMT_BLOCK, pc))
|
||||
return null();
|
||||
|
||||
Node list = statements();
|
||||
if (!list)
|
||||
return null();
|
||||
|
||||
MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_IN_COMPOUND);
|
||||
PopStatementPC(context, pc);
|
||||
return list;
|
||||
}
|
||||
|
||||
template <typename ParseHandler>
|
||||
typename ParseHandler::Node
|
||||
Parser<ParseHandler>::newBindingNode(PropertyName *name, bool functionScope, VarContext varContext)
|
||||
@ -4799,19 +4818,7 @@ Parser<ParseHandler>::statement(bool canHaveDirectives)
|
||||
|
||||
switch (tokenStream.getToken(TSF_OPERAND)) {
|
||||
case TOK_LC:
|
||||
{
|
||||
StmtInfoPC stmtInfo(context);
|
||||
if (!PushBlocklikeStatement(&stmtInfo, STMT_BLOCK, pc))
|
||||
return null();
|
||||
|
||||
pn = statements();
|
||||
if (!pn)
|
||||
return null();
|
||||
|
||||
MUST_MATCH_TOKEN(TOK_RC, JSMSG_CURLY_IN_COMPOUND);
|
||||
PopStatementPC(context, pc);
|
||||
return pn;
|
||||
}
|
||||
return blockStatement();
|
||||
|
||||
case TOK_VAR:
|
||||
pn = variables(PNK_VAR);
|
||||
|
@ -417,6 +417,7 @@ struct Parser : private AutoGCRooter, public StrictModeGetter
|
||||
Node functionExpr();
|
||||
Node statements();
|
||||
|
||||
Node blockStatement();
|
||||
Node ifStatement();
|
||||
Node doWhileStatement();
|
||||
Node whileStatement();
|
||||
|
Loading…
Reference in New Issue
Block a user