ronantakizawa/codereview-bench huggingface dataset:
Repository: jaytaph/gosub-browser
File: src/bin/gosub-parser.rs (Rust)

Code before:
use anyhow::bail;
use gosub_html5::parser::document::{Document, DocumentBuilder};
use gosub_html5::parser::Html5Parser;
use gosub_shared::bytes::{CharIterator, Confidence, Encoding};
use gosub_shared::types::Result;
use std::fs;

fn main() -> Result<()> {
    let matches = clap::Command::new("Gosub parser")
        .version("0.1.0")
        .arg(
            clap::Arg::new("url")
                .help("The url or file to parse")
                .required(true)
                .index(1),
        )
        .get_matches();

    let url: String = matches.get_one::<String>("url").expect("url").to_string();

    let html = if url.starts_with("http://") || url.starts_with("https://") {
        // Fetch the html from the url
        let response = ureq::get(&url).call()?;
        if response.status() != 200 {
            bail!("Could not get url. Status code {}", response.status());
        }
        response.into_string()?
    } else {
        // Get html from the file
        fs::read_to_string(&url)?
    };

    let mut chars = CharIterator::new();
    chars.read_from_str(&html, Some(Encoding::UTF8));
    chars.set_confidence(Confidence::Certain);

    // If the encoding confidence is not Confidence::Certain, we should detect the encoding.
    if !chars.is_certain_encoding() {
        chars.detect_encoding();
    }

    let document = DocumentBuilder::new_document();
    let parse_errors = Html5Parser::parse_document(&mut chars, Document::clone(&document), None)?;


Review comment (suggestion):
I'd probably use `.ok_or("missing url")?` here instead of `.expect` since it fits the `-> Result<()>` main function better.

Code after:
use anyhow::bail;
use gosub_html5::parser::document::{Document, DocumentBuilder};
use gosub_html5::parser::Html5Parser;
use gosub_shared::bytes::{CharIterator, Confidence, Encoding};
use gosub_shared::types::Result;
use std::fs;

fn main() -> Result<()> {
    let matches = clap::Command::new("Gosub parser")
        .version("0.1.0")
        .arg(
            clap::Arg::new("url")
                .help("The url or file to parse")
                .required(true)
                .index(1),
        )
        .get_matches();

    let url = matches
        .get_one::<String>("url")
        .ok_or("Missing url")
        .unwrap()
        .to_string();

    let html = if url.starts_with("http://") || url.starts_with("https://") {
        // Fetch the html from the url
        let response = ureq::get(&url).call()?;
        if response.status() != 200 {
            bail!("Could not get url. Status code {}", response.status());
        }
        response.into_string()?
    } else {
        // Get html from the file
        fs::read_to_string(&url)?
    };

    let mut chars = CharIterator::new();
    chars.read_from_str(&html, Some(Encoding::UTF8));
    chars.set_confidence(Confidence::Certain);

    // If the encoding confidence is not Confidence::Certain, we should detect the encoding.
    if !chars.is_certain_encoding() {
        chars.detect_encoding();
    }
Repository: jdepoix/youtube-transcript-api
File: youtube_transcript_api/__main__.py (Python)

Code before:
    parser.add_argument(
        '--json',
        action='store_const',
        const=True,
        default=False,
        help='If this flag is set the output will be JSON formatted.',
    )
    parser.add_argument(
        '--http-proxy', dest='http_proxy',
        default=None, metavar='URL',
        help='Use the specified HTTP proxy.'
    )
    parser.add_argument(
        '--https-proxy', dest='https_proxy',
        default=None, metavar='URL',
        help='Use the specified HTTPS proxy.'
    )
    return parser.parse_args(args)


def main():
    logging.basicConfig()

    parsed_args = parse_args(sys.argv[1:])

    proxies = {"http": parsed_args.http_proxy or "", "https": parsed_args.https_proxy or ""}

    transcripts, _ = YouTubeTranscriptApi.get_transcripts(
        parsed_args.video_ids,
        languages=parsed_args.languages,
        continue_after_error=True,
        proxies=proxies
    )

    if parsed_args.json:
        print(json.dumps(transcripts))
    else:
        pprint(transcripts)


if __name__ == '__main__':
    main()


Review comment (suggestion):
Sorry, I just noticed this. But proxies has to be `None` if neither `parsed_args.http_proxy` nor `parsed_args.https_proxy` are set. Otherwise the `proxies` dict with both empty strings will be used.

Code after:
import sys

import logging

from ._cli import YouTubeTranscriptCli


def main():
    logging.basicConfig()

    print(YouTubeTranscriptCli(sys.argv[1:]).run())


if __name__ == '__main__':
    main()
Repository: jdepoix/youtube-transcript-api
File: youtube_transcript_api/__main__.py (Python)

Code before:
            'other selenium based solutions do!'
        )
    )
    parser.add_argument('video_ids', nargs='*', type=str, help='List of YouTube video IDs.')
    parser.add_argument(
        '--languages',
        nargs='*',
        default=[],
        type=str,
        help=(
            'A list of language codes in a descending priority. For example, if this is set to "de en" it will first '
            'try to fetch the german transcript (de) and then fetch the english transcipt (en) if it fails to do so. '
            'As I can\'t provide a complete list of all working language codes with full certainty, you may have to '
            'play around with the language codes a bit, to find the one which is working for you!'
        ),
    )
    parser.add_argument(
        '--json',
        action='store_const',
        const=True,
        default=False,
        help='If this flag is set the output will be JSON formatted.',
    )
    parser.add_argument(
        '--http-proxy', dest='http_proxy',
        default=None, metavar='URL',
        help='Use the specified HTTP proxy.'
    )
    parser.add_argument(
        '--https-proxy', dest='https_proxy',
        default=None, metavar='URL',
        help='Use the specified HTTPS proxy.'
    )
    return parser.parse_args(args)


