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

LibJS: Do not parse async methods with a new line after the "async"

This was already checked in normal function expressions, but was
missing for Object Expressions.
This commit is contained in:
Idan Horowitz 2021-11-10 19:19:58 +02:00 committed by Linus Groh
parent ad5061bb7a
commit d5f637fa21
2 changed files with 2 additions and 2 deletions

View file

@ -1449,7 +1449,7 @@ NonnullRefPtr<ObjectExpression> Parser::parse_object_expression()
function_kind = FunctionKind::Generator;
} else if (match_identifier()) {
auto identifier = consume();
if (identifier.original_value() == "async" && match_property_key()) {
if (identifier.original_value() == "async" && match_property_key() && !m_state.current_token.trivia_contains_line_terminator()) {
property_type = ObjectProperty::Type::KeyValue;
property_name = parse_property_key();
function_kind = FunctionKind::Async;