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

LibJS: Allow object properties called 'async'

This commit is contained in:
davidot 2021-11-26 16:40:27 +01:00 committed by Linus Groh
parent 450dedabd1
commit 32016d3924
2 changed files with 10 additions and 1 deletions

View file

@ -1486,7 +1486,8 @@ NonnullRefPtr<ObjectExpression> Parser::parse_object_expression()
if (match(TokenType::Async)) {
auto lookahead_token = next_token();
if (lookahead_token.type() != TokenType::ParenOpen && !lookahead_token.trivia_contains_line_terminator()) {
if (lookahead_token.type() != TokenType::ParenOpen && lookahead_token.type() != TokenType::Colon
&& !lookahead_token.trivia_contains_line_terminator()) {
consume(TokenType::Async);
function_kind = FunctionKind::Async;
}