def main():
    logging.basicConfig()

    parsed_args = parse_args(sys.argv[1:])

    proxies = {"http": parsed_args.http_proxy or "", "https": parsed_args.https_proxy or ""}

    transcripts, _ = YouTubeTranscriptApi.get_transcripts(
        parsed_args.video_ids,
        languages=parsed_args.languages,
        continue_after_error=True,
        proxies=proxies
    )

    if parsed_args.json:

Review comment (suggestion):
if you use `default=''` here, you won't have to do the conditional assignment in `proxies = {"http": parsed_args.http_proxy or "", "https": parsed_args.https_proxy or ""}`

Code after:
import sys

import logging

from ._cli import YouTubeTranscriptCli


def main():
    logging.basicConfig()

    print(YouTubeTranscriptCli(sys.argv[1:]).run())


if __name__ == '__main__':
    main()
Repository: jerryscript-project/jerryscript
File: jerry-core/vm/vm.c (C)

Code before:

/**
 * Run specified eval-mode bytecode
 *
 * @return ecma value
 */
ecma_value_t
vm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */
             uint32_t parse_opts) /**< ecma_parse_opts_t option bits */
{
  ecma_value_t this_binding;
  ecma_object_t *lex_env_p;

  /* ECMA-262 v5, 10.4.2 */
  if (parse_opts & ECMA_PARSE_DIRECT_EVAL)
  {
    this_binding = ecma_copy_value (JERRY_CONTEXT (vm_top_context_p)->this_binding);
    lex_env_p = JERRY_CONTEXT (vm_top_context_p)->lex_env_p;

#ifdef JERRY_DEBUGGER
    ecma_object_t *global_env_p = ecma_get_global_environment ();
    uint32_t chain_index = parse_opts >> ECMA_PARSE_CHAIN_INDEX_SHIFT;

    while (chain_index != 0)
    {
      if (JERRY_UNLIKELY (lex_env_p == global_env_p))
      {
        return ecma_raise_range_error (ECMA_ERR_MSG ("The given chain index is too high"));
      }

      lex_env_p = ecma_get_lex_env_outer_reference (lex_env_p);

      if ((ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND)
          || (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE))
      {
        chain_index--;
      }
    }
#endif
  }
  else
  {
    this_binding = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL));
    lex_env_p = ecma_get_global_environment ();
  }

  ecma_ref_object (lex_env_p);

  if ((bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE) != 0)
  {
    ecma_object_t *strict_lex_env_p = ecma_create_decl_lex_env (lex_env_p);

Review comment (suggestion):
What about `if (JERRY_UNLIKELY (lex_env_p == NULL))`

Code after:

/**
 * Run specified eval-mode bytecode
 *
 * @return ecma value
 */
ecma_value_t
vm_run_eval (ecma_compiled_code_t *bytecode_data_p, /**< byte-code data */
             uint32_t parse_opts) /**< ecma_parse_opts_t option bits */
{
  ecma_value_t this_binding;
  ecma_object_t *lex_env_p;

  /* ECMA-262 v5, 10.4.2 */
  if (parse_opts & ECMA_PARSE_DIRECT_EVAL)
  {
    this_binding = ecma_copy_value (JERRY_CONTEXT (vm_top_context_p)->this_binding);
    lex_env_p = JERRY_CONTEXT (vm_top_context_p)->lex_env_p;

#ifdef JERRY_DEBUGGER
    uint32_t chain_index = parse_opts >> ECMA_PARSE_CHAIN_INDEX_SHIFT;

    while (chain_index != 0)
    {
      lex_env_p = ecma_get_lex_env_outer_reference (lex_env_p);

      if (JERRY_UNLIKELY (lex_env_p == NULL))
      {
        return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid scope chain index for eval"));
      }

      if ((ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_THIS_OBJECT_BOUND)
          || (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE))
      {
        chain_index--;
      }
    }
#endif
  }
  else
  {
    this_binding = ecma_make_object_value (ecma_builtin_get (ECMA_BUILTIN_ID_GLOBAL));
    lex_env_p = ecma_get_global_environment ();
  }

  ecma_ref_object (lex_env_p);

  if ((bytecode_data_p->status_flags & CBC_CODE_FLAGS_STRICT_MODE) != 0)
  {
    ecma_object_t *strict_lex_env_p = ecma_create_decl_lex_env (lex_env_p);
    ecma_deref_object (lex_env_p);
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/base/ecma-globals.h (C/C++)

Code before:
 *
 * See also: 6.1.5.1
 */
#define ECMA_GLOBAL_SYMBOL_FLAG 0x01

/**
 * Bitshift index for indicating whether the symbol is a well known symbol
 *
 * See also: 6.1.5.1
 */
#define ECMA_GLOBAL_SYMBOL_SHIFT 1

/**
 * Bitshift index for the symbol hash property
 */
#define ECMA_SYMBOL_HASH_SHIFT 2

#if (JERRY_STACK_LIMIT != 0)
/**
 * Check the current stack usage by calculating the difference from the initial stack base.
 * If the limit is reached a RangeError is raised.
 */
#define ECMA_CHECK_STACK_USAGE() \
do \
{ \
  volatile int __sp; \
  if ((JERRY_CONTEXT (stack_base) - (uintptr_t)&__sp) > CONFIG_MEM_STACK_LIMIT) \
  { \
    return ecma_raise_range_error (ECMA_ERR_MSG ("Maximum call stack size exceeded.")); \
  } \
} while (0)
#else /* JERRY_STACK_LIMIT == 0) */
/**
 * If the stack limit is unlimited, this check is an empty macro.
 */
#define ECMA_CHECK_STACK_USAGE()
#endif /* (JERRY_STACK_LIMIT != 0) */

/**
 * @}
 * @}
 */

#endif  /* !ECMA_GLOBALS_H */


Review comment (performance):
My concern is that stack space will be allocated for this variable, and it will remain on the stack during the entire call chain, potentially adding up. I would consider moving this to a noinline function, and get the address from there, so that it gets freed immediately. I'd rather have a slight performance penalty than a slight increase in stack usage. What do you think?

Code after:
 * Flag for indicating whether the symbol is a well known symbol
 *
 * See also: 6.1.5.1
 */
#define ECMA_GLOBAL_SYMBOL_FLAG 0x01

/**
 * Bitshift index for indicating whether the symbol is a well known symbol
 *
 * See also: 6.1.5.1
 */
#define ECMA_GLOBAL_SYMBOL_SHIFT 1

/**
 * Bitshift index for the symbol hash property
 */
#define ECMA_SYMBOL_HASH_SHIFT 2

#if (JERRY_STACK_LIMIT != 0)
/**
 * Check the current stack usage. If the limit is reached a RangeError is raised.
 */
#define ECMA_CHECK_STACK_USAGE() \
do \
{ \
  if (ecma_get_current_stack_usage () > CONFIG_MEM_STACK_LIMIT) \
  { \
    return ecma_raise_range_error (ECMA_ERR_MSG ("Maximum call stack size exceeded.")); \
  } \
} while (0)
#else /* JERRY_STACK_LIMIT == 0) */
/**
 * If the stack limit is unlimited, this check is an empty macro.
 */
#define ECMA_CHECK_STACK_USAGE()
#endif /* (JERRY_STACK_LIMIT != 0) */

/**
 * @}
 * @}
 */

#endif  /* !ECMA_GLOBALS_H */
Repository: jerryscript-project/jerryscript
File: jerry-core/parser/js/js-parser-expr.c (C)

Code before:
  bool pushed_spread_element = false;
#endif /* ENABLED (JERRY_ES2015) */

  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_SQUARE);

  parser_emit_cbc (context_p, CBC_CREATE_ARRAY);
  lexer_next_token (context_p);

  while (true)
  {
    if (context_p->token.type == LEXER_RIGHT_SQUARE)
    {
      if (pushed_items > 0)
      {
#if ENABLED (JERRY_ES2015)
        if (pushed_spread_element)
        {
          parser_emit_cbc_call (context_p, PARSER_TO_EXT_OPCODE (CBC_EXT_SPREAD_ARRAY_APPEND), pushed_items);
        }
        else
        {
#endif /* ENABLED (JERRY_ES2015) */
          parser_emit_cbc_call (context_p, CBC_ARRAY_APPEND, pushed_items);
#if ENABLED (JERRY_ES2015)
        }
#endif /* ENABLED (JERRY_ES2015) */
      }
      return;
    }

    pushed_items++;

    if (context_p->token.type == LEXER_COMMA)
    {
      parser_emit_cbc (context_p, CBC_PUSH_ELISION);
      lexer_next_token (context_p);
    }
    else
    {
#if ENABLED (JERRY_ES2015)
      bool is_spread = false;
      if (context_p->token.type == LEXER_THREE_DOTS)
      {
        pushed_spread_element = true;
        is_spread = true;
        lexer_next_token (context_p);
      }
#endif /* ENABLED (JERRY_ES2015) */

      parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);


Review comment (suggestion):
These #if guards are a bit awkward.  What if we do this?:
```c
#if ENABLED(..)
if (pushed_spread_element)
{
   ... 
   return;
}
#endif

parser_emit_cbc_call (....)
```

Code after:

  JERRY_ASSERT (context_p->token.type == LEXER_LEFT_SQUARE);

  parser_emit_cbc (context_p, CBC_CREATE_ARRAY);
  lexer_next_token (context_p);

  while (true)
  {
    if (context_p->token.type == LEXER_RIGHT_SQUARE)
    {
      if (pushed_items > 0)
      {
        parser_emit_cbc_call (context_p, opcode, pushed_items);
      }
      return;
    }

    pushed_items++;

    if (context_p->token.type == LEXER_COMMA)
    {
      parser_emit_cbc (context_p, CBC_PUSH_ELISION);
      lexer_next_token (context_p);
    }
    else
    {
#if ENABLED (JERRY_ES2015)
      bool is_spread = false;
      if (context_p->token.type == LEXER_THREE_DOTS)
      {
        opcode = (uint16_t) (PARSER_TO_EXT_OPCODE (CBC_EXT_SPREAD_ARRAY_APPEND));
        is_spread = true;
        lexer_next_token (context_p);
      }
#endif /* ENABLED (JERRY_ES2015) */

      parser_parse_expression (context_p, PARSE_EXPR_NO_COMMA);

#if ENABLED (JERRY_ES2015)
      if (is_spread)
      {
        parser_emit_cbc_ext (context_p, CBC_EXT_CREATE_SPREAD_OBJECT);
      }
#endif /* ENABLED (JERRY_ES2015) */

      if (context_p->token.type == LEXER_COMMA)
      {
        lexer_next_token (context_p);
      }
      else if (context_p->token.type != LEXER_RIGHT_SQUARE)
      {
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/operations/ecma-objects-general.c (C)

Code before:
         && desc_p->get_p != current_p->get_p)
    {
      return false;
    }
  }

  return true;
} /* ecma_op_is_compatible_property_descriptor */

/**
  * CompletePropertyDescriptor method for proxy internal method
  *
  * See also:
  *          ECMA-262 v6, 6.2.4.5
  */
 void
 ecma_op_to_complete_property_descriptor (ecma_property_descriptor_t *desc_p)
 {
  /* 4. */
  if (!(desc_p->flags & (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED)))
  {
    /* a. */
    if (!(desc_p->flags & ECMA_PROP_IS_VALUE_DEFINED))
    {
      JERRY_ASSERT (desc_p->value == ECMA_VALUE_UNDEFINED);
      desc_p->flags |= ECMA_PROP_IS_VALUE_DEFINED;
    }
  }
  /* 5. */
  else
  {
    /* a. */
    if (!(desc_p->flags & ECMA_PROP_IS_GET_DEFINED))
    {
      JERRY_ASSERT (desc_p->get_p == NULL);
      desc_p->flags |= ECMA_PROP_IS_GET_DEFINED;
    }
    /* b. */
    if (!(desc_p->flags & ECMA_PROP_IS_SET_DEFINED))
    {
      JERRY_ASSERT (desc_p->set_p == NULL);
      desc_p->flags |= ECMA_PROP_IS_SET_DEFINED;
    }
  }
} /* ecma_op_to_complete_property_descriptor */
#endif /* ENABLED (JERRY_ES2015) */

/**
 * @}
 * @}
 */

Review comment (suggestion):
The whole if can be removed only

`desc_p->flags |= ECMA_PROP_IS_VALUE_DEFINED` is enough, since if the flag is not present it will be applied, otherwise if it is present still remains present.

Code after:
         && desc_p->get_p != current_p->get_p)
    {
      return false;
    }
  }

  return true;
} /* ecma_op_is_compatible_property_descriptor */

