1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:38:10 +00:00

LibJS: Remove bad spread check in declaration parsing

This would allow assignments such as `let ...{ a } = { a: 20 }`
This commit is contained in:
Matthew Olsson 2021-06-12 09:48:23 -07:00 committed by Andreas Kling
parent 29f9a38f76
commit 10372b8118

View file

@ -1673,12 +1673,6 @@ NonnullRefPtr<VariableDeclaration> Parser::parse_variable_declaration(bool for_l
target = create_ast_node<Identifier>(
{ m_parser_state.m_current_token.filename(), rule_start.position(), position() },
consume(TokenType::Identifier).value());
} else if (match(TokenType::TripleDot)) {
consume();
if (auto pattern = parse_binding_pattern())
target = pattern.release_nonnull();
else
syntax_error("Expected a binding pattern after ... in variable declaration");
} else if (auto pattern = parse_binding_pattern()) {
target = pattern.release_nonnull();
}