1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 22:07:35 +00:00

LibJS: Disallow member expression in binding pattern as parameters

This commit is contained in:
davidot 2021-11-26 23:37:14 +01:00 committed by Linus Groh
parent 51e23cd043
commit 156dfe3d62
2 changed files with 17 additions and 1 deletions

View file

@ -2383,7 +2383,7 @@ Vector<FunctionNode::Parameter> Parser::parse_formal_parameters(int& function_le
Vector<FunctionNode::Parameter> parameters;
auto consume_identifier_or_binding_pattern = [&]() -> Variant<FlyString, NonnullRefPtr<BindingPattern>> {
if (auto pattern = parse_binding_pattern(AllowDuplicates::No, AllowMemberExpressions::Yes))
if (auto pattern = parse_binding_pattern(AllowDuplicates::No, AllowMemberExpressions::No))
return pattern.release_nonnull();
auto token = consume_identifier();
@ -2635,6 +2635,8 @@ RefPtr<BindingPattern> Parser::parse_binding_pattern(Parser::AllowDuplicates all
return {};
}
consume();
} else if (is_object && !match(TokenType::CurlyClose)) {
consume(TokenType::Comma);
}
}