/**
 * CompletePropertyDescriptor method for proxy internal method
 *
 * See also:
 *          ECMA-262 v6, 6.2.4.5
 */
void
ecma_op_to_complete_property_descriptor (ecma_property_descriptor_t *desc_p) /**< target descriptor */
{
  /* 4. */
  if (!(desc_p->flags & (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED)))
  {
    /* a. */
    desc_p->flags |= ECMA_PROP_IS_VALUE_DEFINED;
  }
  /* 5. */
  else
  {
    desc_p->flags |= (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED);
  }
} /* ecma_op_to_complete_property_descriptor */
#endif /* ENABLED (JERRY_ES2015) */

/**
 * @}
 * @}
 */
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c (C)

Code before:
#include "ecma-builtins.h"
#include "ecma-container-object.h"
#include "ecma-array-object.h"
#include "ecma-gc.h"
#include "lit-char-helpers.h"

#if ENABLED (JERRY_ES2015)

#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"

/**
 * This object has a custom dispatch function.
 */
#define BUILTIN_CUSTOM_DISPATCH

/**
 * List of built-in routine identifiers.
 */
enum
{
  ECMA_INTRINSIC_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
  ECMA_INTRINSIC_PARSE_FLOAT,
  ECMA_INTRINSIC_PARSE_INT,
  ECMA_INTRINSIC_ARRAY_PROTOTYPE_VALUES,
  ECMA_INTRINSIC_SET_PROTOTYPE_VALUES
};

