Repository: jerryscript-project/jerryscript
File: jerry-core/parser/js/js-parser-expr.c (C)

Code before:

  /* Collect unary operators. */
  while (true)
  {
    /* Convert plus and minus binary operators to unary operators. */
    switch (context_p->token.type)
    {
      case LEXER_ADD:
      {
        context_p->token.type = LEXER_PLUS;
        break;
      }
      case LEXER_SUBTRACT:
      {
        context_p->token.type = LEXER_NEGATE;
        break;
      }
#if ENABLED (JERRY_ESNEXT)
      case LEXER_KEYW_AWAIT:
      {
#if ENABLED (JERRY_MODULE_SYSTEM)
        if ((context_p->global_status_flags & ECMA_PARSE_MODULE)
            && !(context_p->status_flags & PARSER_IS_ASYNC_FUNCTION))
        {
          parser_raise_error (context_p, PARSER_ERR_AWAIT_NOT_ALLOWED);
          break;
        }
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */

        if (JERRY_UNLIKELY (context_p->token.lit_location.has_escape))
        {
          parser_raise_error (context_p, PARSER_ERR_INVALID_KEYWORD);
        }
        break;
      }
#endif /* ENABLED (JERRY_ESNEXT) */
    }

    /* Bracketed expressions are primary expressions. At this
     * point their left paren is pushed onto the stack and
     * they are processed when their closing paren is reached. */
    if (context_p->token.type == LEXER_LEFT_PAREN)
    {
#if ENABLED (JERRY_ESNEXT)
      if (context_p->next_scanner_info_p->source_p == context_p->source_p)
      {
        JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);
        break;
      }
#endif /* ENABLED (JERRY_ESNEXT) */
      (*grouping_level_p) += PARSER_GROUPING_LEVEL_INCREASE;

Review comment (suggestion):
I think this break is not necessary since `parser_raise_error` uses longjump.

Code after:

  /* Collect unary operators. */
  while (true)
  {
    /* Convert plus and minus binary operators to unary operators. */
    switch (context_p->token.type)
    {
      case LEXER_ADD:
      {
        context_p->token.type = LEXER_PLUS;
        break;
      }
      case LEXER_SUBTRACT:
      {
        context_p->token.type = LEXER_NEGATE;
        break;
      }
#if ENABLED (JERRY_ESNEXT)
      case LEXER_KEYW_AWAIT:
      {
#if ENABLED (JERRY_MODULE_SYSTEM)
        if ((context_p->global_status_flags & ECMA_PARSE_MODULE)
            && !(context_p->status_flags & PARSER_IS_ASYNC_FUNCTION))
        {
          parser_raise_error (context_p, PARSER_ERR_AWAIT_NOT_ALLOWED);
        }
#endif /* ENABLED (JERRY_MODULE_SYSTEM) */

        if (JERRY_UNLIKELY (context_p->token.lit_location.has_escape))
        {
          parser_raise_error (context_p, PARSER_ERR_INVALID_KEYWORD);
        }
        break;
      }
#endif /* ENABLED (JERRY_ESNEXT) */
    }

    /* Bracketed expressions are primary expressions. At this
     * point their left paren is pushed onto the stack and
     * they are processed when their closing paren is reached. */
    if (context_p->token.type == LEXER_LEFT_PAREN)
    {
#if ENABLED (JERRY_ESNEXT)
      if (context_p->next_scanner_info_p->source_p == context_p->source_p)
      {
        JERRY_ASSERT (context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION);
        break;
      }
#endif /* ENABLED (JERRY_ESNEXT) */
      (*grouping_level_p) += PARSER_GROUPING_LEVEL_INCREASE;
      new_was_seen = false;