Fix the initialization of let/const patterns when block context is needed. (#3320)

Also some code cuplication is removed.

JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik frobert@inf.u-szeged.hu
This commit is contained in:
Robert Fancsik
2019-11-15 14:38:14 +01:00
committed by Dániel Bátyai
parent 8eda9bc1c3
commit fca0c94002
8 changed files with 297 additions and 205 deletions
+7 -1
View File
@@ -451,7 +451,13 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
|| lexer_check_next_character (context_p, LIT_CHAR_LEFT_SQUARE))
{
lexer_next_token (context_p);
parser_parse_initializer (context_p, PARSER_PATTERN_BINDING);
parser_pattern_flags_t options = PARSER_PATTERN_BINDING;
if (declaration_type != LEXER_KEYW_VAR)
{
options |= PARSER_PATTERN_LEXICAL;
}
parser_parse_initializer (context_p, options);
}
else
{