#define BUILTIN_INC_HEADER_NAME "ecma-builtin-intrinsic.inc.h"
#define BUILTIN_UNDERSCORED_ID intrinsic
#include "ecma-builtin-internal-routines-template.inc.h"

/** \addtogroup ecma ECMA
 * @{
 *
 * \addtogroup ecmabuiltins
 * @{
 *
 * \addtogroup intrinsic ECMA Intrinsic object built-in
 * @{
 */

/**
 * The %ArrayProto_values% intrinsic routine
 *
 * See also:
 *          ECMA-262 v5, 15.4.4.4
 *
 * @return ecma value
 *         Returned value must be freed with ecma_free_value.
 */

Review comment (suggestion):
Since a set stores keys I'd call it `ECMA_INTRINSIC_SET_PROTOTYPE_SET`

Code after:
#include "ecma-builtins.h"
#include "ecma-container-object.h"
#include "ecma-array-object.h"
#include "ecma-gc.h"
#include "lit-char-helpers.h"

#if ENABLED (JERRY_ESNEXT)

#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"

/**
 * This object has a custom dispatch function.
 */
#define BUILTIN_CUSTOM_DISPATCH

/**
 * List of built-in routine identifiers.
 */
enum
{
  ECMA_INTRINSIC_ROUTINE_START = ECMA_BUILTIN_ID__COUNT - 1,
  ECMA_INTRINSIC_PARSE_FLOAT,
  ECMA_INTRINSIC_PARSE_INT,
  ECMA_INTRINSIC_ARRAY_PROTOTYPE_VALUES,
  ECMA_INTRINSIC_SET_PROTOTYPE_KEYS
};

