1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:58:13 +00:00

LibJS: Implement (no-op) debugger statement

This commit is contained in:
Linus Groh 2020-04-30 17:26:27 +01:00 committed by Andreas Kling
parent ea839861e5
commit 43c1fa9965
9 changed files with 41 additions and 1 deletions

View file

@ -253,6 +253,8 @@ NonnullRefPtr<Statement> Parser::parse_statement()
return parse_do_while_statement();
case TokenType::While:
return parse_while_statement();
case TokenType::Debugger:
return parse_debugger_statement();
default:
if (match_expression()) {
auto expr = parse_expression(0);
@ -1044,6 +1046,13 @@ NonnullRefPtr<ForStatement> Parser::parse_for_statement()
return create_ast_node<ForStatement>(move(init), move(test), move(update), move(body));
}
NonnullRefPtr<DebuggerStatement> Parser::parse_debugger_statement()
{
consume(TokenType::Debugger);
consume_or_insert_semicolon();
return create_ast_node<DebuggerStatement>();
}
bool Parser::match(TokenType type) const
{
return m_parser_state.m_current_token.type() == type;
@ -1156,7 +1165,8 @@ bool Parser::match_statement() const
|| type == TokenType::Switch
|| type == TokenType::Break
|| type == TokenType::Continue
|| type == TokenType::Var;
|| type == TokenType::Var
|| type == TokenType::Debugger;
}
bool Parser::match_identifier_name() const