Refactor ecma_op_check_object_coercible (#4169)

The method returns bool now instead of an ecma_value_t

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
Szilagyi Adam
2020-08-28 13:12:50 +02:00
committed by GitHub
parent e98f5342f9
commit 9589771f7a
7 changed files with 28 additions and 39 deletions
@@ -213,11 +213,9 @@ ecma_builtin_intrinsic_dispatch_routine (uint16_t builtin_routine_id, /**< built
case ECMA_INTRINSIC_STRING_TRIM_START:
case ECMA_INTRINSIC_STRING_TRIM_END:
{
ecma_value_t coercible = ecma_op_check_object_coercible (this_arg);
if (ECMA_IS_VALUE_ERROR (coercible))
if (!ecma_op_require_object_coercible (this_arg))
{
return coercible;
return ECMA_VALUE_ERROR;
}
ecma_string_t *to_str_p = ecma_op_to_string (this_arg);
@@ -182,7 +182,7 @@ ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1, /**< routine's f
ecma_value_t arg2) /**< routine's second argument */
{
/* 1., 2. */
if (ECMA_IS_VALUE_ERROR (ecma_op_check_object_coercible (arg1)))
if (!ecma_op_require_object_coercible (arg1))
{
return ECMA_VALUE_ERROR;
}
@@ -246,7 +246,7 @@ ecma_builtin_object_object_set_proto (ecma_value_t arg1, /**< routine's first ar
ecma_value_t arg2) /**< routine's second argument */
{
/* 1., 2. */
if (ECMA_IS_VALUE_ERROR (ecma_op_check_object_coercible (arg1)))
if (!ecma_op_require_object_coercible (arg1))
{
return ECMA_VALUE_ERROR;
}
@@ -1174,7 +1174,7 @@ ecma_builtin_object_object_is (ecma_value_t arg1, /**< routine's first argument
static ecma_value_t
ecma_builtin_object_from_entries (ecma_value_t iterator) /**< object's iterator */
{
JERRY_ASSERT (ecma_op_check_object_coercible (iterator));
JERRY_ASSERT (ecma_op_require_object_coercible (iterator));
/* 2 */
ecma_object_t *object_prototype_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
ecma_object_t *obj_p = ecma_create_object (object_prototype_p, 0, ECMA_OBJECT_TYPE_GENERAL);
@@ -454,12 +454,10 @@ ecma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /*
return get_flags;
}
ecma_value_t coercible = ecma_op_check_object_coercible (get_flags);
if (ECMA_IS_VALUE_ERROR (coercible))
if (!ecma_op_require_object_coercible (get_flags))
{
ecma_free_value (get_flags);
return coercible;
return ECMA_VALUE_ERROR;
}
ecma_string_t *flags = ecma_op_to_string (get_flags);
@@ -1381,11 +1379,9 @@ ecma_builtin_string_prototype_dispatch_routine (uint16_t builtin_routine_id, /**
return ecma_builtin_string_prototype_object_to_string (this_arg);
}
ecma_value_t coercible = ecma_op_check_object_coercible (this_arg);
if (ECMA_IS_VALUE_ERROR (coercible))
if (!ecma_op_require_object_coercible (this_arg))
{
return coercible;
return ECMA_VALUE_ERROR;
}
ecma_value_t arg1 = arguments_list_p[0];