#define BUILTIN_INC_HEADER_NAME "ecma-builtin-intrinsic.inc.h"
#define BUILTIN_UNDERSCORED_ID intrinsic
#include "ecma-builtin-internal-routines-template.inc.h"

/** \addtogroup ecma ECMA
 * @{
 *
 * \addtogroup ecmabuiltins
 * @{
 *
 * \addtogroup intrinsic ECMA Intrinsic object built-in
 * @{
 */

/**
 * The %ArrayProto_values% intrinsic routine
 *
 * See also:
 *          ECMA-262 v5, 15.4.4.4
 *
 * @return ecma value
 *         Returned value must be freed with ecma_free_value.
 */
Repository: jerryscript-project/jerryscript
File: jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c (C)

Code before:
                                                ecma_value_t return_arg) /**< return argument */
{
  return ecma_builtin_generator_prototype_object_do (this_arg, return_arg, ECMA_ITERATOR_RETURN);
} /* ecma_builtin_generator_prototype_object_return */

/**
 * The Generator.prototype object's 'throw' routine
 *
 * See also:
 *          ECMA-262 v6, 25.3.1.4
 *
 * @return ecma value
 *         Returned value must be freed with ecma_free_value.
 */
static ecma_value_t
ecma_builtin_generator_prototype_object_throw (ecma_value_t this_arg, /**< this argument */
                                                ecma_value_t throw_arg) /**< throw argument */
{
  return ecma_builtin_generator_prototype_object_do (this_arg, throw_arg, ECMA_ITERATOR_THROW);
} /* ecma_builtin_generator_prototype_object_throw */

