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

Code before:
static void
parser_check_invalid_logical_op (parser_context_t *context_p, /**< context */
                                 size_t grouping_level) /**< grouping_level */
{
  parser_stack_iterator_t iterator;
  parser_stack_iterator_init (context_p, &iterator);
  bool logical_found = (grouping_level & 2) != 0;
  bool nullish_found = false;

  while (true)
  {
    uint8_t token = parser_stack_iterator_read_uint8 (&iterator);

    if (token == LEXER_EXPRESSION_START
        || token == LEXER_LEFT_PAREN
        || !LEXER_IS_BINARY_OP_TOKEN (token))
    {
      return;
    }

    parser_stack_iterator_skip (&iterator, sizeof (uint8_t));

    if (token == LEXER_ASSIGN)
    {
      cbc_opcode_t opcode = (cbc_opcode_t) context_p->stack_top_uint8;
      parser_stack_iterator_skip (&iterator, sizeof (uint8_t));

      if (cbc_flags[opcode] & CBC_HAS_LITERAL_ARG)
      {
        parser_stack_iterator_skip (&iterator, sizeof (uint16_t));
      }

      if (JERRY_UNLIKELY (context_p->stack_top_uint8 == LEXER_ASSIGN_GROUP_EXPR
                          || context_p->stack_top_uint8 == LEXER_ASSIGN_CONST))
      {
        parser_stack_iterator_skip (&iterator, sizeof (uint8_t));
      }
    }
    else if (token == LEXER_LOGICAL_OR || token == LEXER_LOGICAL_AND)
    {
      if (nullish_found)
      {
        parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_EXPECTED);
      }

      parser_stack_iterator_skip (&iterator, sizeof (parser_branch_t));
      logical_found = true;
    }
    else if (token == LEXER_NULLISH_COALESCING)
    {
      if (logical_found)

Review comment (suggestion):
```c
cbc_opcode_t opcode = (cbc_opcode_t) parser_stack_iterator_read_uint8 (&iterator);
```

Code after:
    }
    else
    {
      context_p->last_cbc_opcode = CBC_PUSH_THIS_LITERAL;
    }
  }
#if ENABLED (JERRY_ESNEXT)
  else if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_PROP_LITERAL))
  {
    context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_SUPER_PROP_LITERAL_ASSIGNMENT_REFERENCE);
    assign_opcode = CBC_ASSIGN_SUPER;
  }
  else if (context_p->last_cbc_opcode == PARSER_TO_EXT_OPCODE (CBC_EXT_PUSH_SUPER_PROP))
  {
    context_p->last_cbc_opcode = PARSER_TO_EXT_OPCODE (CBC_EXT_SUPER_PROP_ASSIGNMENT_REFERENCE);
    assign_opcode = CBC_ASSIGN_SUPER;
  }
#endif /* ENABLED (JERRY_ESNEXT) */
  else
  {
    /* Invalid LeftHandSide expression. */ //3820, 3815
#if ENABLED (JERRY_ESNEXT)
    parser_check_invalid_new_target (context_p, CBC_ASSIGN);
    parser_raise_error (context_p, PARSER_ERR_INVALID_LHS_ASSIGNMENT);
#else /* !ENABLED (JERRY_ESNEXT) */
    parser_emit_cbc_ext (context_p, CBC_EXT_THROW_REFERENCE_ERROR);
#endif /* ENABLED (JERRY_ESNEXT) */
  }

  parser_stack_push_uint8 (context_p, assign_opcode);
  parser_stack_push_uint8 (context_p, LEXER_ASSIGN);

  return assign_opcode;
} /* parser_append_binary_single_assignment_token */

/**
 * Check for invalid logical operator and nullish chaining
 */
#if ENABLED (JERRY_ESNEXT)
static void
parser_check_invalid_logical_op (parser_context_t *context_p, /**< context */
                                 size_t grouping_level) /**< grouping_level */
{
  parser_stack_iterator_t iterator;
  parser_stack_iterator_init (context_p, &iterator);
  bool logical_found = (grouping_level & PARSER_GROUPING_LOGICAL_FOUND) != 0;
  bool nullish_found = false;

  while (true)
  {
    uint8_t token = parser_stack_iterator_read_uint8 (&iterator);