mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Removing ecma_op_object_has_property and ecma_op_general_object_has_property routines.
This commit is contained in:
parent
90fccc04ba
commit
557a4b6460
@ -312,7 +312,7 @@ opfunc_in (opcode_t opdata __unused, /**< operation data */
|
||||
ecma_string_t *left_value_prop_name_p = ecma_get_string_from_completion_value (str_left_value);
|
||||
ecma_object_t *right_value_obj_p = ecma_get_object_from_completion_value (right_value);
|
||||
|
||||
if (ecma_op_object_has_property (right_value_obj_p, left_value_prop_name_p))
|
||||
if (ecma_op_object_get_property (right_value_obj_p, left_value_prop_name_p) != NULL)
|
||||
{
|
||||
is_in = ECMA_SIMPLE_VALUE_TRUE;
|
||||
}
|
||||
|
||||
@ -579,7 +579,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
// 3.
|
||||
ecma_string_t *enumerable_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_ENUMERABLE);
|
||||
|
||||
if (ecma_op_object_has_property (obj_p, enumerable_magic_string_p))
|
||||
if (ecma_op_object_get_property (obj_p, enumerable_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (enumerable_prop_value,
|
||||
ecma_op_object_get (obj_p, enumerable_magic_string_p),
|
||||
@ -613,7 +613,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
// 4.
|
||||
ecma_string_t *configurable_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_CONFIGURABLE);
|
||||
|
||||
if (ecma_op_object_has_property (obj_p, configurable_magic_string_p))
|
||||
if (ecma_op_object_get_property (obj_p, configurable_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (configurable_prop_value,
|
||||
ecma_op_object_get (obj_p, configurable_magic_string_p),
|
||||
@ -648,7 +648,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
// 5.
|
||||
ecma_string_t *value_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_VALUE);
|
||||
|
||||
if (ecma_op_object_has_property (obj_p, value_magic_string_p))
|
||||
if (ecma_op_object_get_property (obj_p, value_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (value_prop_value,
|
||||
ecma_op_object_get (obj_p, value_magic_string_p),
|
||||
@ -670,7 +670,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
// 6.
|
||||
ecma_string_t *writable_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_WRITABLE);
|
||||
|
||||
if (ecma_op_object_has_property (obj_p, writable_magic_string_p))
|
||||
if (ecma_op_object_get_property (obj_p, writable_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (writable_prop_value,
|
||||
ecma_op_object_get (obj_p, writable_magic_string_p),
|
||||
@ -705,7 +705,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
// 7.
|
||||
ecma_string_t *get_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_GET);
|
||||
|
||||
if (ecma_op_object_has_property (obj_p, get_magic_string_p))
|
||||
if (ecma_op_object_get_property (obj_p, get_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (get_prop_value,
|
||||
ecma_op_object_get (obj_p, get_magic_string_p),
|
||||
@ -749,7 +749,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
|
||||
ecma_string_t *set_magic_string_p = ecma_get_magic_string (ECMA_MAGIC_STRING_SET);
|
||||
|
||||
if (ecma_op_object_has_property (obj_p, set_magic_string_p))
|
||||
if (ecma_op_object_get_property (obj_p, set_magic_string_p) != NULL)
|
||||
{
|
||||
ECMA_TRY_CATCH (set_prop_value,
|
||||
ecma_op_object_get (obj_p, set_magic_string_p),
|
||||
|
||||
@ -58,7 +58,7 @@ ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
{
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
|
||||
return ecma_op_object_has_property (binding_obj_p, name_p);
|
||||
return (ecma_op_object_get_property (binding_obj_p, name_p) != NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@ -97,8 +97,6 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
{
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
|
||||
JERRY_ASSERT(!ecma_op_object_has_property (binding_obj_p, name_p));
|
||||
|
||||
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();
|
||||
{
|
||||
prop_desc.is_value_defined = true;
|
||||
@ -278,9 +276,7 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
{
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
|
||||
bool has_prop = ecma_op_object_has_property (binding_obj_p, name_p);
|
||||
|
||||
if (!has_prop)
|
||||
if (ecma_op_object_get_property (binding_obj_p, name_p) == NULL)
|
||||
{
|
||||
if (is_strict)
|
||||
{
|
||||
|
||||
@ -433,29 +433,6 @@ ecma_op_general_object_can_put (ecma_object_t *obj_p, /**< the object */
|
||||
JERRY_UNREACHABLE();
|
||||
} /* ecma_op_general_object_can_put */
|
||||
|
||||
/**
|
||||
* [[HasProperty]] ecma general object's operation
|
||||
*
|
||||
* See also:
|
||||
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
|
||||
* ECMA-262 v5, 8.12.6
|
||||
*
|
||||
* @return true - if the object already has a property with the given property name;
|
||||
* false - otherwise.
|
||||
*/
|
||||
bool
|
||||
ecma_op_general_object_has_property (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
ecma_property_t *desc_p = ecma_op_object_get_property (obj_p, property_name_p);
|
||||
|
||||
return (desc_p != NULL);
|
||||
} /* ecma_op_general_object_has_property */
|
||||
|
||||
/**
|
||||
* [[Delete]] ecma general object's operation
|
||||
*
|
||||
|
||||
@ -41,8 +41,6 @@ extern ecma_completion_value_t ecma_op_general_object_put (ecma_object_t *obj_p,
|
||||
bool is_throw);
|
||||
extern bool ecma_op_general_object_can_put (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern bool ecma_op_general_object_has_property (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p);
|
||||
extern ecma_completion_value_t ecma_op_general_object_delete (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
bool is_throw);
|
||||
|
||||
@ -255,45 +255,6 @@ ecma_op_object_can_put (ecma_object_t *obj_p, /**< the object */
|
||||
return ecma_op_general_object_can_put (obj_p, property_name_p);
|
||||
} /* ecma_op_object_can_put */
|
||||
|
||||
/**
|
||||
* [[HasProperty]] ecma object's operation
|
||||
*
|
||||
* See also:
|
||||
* ECMA-262 v5, 8.6.2; ECMA-262 v5, Table 8
|
||||
*
|
||||
* @return true - if the object already has a property with the given property name;
|
||||
* false - otherwise.
|
||||
*/
|
||||
bool
|
||||
ecma_op_object_has_property (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT(obj_p != NULL
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT(property_name_p != NULL);
|
||||
|
||||
const ecma_object_type_t type = ecma_get_object_type (obj_p);
|
||||
JERRY_ASSERT (type < ECMA_OBJECT_TYPE__COUNT);
|
||||
|
||||
/*
|
||||
* typedef ecma_property_t* (*has_property_ptr_t) (ecma_object_t *, ecma_string_t *);
|
||||
* static const has_property_ptr_t has_property [ECMA_OBJECT_TYPE__COUNT] =
|
||||
* {
|
||||
* [ECMA_OBJECT_TYPE_GENERAL] = &ecma_op_general_object_has_property,
|
||||
* [ECMA_OBJECT_TYPE_ARRAY] = &ecma_op_general_object_has_property,
|
||||
* [ECMA_OBJECT_TYPE_FUNCTION] = &ecma_op_general_object_has_property,
|
||||
* [ECMA_OBJECT_TYPE_BOUND_FUNCTION] = &ecma_op_general_object_has_property,
|
||||
* [ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION] = &ecma_op_general_object_has_property,
|
||||
* [ECMA_OBJECT_TYPE_ARGUMENTS] = &ecma_op_general_object_has_property,
|
||||
* [ECMA_OBJECT_TYPE_STRING] = &ecma_op_general_object_has_property
|
||||
* };
|
||||
*
|
||||
* return has_property[type] (obj_p, property_name_p);
|
||||
*/
|
||||
|
||||
return ecma_op_general_object_has_property (obj_p, property_name_p);
|
||||
} /* ecma_op_object_has_property */
|
||||
|
||||
/**
|
||||
* [[Delete]] ecma object's operation
|
||||
*
|
||||
|
||||
@ -34,7 +34,6 @@ extern ecma_completion_value_t ecma_op_object_put (ecma_object_t *obj_p,
|
||||
ecma_value_t value,
|
||||
bool is_throw);
|
||||
extern bool ecma_op_object_can_put (ecma_object_t *obj_p, ecma_string_t *property_name_p);
|
||||
extern bool ecma_op_object_has_property (ecma_object_t *obj_p, ecma_string_t *property_name_p);
|
||||
extern ecma_completion_value_t ecma_op_object_delete (ecma_object_t *obj_p,
|
||||
ecma_string_t *property_name_p,
|
||||
bool is_throw);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user