1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 23:12:08 +00:00

LibJS: Avoid unnecessary lambda

Especially when it's evaluated immediately and unconditionally.
This commit is contained in:
Ben Wiederhake 2020-08-29 13:25:37 +02:00 committed by Andreas Kling
parent 737c9f0a14
commit db422fa499

View file

@ -263,7 +263,6 @@ NonnullRefPtr<Program> Parser::parse_program()
NonnullRefPtr<Statement> Parser::parse_statement()
{
auto statement = [this]() -> NonnullRefPtr<Statement> {
switch (m_parser_state.m_current_token.type()) {
case TokenType::Class:
return parse_class_declaration();
@ -317,9 +316,7 @@ NonnullRefPtr<Statement> Parser::parse_statement()
expected("statement (missing switch case)");
consume();
return create_ast_node<ErrorStatement>();
} }();
return statement;
}
}
RefPtr<FunctionExpression> Parser::try_parse_arrow_function_expression(bool expect_parens)