mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:47:44 +00:00
LibJS: Parse only AssignmentExpressions in ComputedPropertyNames
The property name in an object literal can either be a literal or a computed name, in which case any AssignmentExpression can be used, we now only parse AssignmentExpression instead of the previous incorrect behaviour which allowed any Expression (Specifically, comma expressions).
This commit is contained in:
parent
8b3f8879c1
commit
0e10dec324
1 changed files with 1 additions and 1 deletions
|
@ -783,7 +783,7 @@ NonnullRefPtr<Expression> Parser::parse_property_key()
|
|||
return create_ast_node<BigIntLiteral>({ m_parser_state.m_current_token.filename(), rule_start.position(), position() }, consume().value());
|
||||
} else if (match(TokenType::BracketOpen)) {
|
||||
consume(TokenType::BracketOpen);
|
||||
auto result = parse_expression(0);
|
||||
auto result = parse_expression(2);
|
||||
consume(TokenType::BracketClose);
|
||||
return result;
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue