@@ -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
/**
@@ -3523,12 +3518,6 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
3523
3518
continue ;
3524
3519
}
3525
3520
3526
- if (JERRY_UNLIKELY (context_p -> token .type == LEXER_QUESTION_MARK )
3527
- && (grouping_level != PARSE_EXPR_LEFT_HAND_SIDE )
3528
- && parser_process_ternary_expression (context_p , grouping_level ))
3529
- {
3530
- continue ;
3531
- }
3532
3521
break ;
3533
3522
}
3534
3523
@@ -3537,19 +3526,29 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
3537
3526
break ;
3538
3527
}
3539
3528
3540
- if (JERRY_UNLIKELY (context_p -> token .type == LEXER_COMMA )
3541
- && (!(options & PARSE_EXPR_NO_COMMA ) || grouping_level >= PARSER_GROUPING_LEVEL_INCREASE ))
3529
+ if (JERRY_UNLIKELY (context_p -> token .type == LEXER_QUESTION_MARK ))
3542
3530
{
3543
- parser_process_expression_sequence (context_p );
3544
- continue ;
3545
- }
3531
+ parser_process_ternary_expression (context_p );
3546
3532
3547
- if (LEXER_IS_BINARY_OP_TOKEN (context_p -> token .type ))
3533
+ if (context_p -> token .type == LEXER_RIGHT_PAREN )
3534
+ {
3535
+ goto process_unary_expression ;
3536
+ }
3537
+ }
3538
+ else if (LEXER_IS_BINARY_OP_TOKEN (context_p -> token .type ))
3548
3539
{
3549
3540
parser_append_binary_token (context_p );
3550
3541
lexer_next_token (context_p );
3551
3542
continue ;
3552
3543
}
3544
+
3545
+ if (JERRY_UNLIKELY (context_p -> token .type == LEXER_COMMA )
3546
+ && (!(options & PARSE_EXPR_NO_COMMA ) || grouping_level >= PARSER_GROUPING_LEVEL_INCREASE ))
3547
+ {
3548
+ parser_process_expression_sequence (context_p );
3549
+ continue ;
3550
+ }
3551
+
3553
3552
break ;
3554
3553
}
3555
3554
0 commit comments