Introducing ecma_is_value_{number,string,object} for checking type of ecma-value.
This commit is contained in:
@@ -59,7 +59,7 @@ ecma_builtin_array_object_is_array (ecma_value_t this_arg __unused, /**< 'this'
|
||||
{
|
||||
ecma_simple_value_t is_array = ECMA_SIMPLE_VALUE_FALSE;
|
||||
|
||||
if (arg.value_type == ECMA_TYPE_OBJECT)
|
||||
if (ecma_is_value_object (arg))
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (arg.value);
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ ecma_builtin_boolean_prototype_object_value_of (ecma_value_t this) /**< this arg
|
||||
{
|
||||
return ecma_make_normal_completion_value (this);
|
||||
}
|
||||
else if (this.value_type == ECMA_TYPE_OBJECT)
|
||||
else if (ecma_is_value_object (this))
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value);
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this) /**< this argu
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
// 2.
|
||||
if (this.value_type != ECMA_TYPE_OBJECT)
|
||||
if (!ecma_is_value_object (this))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
@@ -116,8 +116,8 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this) /**< this argu
|
||||
}
|
||||
else
|
||||
{
|
||||
JERRY_ASSERT (name_to_str_completion.u.value.value_type == ECMA_TYPE_STRING);
|
||||
JERRY_ASSERT (msg_to_str_completion.u.value.value_type == ECMA_TYPE_STRING);
|
||||
JERRY_ASSERT (ecma_is_value_string (name_to_str_completion.u.value));
|
||||
JERRY_ASSERT (ecma_is_value_string (msg_to_str_completion.u.value));
|
||||
|
||||
ecma_string_t *name_string_p = ECMA_GET_NON_NULL_POINTER (name_to_str_completion.u.value.value);
|
||||
ecma_string_t *msg_string_p = ECMA_GET_NON_NULL_POINTER (msg_to_str_completion.u.value.value);
|
||||
|
||||
@@ -60,13 +60,13 @@ ecma_builtin_number_prototype_object_to_string (ecma_value_t this, /**< this arg
|
||||
{
|
||||
ecma_number_t this_arg_number;
|
||||
|
||||
if (this.value_type == ECMA_TYPE_NUMBER)
|
||||
if (ecma_is_value_number (this))
|
||||
{
|
||||
ecma_number_t *this_arg_number_p = ECMA_GET_NON_NULL_POINTER (this.value);
|
||||
|
||||
this_arg_number = *this_arg_number_p;
|
||||
}
|
||||
else if (this.value_type == ECMA_TYPE_OBJECT)
|
||||
else if (ecma_is_value_object (this))
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value);
|
||||
|
||||
@@ -128,11 +128,11 @@ ecma_builtin_number_prototype_object_to_locale_string (ecma_value_t this) /**< t
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_number_prototype_object_value_of (ecma_value_t this) /**< this argument */
|
||||
{
|
||||
if (this.value_type == ECMA_TYPE_NUMBER)
|
||||
if (ecma_is_value_number (this))
|
||||
{
|
||||
return ecma_make_normal_completion_value (ecma_copy_value (this, true));
|
||||
}
|
||||
else if (this.value_type == ECMA_TYPE_OBJECT)
|
||||
else if (ecma_is_value_object (this))
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value);
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ ecma_builtin_object_prototype_object_to_string (ecma_value_t this) /**< this arg
|
||||
return obj_this;
|
||||
}
|
||||
|
||||
JERRY_ASSERT (obj_this.u.value.value_type == ECMA_TYPE_OBJECT);
|
||||
JERRY_ASSERT (ecma_is_value_object (obj_this.u.value));
|
||||
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (obj_this.u.value.value);
|
||||
|
||||
|
||||
@@ -313,7 +313,7 @@ ecma_builtin_object_object_define_property (ecma_value_t this_arg __unused, /**<
|
||||
{
|
||||
ecma_completion_value_t ret_value;
|
||||
|
||||
if (arg1.value_type != ECMA_TYPE_OBJECT)
|
||||
if (!ecma_is_value_object (arg1))
|
||||
{
|
||||
ret_value = ecma_make_throw_obj_completion_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
|
||||
@@ -56,11 +56,11 @@
|
||||
static ecma_completion_value_t
|
||||
ecma_builtin_string_prototype_object_to_string (ecma_value_t this) /**< this argument */
|
||||
{
|
||||
if (this.value_type == ECMA_TYPE_STRING)
|
||||
if (ecma_is_value_string (this))
|
||||
{
|
||||
return ecma_make_normal_completion_value (ecma_copy_value (this, true));
|
||||
}
|
||||
else if (this.value_type == ECMA_TYPE_OBJECT)
|
||||
else if (ecma_is_value_object (this))
|
||||
{
|
||||
ecma_object_t *obj_p = ECMA_GET_NON_NULL_POINTER (this.value);
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ ecma_builtin_string_object_from_char_code (ecma_value_t this_arg __unused, /**<
|
||||
ecma_op_to_number (args[arg_index]),
|
||||
ret_value);
|
||||
|
||||
JERRY_ASSERT (arg_num_value.u.value.value_type == ECMA_TYPE_NUMBER);
|
||||
JERRY_ASSERT (ecma_is_value_number (arg_num_value.u.value));
|
||||
ecma_number_t *arg_num_p = ECMA_GET_NON_NULL_POINTER (arg_num_value.u.value.value);
|
||||
|
||||
uint32_t uint32_char_code = ecma_number_to_uint32 (*arg_num_p);
|
||||
|
||||
Reference in New Issue
Block a user