Add custom dispatcher to array-iterator-prototype (#4693)

JerryScript-DCO-1.0-Signed-off-by: Orkenyi Virag orkvi@inf.u-szeged.hu
This commit is contained in:
Virag Orkenyi 2021-07-20 11:31:25 +02:00 committed by GitHub
parent 298228abdd
commit b25b640ff5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 1 deletions

View File

@ -24,6 +24,20 @@
#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_ARRAY_ITERATOR_PROTOTYPE_ROUTINE_START = 0,
ECMA_ARRAY_ITERATOR_PROTOTYPE_OBJECT_NEXT,
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-iterator-prototype.inc.h"
#define BUILTIN_UNDERSCORED_ID array_iterator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
@ -182,6 +196,35 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t
return result;
} /* ecma_builtin_array_iterator_prototype_object_next */
/**
* Dispatcher of the built-in's routines
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
ecma_builtin_array_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in routine identifier */
ecma_value_t this_arg, /**< 'this' argument value */
const ecma_value_t arguments_list_p[], /**< list of arguments
* passed to routine */
uint32_t arguments_number) /**< length of arguments' list */
{
JERRY_UNUSED (arguments_list_p);
JERRY_UNUSED (arguments_number);
switch (builtin_routine_id)
{
case ECMA_ARRAY_ITERATOR_PROTOTYPE_OBJECT_NEXT:
{
return ecma_builtin_array_iterator_prototype_object_next (this_arg);
}
default:
{
JERRY_UNREACHABLE ();
}
}
} /* ecma_builtin_array_iterator_prototype_dispatch_routine */
/**
* @}
* @}

View File

@ -27,7 +27,7 @@ STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_NEXT, ecma_builtin_array_iterator_prototype_object_next, 0, 0)
ROUTINE (LIT_MAGIC_STRING_NEXT, ECMA_ARRAY_ITERATOR_PROTOTYPE_OBJECT_NEXT, 0, 0)
#endif /* JERRY_ESNEXT */