mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 23:07:34 +00:00
LibJS: Avoid unnecessary lambda
Especially when it's evaluated immediately and unconditionally.
This commit is contained in:
parent
737c9f0a14
commit
db422fa499
1 changed files with 4 additions and 7 deletions
|
@ -263,7 +263,6 @@ NonnullRefPtr<Program> Parser::parse_program()
|
||||||
|
|
||||||
NonnullRefPtr<Statement> Parser::parse_statement()
|
NonnullRefPtr<Statement> Parser::parse_statement()
|
||||||
{
|
{
|
||||||
auto statement = [this]() -> NonnullRefPtr<Statement> {
|
|
||||||
switch (m_parser_state.m_current_token.type()) {
|
switch (m_parser_state.m_current_token.type()) {
|
||||||
case TokenType::Class:
|
case TokenType::Class:
|
||||||
return parse_class_declaration();
|
return parse_class_declaration();
|
||||||
|
@ -317,9 +316,7 @@ NonnullRefPtr<Statement> Parser::parse_statement()
|
||||||
expected("statement (missing switch case)");
|
expected("statement (missing switch case)");
|
||||||
consume();
|
consume();
|
||||||
return create_ast_node<ErrorStatement>();
|
return create_ast_node<ErrorStatement>();
|
||||||
} }();
|
}
|
||||||
|
|
||||||
return statement;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<FunctionExpression> Parser::try_parse_arrow_function_expression(bool expect_parens)
|
RefPtr<FunctionExpression> Parser::try_parse_arrow_function_expression(bool expect_parens)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue