Passing 'this' argument to built-in routines.
This commit is contained in:
@@ -285,6 +285,7 @@ ecma_builtin_global_get_routine_parameters_number (ecma_magic_string_id_t builti
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_global_dispatch_routine (ecma_magic_string_id_t builtin_routine_id, /**< Global object's
|
||||
built-in routine's name */
|
||||
ecma_value_t this_arg_value __unused, /**< 'this' argument value */
|
||||
ecma_value_t arguments_list [], /**< list of arguments passed to routine */
|
||||
ecma_length_t arguments_number) /**< length of arguments' list */
|
||||
{
|
||||
|
||||
@@ -1310,6 +1310,7 @@ ecma_builtin_math_try_to_instantiate_property (ecma_object_t *obj_p, /**< object
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_math_dispatch_routine (ecma_magic_string_id_t builtin_routine_id, /**< Object object's
|
||||
built-in routine's name */
|
||||
ecma_value_t this_arg_value __unused, /**< 'this' argument value */
|
||||
ecma_value_t arguments_list [], /**< list of arguments passed to routine */
|
||||
ecma_length_t arguments_number) /**< length of arguments' list */
|
||||
{
|
||||
|
||||
@@ -414,6 +414,7 @@ ecma_builtin_object_object_define_property (ecma_value_t arg1, /**< routine's fi
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_object_dispatch_routine (ecma_magic_string_id_t builtin_routine_id, /**< Object object's
|
||||
built-in routine's name */
|
||||
ecma_value_t this_arg_value __unused, /**< 'this' argument value */
|
||||
ecma_value_t arguments_list [], /**< list of arguments passed to routine */
|
||||
ecma_length_t arguments_number) /**< length of arguments' list */
|
||||
{
|
||||
|
||||
@@ -270,6 +270,7 @@ ecma_builtin_string_try_to_instantiate_property (ecma_object_t *obj_p, /**< obje
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_string_dispatch_routine (ecma_magic_string_id_t builtin_routine_id, /**< String object's
|
||||
built-in routine's name */
|
||||
ecma_value_t this_arg_value __unused, /**< 'this' argument value */
|
||||
ecma_value_t arguments_list [], /**< list of arguments passed to routine */
|
||||
ecma_length_t arguments_number) /**< length of arguments' list */
|
||||
{
|
||||
|
||||
@@ -55,6 +55,7 @@ extern ecma_length_t
|
||||
ecma_builtin_global_get_routine_parameters_number (ecma_magic_string_id_t routine_id);
|
||||
extern ecma_completion_value_t
|
||||
ecma_builtin_global_dispatch_routine (ecma_magic_string_id_t builtin_routine_id,
|
||||
ecma_value_t this_arg_value,
|
||||
ecma_value_t arguments_list [],
|
||||
ecma_length_t arguments_number);
|
||||
extern ecma_property_t*
|
||||
@@ -68,6 +69,7 @@ extern ecma_length_t
|
||||
ecma_builtin_object_get_routine_parameters_number (ecma_magic_string_id_t routine_id);
|
||||
extern ecma_completion_value_t
|
||||
ecma_builtin_object_dispatch_routine (ecma_magic_string_id_t builtin_routine_id,
|
||||
ecma_value_t this_arg_value,
|
||||
ecma_value_t arguments_list [],
|
||||
ecma_length_t arguments_number);
|
||||
extern ecma_property_t*
|
||||
@@ -94,6 +96,7 @@ extern ecma_length_t
|
||||
ecma_builtin_math_get_routine_parameters_number (ecma_magic_string_id_t routine_id);
|
||||
extern ecma_completion_value_t
|
||||
ecma_builtin_math_dispatch_routine (ecma_magic_string_id_t builtin_routine_id,
|
||||
ecma_value_t this_arg_value,
|
||||
ecma_value_t arguments_list [],
|
||||
ecma_length_t arguments_number);
|
||||
extern ecma_property_t*
|
||||
@@ -105,6 +108,7 @@ extern ecma_length_t
|
||||
ecma_builtin_string_get_routine_parameters_number (ecma_magic_string_id_t routine_id);
|
||||
extern ecma_completion_value_t
|
||||
ecma_builtin_string_dispatch_routine (ecma_magic_string_id_t builtin_routine_id,
|
||||
ecma_value_t this_arg_value,
|
||||
ecma_value_t arguments_list [],
|
||||
ecma_length_t arguments_number);
|
||||
extern ecma_property_t*
|
||||
|
||||
@@ -37,6 +37,7 @@ ecma_builtin_get_routine_parameters_number (ecma_builtin_id_t builtin_id,
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_dispatch_routine (ecma_builtin_id_t builtin_object_id,
|
||||
ecma_magic_string_id_t builtin_routine_id,
|
||||
ecma_value_t this_arg_value,
|
||||
ecma_value_t arguments_list [],
|
||||
ecma_length_t arguments_number);
|
||||
|
||||
@@ -307,6 +308,7 @@ ecma_builtin_make_function_object_for_routine (ecma_builtin_id_t builtin_id, /**
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
|
||||
ecma_value_t this_arg_value, /**< 'this' argument value */
|
||||
ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
ecma_length_t arguments_list_len) /**< length of the arguments list */
|
||||
{
|
||||
@@ -334,6 +336,7 @@ ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
|
||||
|
||||
return ecma_builtin_dispatch_routine (built_in_id,
|
||||
routine_id,
|
||||
this_arg_value,
|
||||
arguments_list_p,
|
||||
arguments_list_len);
|
||||
}
|
||||
@@ -550,6 +553,7 @@ static ecma_completion_value_t
|
||||
ecma_builtin_dispatch_routine (ecma_builtin_id_t builtin_object_id, /**< built-in object' identifier */
|
||||
ecma_magic_string_id_t builtin_routine_id, /**< name of the built-in object's
|
||||
routine property */
|
||||
ecma_value_t this_arg_value, /**< 'this' argument value */
|
||||
ecma_value_t arguments_list [], /**< list of arguments passed to routine */
|
||||
ecma_length_t arguments_number) /**< length of arguments' list */
|
||||
{
|
||||
@@ -558,24 +562,28 @@ ecma_builtin_dispatch_routine (ecma_builtin_id_t builtin_object_id, /**< built-i
|
||||
case ECMA_BUILTIN_ID_GLOBAL:
|
||||
{
|
||||
return ecma_builtin_global_dispatch_routine (builtin_routine_id,
|
||||
this_arg_value,
|
||||
arguments_list,
|
||||
arguments_number);
|
||||
}
|
||||
case ECMA_BUILTIN_ID_OBJECT:
|
||||
{
|
||||
return ecma_builtin_object_dispatch_routine (builtin_routine_id,
|
||||
this_arg_value,
|
||||
arguments_list,
|
||||
arguments_number);
|
||||
}
|
||||
case ECMA_BUILTIN_ID_STRING:
|
||||
{
|
||||
return ecma_builtin_string_dispatch_routine (builtin_routine_id,
|
||||
this_arg_value,
|
||||
arguments_list,
|
||||
arguments_number);
|
||||
}
|
||||
case ECMA_BUILTIN_ID_MATH:
|
||||
{
|
||||
return ecma_builtin_math_dispatch_routine (builtin_routine_id,
|
||||
this_arg_value,
|
||||
arguments_list,
|
||||
arguments_number);
|
||||
}
|
||||
@@ -603,6 +611,7 @@ ecma_builtin_dispatch_routine (ecma_builtin_id_t builtin_object_id, /**< built-i
|
||||
case ECMA_BUILTIN_ID_JSON:
|
||||
{
|
||||
JERRY_UNIMPLEMENTED_REF_UNUSED_VARS (builtin_routine_id,
|
||||
this_arg_value,
|
||||
arguments_list,
|
||||
arguments_number);
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ extern void ecma_finalize_builtins (void);
|
||||
|
||||
extern ecma_completion_value_t
|
||||
ecma_builtin_dispatch_call (ecma_object_t *obj_p,
|
||||
ecma_value_t this_arg,
|
||||
ecma_value_t *arguments_list_p,
|
||||
ecma_length_t arguments_list_len);
|
||||
extern ecma_completion_value_t
|
||||
|
||||
@@ -477,7 +477,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
{
|
||||
if (unlikely (ecma_get_object_is_builtin (func_obj_p)))
|
||||
{
|
||||
return ecma_builtin_dispatch_call (func_obj_p, arguments_list_p, arguments_list_len);
|
||||
return ecma_builtin_dispatch_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
|
||||
}
|
||||
|
||||
ecma_completion_value_t ret_value;
|
||||
@@ -550,7 +550,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
}
|
||||
else if (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION)
|
||||
{
|
||||
return ecma_builtin_dispatch_call (func_obj_p, arguments_list_p, arguments_list_len);
|
||||
return ecma_builtin_dispatch_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user