LibJS: Break loop on EOF when parsing object expression

This commit is contained in:
Linus Groh 2020-04-07 18:29:37 +01:00 committed by Andreas Kling
parent 19be842b5b
commit 3e677fd03d
Notes: sideshowbarker 2024-07-19 07:49:45 +09:00

View file

@ -388,7 +388,7 @@ NonnullRefPtr<ObjectExpression> Parser::parse_object_expression()
HashMap<FlyString, NonnullRefPtr<Expression>> properties;
consume(TokenType::CurlyOpen);
while (!match(TokenType::CurlyClose)) {
while (!done() && !match(TokenType::CurlyClose)) {
FlyString property_name;
if (match(TokenType::Identifier)) {
property_name = consume(TokenType::Identifier).value();