LibJS: Fix computed property ending token in binding pattern parsing

The syntax is supposed to be '[expression]', not '[expression['.
This commit is contained in:
Ali Mohammad Pur 2021-07-11 14:49:42 +04:30 committed by Linus Groh
parent b5b84029ab
commit 7dae25eceb
Notes: sideshowbarker 2024-07-18 09:15:45 +09:00

View file

@ -1635,7 +1635,7 @@ RefPtr<BindingPattern> Parser::parse_binding_pattern()
} else if (match(TokenType::BracketOpen)) {
consume();
name = parse_expression(0);
consume(TokenType::BracketOpen);
consume(TokenType::BracketClose);
} else {
syntax_error("Expected identifier or computed property name");
return {};