parser_raise_error (parser_context_t *context_p, /**< context */
                    parser_error_t error) /**< error code */
{
  /* Must be compatible with the scanner because
   * the lexer might throws errors during prescanning. */
  parser_saved_context_t *saved_context_p = context_p->last_context_p;

  while (saved_context_p != NULL)
  {
    parser_cbc_stream_free (&saved_context_p->byte_code);

    /* First the current literal pool is freed, and then it is replaced
     * by the literal pool coming from the saved context. Since literals
     * are not used anymore, this is a valid replacement. The last pool
     * is freed by parser_parse_source. */

    parser_free_literals (&context_p->literal_pool);
    context_p->literal_pool.data = saved_context_p->literal_pool_data;

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

    if (saved_context_p->last_statement.current_p != NULL)
    {
      parser_free_jumps (saved_context_p->last_statement);
    }

#if JERRY_ESNEXT
    if (saved_context_p->tagged_template_literal_cp != JMEM_CP_NULL)
    {
      ecma_collection_t *collection = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
                                                                       saved_context_p->tagged_template_literal_cp);
      ecma_collection_free_template_literal (collection);
    }
#endif /* JERRY_ESNEXT  */

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

    saved_context_p = saved_context_p->prev_context_p;
  }

#if JERRY_ESNEXT
  if (context_p->tagged_template_literal_cp != JMEM_CP_NULL)
  {
    ecma_collection_t *collection = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
                                                                     context_p->tagged_template_literal_cp);
    ecma_collection_free_template_literal (collection);
  }
#endif /* JERRY_ESNEXT  */

  context_p->error = error;
  PARSER_THROW (context_p->try_buffer);
  /* Should never been reached. */
  JERRY_ASSERT (0);
} /* parser_raise_error */
parser_raise_error (parser_context_t *context_p,  
                    parser_error_t error)  
{
   
  parser_saved_context_t *saved_context_p = context_p->last_context_p;

  while (saved_context_p != NULL)
  {
    parser_cbc_stream_free (&saved_context_p->byte_code);

     

    parser_free_literals (&context_p->literal_pool);
    context_p->literal_pool.data = saved_context_p->literal_pool_data;

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

    if (saved_context_p->last_statement.current_p != NULL)
    {
      parser_free_jumps (saved_context_p->last_statement);
    }

#if JERRY_ESNEXT
    if (saved_context_p->tagged_template_literal_cp != JMEM_CP_NULL)
    {
      ecma_collection_t *collection = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
                                                                       saved_context_p->tagged_template_literal_cp);
      ecma_collection_free_template_literal (collection);
    }
#endif  

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

    saved_context_p = saved_context_p->prev_context_p;
  }

#if JERRY_ESNEXT
  if (context_p->tagged_template_literal_cp != JMEM_CP_NULL)
  {
    ecma_collection_t *collection = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
                                                                     context_p->tagged_template_literal_cp);
    ecma_collection_free_template_literal (collection);
  }
#endif  

  context_p->error = error;
  PARSER_THROW (context_p->try_buffer);
   
  JERRY_ASSERT (0);
}  