Colon must be expected after computed property name in object destructuring (#3529)

This patch fixes #3527.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2020-01-20 16:49:08 +01:00
committed by Dániel Bátyai
parent 24af089643
commit 05b4bda927
2 changed files with 42 additions and 4 deletions
+8 -4
View File
@@ -2831,10 +2831,14 @@ parser_parse_object_initializer (parser_context_t *context_p, /**< context */
}
else
{
if (push_prop_opcode != CBC_EXT_INITIALIZER_PUSH_PROP
&& (context_p->token.type == LEXER_RIGHT_BRACE
|| context_p->token.type == LEXER_ASSIGN
|| context_p->token.type == LEXER_COMMA))
if (push_prop_opcode == CBC_EXT_INITIALIZER_PUSH_PROP)
{
parser_raise_error (context_p, PARSER_ERR_COLON_EXPECTED);
}
if (context_p->token.type == LEXER_RIGHT_BRACE
|| context_p->token.type == LEXER_ASSIGN
|| context_p->token.type == LEXER_COMMA)
{
parser_reparse_as_common_identifier (context_p, start_line, start_column);
lexer_next_token (context_p);