/**
 * @}
 * @}
 * @}
 */

#endif /* ENABLED (JERRY_ES2015) */


Review comment (suggestion):
Instead of JERRY_UNREACHABLE, the last case (ECMA_GENERATOR_PROTOTYPE_ROUTINE_RETURN) can be a default case, and put an assert which checks the type.

Code after:
  if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_COMPLETED)
  {
    return ecma_create_iter_result_object (ECMA_VALUE_UNDEFINED, ECMA_VALUE_TRUE);
  }

  switch (builtin_routine_id)
  {
    case ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT:
    {
      return ecma_builtin_generator_prototype_object_do (executable_object_p,
                                                         arguments_list_p[0],
                                                         ECMA_ITERATOR_NEXT);
    }
    case ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW:
    {
      return ecma_builtin_generator_prototype_object_do (executable_object_p,
                                                         arguments_list_p[0],
                                                         ECMA_ITERATOR_THROW);
    }
    case ECMA_GENERATOR_PROTOTYPE_ROUTINE_RETURN:
    {
      return ecma_builtin_generator_prototype_object_do (executable_object_p,
                                                         arguments_list_p[0],
                                                         ECMA_ITERATOR_RETURN);
    }
    default:
    {
      JERRY_UNREACHABLE ();
    }
  }

  return ECMA_VALUE_EMPTY;
} /* ecma_builtin_generator_prototype_dispatch_routine */

/**
 * @}
 * @}
 * @}
 */

#endif /* ENABLED (JERRY_ES2015) */