@@ -3304,13 +3304,9 @@ parser_parse_initializer_by_next_char (parser_context_t *context_p, /**< context
3304
3304
3305
3305
/**
3306
3306
* Process ternary expression.
3307
- *
3308
- * @return true - continue with primary expression parsing
3309
- * false - otherwise
3310
3307
*/
3311
- static bool
3312
- parser_process_ternary_expression (parser_context_t * context_p , /**< context */
3313
- size_t grouping_level ) /**< grouping level */
3308
+ static void
3309
+ parser_process_ternary_expression (parser_context_t * context_p ) /**< context */
3314
3310
{
3315
3311
JERRY_ASSERT (context_p -> token .type == LEXER_QUESTION_MARK );
3316
3312
@@ -3354,7 +3350,6 @@ parser_process_ternary_expression (parser_context_t *context_p, /**< context */
3354
3350
parser_flush_cbc (context_p );
3355
3351
3356
3352
parser_process_binary_opcodes (context_p , 0 );
3357
- return grouping_level >= PARSER_GROUPING_LEVEL_INCREASE ;
3358
3353
} /* parser_process_ternary_expression */
3359
3354
3360
3355
/**
@@ -3524,12 +3519,6 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
3524
3519
continue ;
3525
3520
}
3526
3521
3527
- if (JERRY_UNLIKELY (context_p -> token .type == LEXER_QUESTION_MARK )
3528
- && (grouping_level != PARSE_EXPR_LEFT_HAND_SIDE )
3529
- && parser_process_ternary_expression (context_p , grouping_level ))
3530
- {
3531
- continue ;
3532
- }
3533
3522
break ;
3534
3523
}
3535
3524
@@ -3538,19 +3527,29 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
3538
3527
break ;
3539
3528
}
3540
3529
3541
- if (JERRY_UNLIKELY (context_p -> token .type == LEXER_COMMA )
3542
- && (!(options & PARSE_EXPR_NO_COMMA ) || grouping_level >= PARSER_GROUPING_LEVEL_INCREASE ))
3530
+ if (JERRY_UNLIKELY (context_p -> token .type == LEXER_QUESTION_MARK ))
3543
3531
{
3544
- parser_process_expression_sequence (context_p );
3545
- continue ;
3546
- }
3532
+ parser_process_ternary_expression (context_p );
3547
3533
3548
- if (LEXER_IS_BINARY_OP_TOKEN (context_p -> token .type ))
3534
+ if (context_p -> token .type == LEXER_RIGHT_PAREN )
3535
+ {
3536
+ goto process_unary_expression ;
3537
+ }
3538
+ }
3539
+ else if (LEXER_IS_BINARY_OP_TOKEN (context_p -> token .type ))
3549
3540
{
3550
3541
parser_append_binary_token (context_p );
3551
3542
lexer_next_token (context_p );
3552
3543
continue ;
3553
3544
}
3545
+
3546
+ if (JERRY_UNLIKELY (context_p -> token .type == LEXER_COMMA )
3547
+ && (!(options & PARSE_EXPR_NO_COMMA ) || grouping_level >= PARSER_GROUPING_LEVEL_INCREASE ))
3548
+ {
3549
+ parser_process_expression_sequence (context_p );
3550
+ continue ;
3551
+ }
3552
+
3554
3553
break ;
3555
3554
}
3556
3555
0 commit comments