mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:28:13 +00:00
LibJS: Rest parameter in setter functions is a syntax error
This commit is contained in:
parent
6331d45a6f
commit
1e86379327
3 changed files with 7 additions and 1 deletions
|
@ -1278,7 +1278,7 @@ Vector<FunctionNode::Parameter> Parser::parse_function_parameters(int& function_
|
|||
while (match(TokenType::Identifier) || match(TokenType::TripleDot)) {
|
||||
if (parse_options & FunctionNodeParseOptions::IsGetterFunction)
|
||||
syntax_error("Getter function must have no arguments");
|
||||
if (parse_options & FunctionNodeParseOptions::IsSetterFunction && parameters.size() >= 1)
|
||||
if (parse_options & FunctionNodeParseOptions::IsSetterFunction && (parameters.size() >= 1 || match(TokenType::TripleDot)))
|
||||
syntax_error("Setter function must have one argument");
|
||||
if (match(TokenType::TripleDot)) {
|
||||
consume();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue