diff options
author | Gal Horowitz <galush.horowitz@gmail.com> | 2021-06-11 18:43:28 +0300 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-06-11 17:25:14 +0100 |
commit | 0e10dec324e30ca138cc8b7b3f37c50075d0a3a0 (patch) | |
tree | 549e23698629bb20cb91f9f14d66fba1aeb079c3 /Userland/Libraries | |
parent | 8b3f8879c1f45d701033b31337000fca4330b3f9 (diff) | |
download | serenity-0e10dec324e30ca138cc8b7b3f37c50075d0a3a0.zip |
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).
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibJS/Parser.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Parser.cpp b/Userland/Libraries/LibJS/Parser.cpp index 9e6e6358b8..125640b003 100644 --- a/Userland/Libraries/LibJS/Parser.cpp +++ b/Userland/Libraries/LibJS/Parser.cpp @@ -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 { |