parser_restore_context (parser_context_t *context_p, /**< context */
                        parser_saved_context_t *saved_context_p) /**< target for saving the context */
{
  parser_list_free (&context_p->literal_pool);

  if (context_p->scope_stack_p != NULL)
  {
    parser_free (context_p->scope_stack_p, context_p->scope_stack_size * sizeof (parser_scope_stack_t));
  }

#if JERRY_LINE_INFO
  parser_line_info_free (context_p->line_info_p);
#endif /* JERRY_LINE_INFO */

  /* Restore private part of the context. */

  JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);

  context_p->status_flags = saved_context_p->status_flags;
  context_p->stack_depth = saved_context_p->stack_depth;
  context_p->stack_limit = saved_context_p->stack_limit;
  context_p->last_context_p = saved_context_p->prev_context_p;
  context_p->last_statement = saved_context_p->last_statement;

  context_p->argument_count = saved_context_p->argument_count;
#if JERRY_ESNEXT
  context_p->argument_length = saved_context_p->argument_length;
#endif /* JERRY_ESNEXT */
  context_p->register_count = saved_context_p->register_count;
  context_p->literal_count = saved_context_p->literal_count;

  context_p->byte_code = saved_context_p->byte_code;
  context_p->byte_code_size = saved_context_p->byte_code_size;
  context_p->literal_pool.data = saved_context_p->literal_pool_data;
  context_p->scope_stack_p = saved_context_p->scope_stack_p;
  context_p->scope_stack_size = saved_context_p->scope_stack_size;
  context_p->scope_stack_top = saved_context_p->scope_stack_top;
  context_p->scope_stack_reg_top = saved_context_p->scope_stack_reg_top;
#if JERRY_ESNEXT
  context_p->scope_stack_global_end = saved_context_p->scope_stack_global_end;
  context_p->tagged_template_literal_cp = saved_context_p->tagged_template_literal_cp;
#endif /* JERRY_ESNEXT */

#ifndef JERRY_NDEBUG
  context_p->context_stack_depth = saved_context_p->context_stack_depth;
#endif /* !JERRY_NDEBUG */

#if JERRY_LINE_INFO
  context_p->line_info_p = saved_context_p->line_info_p;
#endif /* JERRY_LINE_INFO */
} /* parser_restore_context */
parser_restore_context (parser_context_t *context_p,  
                        parser_saved_context_t *saved_context_p)  
{
  parser_list_free (&context_p->literal_pool);

  if (context_p->scope_stack_p != NULL)
  {
    parser_free (context_p->scope_stack_p, context_p->scope_stack_size * sizeof (parser_scope_stack_t));
  }

#if JERRY_LINE_INFO
  parser_line_info_free (context_p->line_info_p);
#endif  

   

  JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);

  context_p->status_flags = saved_context_p->status_flags;
  context_p->stack_depth = saved_context_p->stack_depth;
  context_p->stack_limit = saved_context_p->stack_limit;
  context_p->last_context_p = saved_context_p->prev_context_p;
  context_p->last_statement = saved_context_p->last_statement;

  context_p->argument_count = saved_context_p->argument_count;
#if JERRY_ESNEXT
  context_p->argument_length = saved_context_p->argument_length;
#endif  
  context_p->register_count = saved_context_p->register_count;
  context_p->literal_count = saved_context_p->literal_count;

  context_p->byte_code = saved_context_p->byte_code;
  context_p->byte_code_size = saved_context_p->byte_code_size;
  context_p->literal_pool.data = saved_context_p->literal_pool_data;
  context_p->scope_stack_p = saved_context_p->scope_stack_p;
  context_p->scope_stack_size = saved_context_p->scope_stack_size;
  context_p->scope_stack_top = saved_context_p->scope_stack_top;
  context_p->scope_stack_reg_top = saved_context_p->scope_stack_reg_top;
#if JERRY_ESNEXT
  context_p->scope_stack_global_end = saved_context_p->scope_stack_global_end;
  context_p->tagged_template_literal_cp = saved_context_p->tagged_template_literal_cp;
#endif  

#ifndef JERRY_NDEBUG
  context_p->context_stack_depth = saved_context_p->context_stack_depth;
#endif  

#if JERRY_LINE_INFO
  context_p->line_info_p = saved_context_p->line_info_p;
#endif  
}  