Add duplicated argument check for function rest parameter (#2740)
Also add a missing word from `PARSER_ERR_FORMAL_PARAM_AFTER_REST_PARAMETER` error message. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
committed by
László Langó
parent
1ff322b72f
commit
ca8442c523
@@ -2191,6 +2191,12 @@ parser_parse_function_arguments (parser_context_t *context_p, /**< context */
|
||||
else if (context_p->token.type == LEXER_THREE_DOTS)
|
||||
{
|
||||
lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL);
|
||||
|
||||
if (context_p->literal_count == literal_count)
|
||||
{
|
||||
parser_raise_error (context_p, PARSER_ERR_DUPLICATED_ARGUMENT_NAMES);
|
||||
}
|
||||
|
||||
context_p->status_flags |= PARSER_FUNCTION_HAS_REST_PARAM;
|
||||
}
|
||||
#endif /* !CONFIG_DISABLE_ES2015_FUNCTION_REST_PARAMETER */
|
||||
|
||||
Reference in New Issue
Block a user