mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 20:08:13 +00:00
LibJS: Disallow comma after rest parameter in formal parameters
This commit is contained in:
parent
7081fb4eb0
commit
9cb5700398
1 changed files with 1 additions and 3 deletions
|
@ -1990,11 +1990,9 @@ Vector<FunctionNode::Parameter> Parser::parse_formal_parameters(int& function_le
|
|||
syntax_error("Generator function parameter initializer cannot contain a reference to an identifier named \"yield\"");
|
||||
}
|
||||
parameters.append({ move(parameter), default_value, is_rest });
|
||||
if (match(TokenType::ParenClose))
|
||||
if (match(TokenType::ParenClose) || is_rest)
|
||||
break;
|
||||
consume(TokenType::Comma);
|
||||
if (is_rest)
|
||||
break;
|
||||
}
|
||||
if (parse_options & FunctionNodeParseOptions::IsSetterFunction && parameters.is_empty())
|
||||
syntax_error("Setter function must have one argument");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue