@@ -2476,11 +2476,6 @@ parser_append_binary_single_assignment_token (parser_context_t *context_p, /**<
24762476 assign_opcode = CBC_ASSIGN_SET_IDENT ;
24772477
24782478#if ENABLED (JERRY_ES2015 )
2479- if (pattern_flags & PARSER_PATTERN_GROUP_EXPR )
2480- {
2481- parser_stack_push_uint8 (context_p , LEXER_ASSIGN_GROUP_EXPR );
2482- }
2483-
24842479 if (!(pattern_flags & (PARSER_PATTERN_LET | PARSER_PATTERN_CONST | PARSER_PATTERN_LOCAL )))
24852480 {
24862481 if (scanner_literal_is_const_reg (context_p , literal_index ))
@@ -3389,7 +3384,7 @@ parser_process_expression_sequence (parser_context_t *context_p) /**< context */
33893384/**
33903385 * Process group expression.
33913386 */
3392- static bool
3387+ static void
33933388parser_process_group_expression (parser_context_t * context_p , /**< context */
33943389 size_t * grouping_level_p ) /**< grouping level */
33953390{
@@ -3407,21 +3402,17 @@ parser_process_group_expression (parser_context_t *context_p, /**< context */
34073402 parser_stack_pop_uint8 (context_p );
34083403 lexer_next_token (context_p );
34093404
3410- if (context_p -> token .type == LEXER_ASSIGN )
3411- {
3412- uint32_t flags = 0 ;
34133405#if ENABLED (JERRY_ES2015 )
3414- if (JERRY_UNLIKELY (token == LEXER_LEFT_PAREN ))
3415- {
3416- flags = PARSER_PATTERN_GROUP_EXPR ;
3417- }
3418- #endif /* ENABLED (JERRY_ES2015) */
3419- parser_append_binary_single_assignment_token (context_p , flags );
3420- lexer_next_token (context_p );
3421- return true;
3406+ /* Lookahead for anonymous function declaration after '=' token when the assignment base is LHS expression
3407+ with a single indentifier in it. e.g.: (a) = function () {} */
3408+ if (JERRY_UNLIKELY (context_p -> token .type == LEXER_ASSIGN
3409+ && PARSER_IS_PUSH_LITERALS_WITH_THIS (context_p -> last_cbc_opcode )
3410+ && context_p -> last_cbc .literal_type == LEXER_IDENT_LITERAL ))
3411+ {
3412+ parser_stack_push_uint8 (context_p , LEXER_ASSIGN_GROUP_EXPR );
34223413 }
3414+ #endif /* ENABLED (JERRY_ES2015) */
34233415
3424- return false;
34253416} /* parser_process_group_expression */
34263417
34273418/**
@@ -3482,7 +3473,6 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
34823473
34833474 while (true)
34843475 {
3485- parse_unary_expression :
34863476 if (parser_parse_unary_expression (context_p , & grouping_level ))
34873477 {
34883478 parser_process_binary_opcodes (context_p , 0 );
@@ -3529,10 +3519,7 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
35293519 && (context_p -> stack_top_uint8 == LEXER_LEFT_PAREN
35303520 || context_p -> stack_top_uint8 == LEXER_COMMA_SEP_LIST ))
35313521 {
3532- if (parser_process_group_expression (context_p , & grouping_level ))
3533- {
3534- goto parse_unary_expression ;
3535- }
3522+ parser_process_group_expression (context_p , & grouping_level );
35363523 continue ;
35373524 }
35383525
0 commit comments