Replace vera++ with clang-format (#4518)
JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik robert.fancsik@h-lab.eu
This commit is contained in:
@@ -13,27 +13,29 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-objects.h"
|
||||
|
||||
#include "ecma-arguments-object.h"
|
||||
#include "ecma-array-object.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-bigint.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-lex-env.h"
|
||||
#include "ecma-lcache.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-arguments-object.h"
|
||||
#include "ecma-lex-env.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
#include "ecma-bigint.h"
|
||||
#include "ecma-string-object.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -54,8 +56,7 @@
|
||||
* @param type object's implementation-defined type
|
||||
*/
|
||||
#ifndef JERRY_NDEBUG
|
||||
#define JERRY_ASSERT_OBJECT_TYPE_IS_VALID(type) \
|
||||
JERRY_ASSERT (type < ECMA_OBJECT_TYPE__MAX);
|
||||
#define JERRY_ASSERT_OBJECT_TYPE_IS_VALID(type) JERRY_ASSERT (type < ECMA_OBJECT_TYPE__MAX);
|
||||
#else /* JERRY_NDEBUG */
|
||||
#define JERRY_ASSERT_OBJECT_TYPE_IS_VALID(type)
|
||||
#endif /* !JERRY_NDEBUG */
|
||||
@@ -75,14 +76,12 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
|
||||
ecma_property_ref_t *property_ref_p, /**< property reference */
|
||||
uint32_t options) /**< option bits */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL
|
||||
&& !ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
JERRY_ASSERT (property_name_p != NULL);
|
||||
JERRY_ASSERT (options == ECMA_PROPERTY_GET_NO_OPTIONS
|
||||
|| property_ref_p != NULL);
|
||||
JERRY_ASSERT (options == ECMA_PROPERTY_GET_NO_OPTIONS || property_ref_p != NULL);
|
||||
|
||||
ecma_object_base_type_t base_type = ecma_get_object_base_type (object_p);
|
||||
|
||||
@@ -407,9 +406,7 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
|
||||
|
||||
ecma_value_t binding_value = ecma_op_get_binding_value (lex_env_p, name_p, true);
|
||||
|
||||
ecma_named_data_property_assign_value (object_p,
|
||||
ECMA_PROPERTY_VALUE_PTR (property_p),
|
||||
binding_value);
|
||||
ecma_named_data_property_assign_value (object_p, ECMA_PROPERTY_VALUE_PTR (property_p), binding_value);
|
||||
ecma_free_value (binding_value);
|
||||
}
|
||||
}
|
||||
@@ -451,10 +448,8 @@ ecma_op_object_has_property (ecma_object_t *object_p, /**< the object */
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
/* 2 - 3. */
|
||||
ecma_property_t property = ecma_op_object_get_own_property (object_p,
|
||||
property_name_p,
|
||||
NULL,
|
||||
ECMA_PROPERTY_GET_NO_OPTIONS);
|
||||
ecma_property_t property =
|
||||
ecma_op_object_get_own_property (object_p, property_name_p, NULL, ECMA_PROPERTY_GET_NO_OPTIONS);
|
||||
|
||||
if (property != ECMA_PROPERTY_TYPE_NOT_FOUND)
|
||||
{
|
||||
@@ -465,8 +460,7 @@ ecma_op_object_has_property (ecma_object_t *object_p, /**< the object */
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP
|
||||
|| ECMA_PROPERTY_IS_FOUND (property));
|
||||
JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP || ECMA_PROPERTY_IS_FOUND (property));
|
||||
|
||||
return ecma_make_boolean_value (property != ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);
|
||||
}
|
||||
@@ -497,8 +491,7 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
|
||||
ecma_object_t *object_p, /**< target object */
|
||||
ecma_string_t *property_name_p) /**< property name */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL
|
||||
&& !ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (property_name_p != NULL);
|
||||
JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));
|
||||
|
||||
@@ -978,20 +971,11 @@ ecma_op_object_get_by_magic_id (ecma_object_t *object_p, /**< the object */
|
||||
/**
|
||||
* Descriptor string for each global symbol
|
||||
*/
|
||||
static const uint16_t ecma_global_symbol_descriptions[] =
|
||||
{
|
||||
LIT_MAGIC_STRING_ASYNC_ITERATOR,
|
||||
LIT_MAGIC_STRING_HAS_INSTANCE,
|
||||
LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE,
|
||||
LIT_MAGIC_STRING_ITERATOR,
|
||||
LIT_MAGIC_STRING_MATCH,
|
||||
LIT_MAGIC_STRING_REPLACE,
|
||||
LIT_MAGIC_STRING_SEARCH,
|
||||
LIT_MAGIC_STRING_SPECIES,
|
||||
LIT_MAGIC_STRING_SPLIT,
|
||||
LIT_MAGIC_STRING_TO_PRIMITIVE,
|
||||
LIT_MAGIC_STRING_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_UNSCOPABLES,
|
||||
static const uint16_t ecma_global_symbol_descriptions[] = {
|
||||
LIT_MAGIC_STRING_ASYNC_ITERATOR, LIT_MAGIC_STRING_HAS_INSTANCE, LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE,
|
||||
LIT_MAGIC_STRING_ITERATOR, LIT_MAGIC_STRING_MATCH, LIT_MAGIC_STRING_REPLACE,
|
||||
LIT_MAGIC_STRING_SEARCH, LIT_MAGIC_STRING_SPECIES, LIT_MAGIC_STRING_SPLIT,
|
||||
LIT_MAGIC_STRING_TO_PRIMITIVE, LIT_MAGIC_STRING_TO_STRING_TAG, LIT_MAGIC_STRING_UNSCOPABLES,
|
||||
LIT_MAGIC_STRING_MATCH_ALL,
|
||||
};
|
||||
|
||||
@@ -1047,8 +1031,7 @@ ecma_op_compare_string_to_global_symbol (ecma_string_t *string_p, /**< string to
|
||||
uint32_t symbol_index = (uint32_t) property_id - (uint32_t) LIT_GLOBAL_SYMBOL__FIRST;
|
||||
jmem_cpointer_t symbol_cp = JERRY_CONTEXT (global_symbols_cp)[symbol_index];
|
||||
|
||||
return (symbol_cp != JMEM_CP_NULL
|
||||
&& string_p == ECMA_GET_NON_NULL_POINTER (ecma_string_t, symbol_cp));
|
||||
return (symbol_cp != JMEM_CP_NULL && string_p == ECMA_GET_NON_NULL_POINTER (ecma_string_t, symbol_cp));
|
||||
} /* ecma_op_compare_string_to_global_symbol */
|
||||
|
||||
/**
|
||||
@@ -1177,10 +1160,7 @@ ecma_op_object_put_by_index (ecma_object_t *object_p, /**< the object */
|
||||
{
|
||||
if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))
|
||||
{
|
||||
return ecma_op_object_put (object_p,
|
||||
ECMA_CREATE_DIRECT_UINT32_STRING (index),
|
||||
value,
|
||||
is_throw);
|
||||
return ecma_op_object_put (object_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), value, is_throw);
|
||||
}
|
||||
|
||||
ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);
|
||||
@@ -1246,9 +1226,7 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
|
||||
|
||||
ecma_property_descriptor_t prop_desc;
|
||||
/* 5.c */
|
||||
ecma_value_t status = ecma_op_object_get_own_property_descriptor (receiver_obj_p,
|
||||
property_name_p,
|
||||
&prop_desc);
|
||||
ecma_value_t status = ecma_op_object_get_own_property_descriptor (receiver_obj_p, property_name_p, &prop_desc);
|
||||
|
||||
/* 5.d */
|
||||
if (ECMA_IS_VALUE_ERROR (status))
|
||||
@@ -1293,12 +1271,8 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
|
||||
{
|
||||
ecma_property_descriptor_t desc;
|
||||
/* Based on: ES6 9.1.9 [[Set]] 4.d.i. / ES11 9.1.9.2 OrdinarySetWithOwnDescriptor 2.c.i. */
|
||||
desc.flags = (JERRY_PROP_IS_CONFIGURABLE
|
||||
| JERRY_PROP_IS_CONFIGURABLE_DEFINED
|
||||
| JERRY_PROP_IS_ENUMERABLE
|
||||
| JERRY_PROP_IS_ENUMERABLE_DEFINED
|
||||
| JERRY_PROP_IS_WRITABLE
|
||||
| JERRY_PROP_IS_WRITABLE_DEFINED
|
||||
desc.flags = (JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE
|
||||
| JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_WRITABLE_DEFINED
|
||||
| JERRY_PROP_IS_VALUE_DEFINED);
|
||||
desc.value = value;
|
||||
ecma_value_t ret_value = ecma_proxy_object_define_own_property (receiver_obj_p, property_name_p, &desc);
|
||||
@@ -1356,8 +1330,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
ecma_value_t receiver, /**< receiver */
|
||||
bool is_throw) /**< flag that controls failure handling */
|
||||
{
|
||||
JERRY_ASSERT (object_p != NULL
|
||||
&& !ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));
|
||||
JERRY_ASSERT (property_name_p != NULL);
|
||||
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
@@ -1578,9 +1551,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
|
||||
/* There is no need for special casing arrays here because changing the
|
||||
* value of an existing property never changes the length of an array. */
|
||||
ecma_named_data_property_assign_value (object_p,
|
||||
ECMA_PROPERTY_VALUE_PTR (property_p),
|
||||
value);
|
||||
ecma_named_data_property_assign_value (object_p, ECMA_PROPERTY_VALUE_PTR (property_p), value);
|
||||
return ECMA_VALUE_TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1614,18 +1585,12 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
if (ECMA_OBJECT_IS_PROXY (proto_p))
|
||||
{
|
||||
return ecma_op_object_put_with_receiver (proto_p,
|
||||
property_name_p,
|
||||
value,
|
||||
receiver,
|
||||
is_throw);
|
||||
return ecma_op_object_put_with_receiver (proto_p, property_name_p, value, receiver, is_throw);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
ecma_property_t inherited_property = ecma_op_object_get_own_property (proto_p,
|
||||
property_name_p,
|
||||
&property_ref,
|
||||
ECMA_PROPERTY_GET_NO_OPTIONS);
|
||||
ecma_property_t inherited_property =
|
||||
ecma_op_object_get_own_property (proto_p, property_name_p, &property_ref, ECMA_PROPERTY_GET_NO_OPTIONS);
|
||||
|
||||
if (ECMA_PROPERTY_IS_FOUND (inherited_property))
|
||||
{
|
||||
@@ -1647,16 +1612,14 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
}
|
||||
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
if (create_new_property
|
||||
&& ecma_is_value_object (receiver)
|
||||
if (create_new_property && ecma_is_value_object (receiver)
|
||||
&& ECMA_OBJECT_IS_PROXY (ecma_get_object_from_value (receiver)))
|
||||
{
|
||||
return ecma_op_object_put_apply_receiver (receiver, property_name_p, value, is_throw);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
if (create_new_property
|
||||
&& ecma_op_ordinary_object_is_extensible (object_p))
|
||||
if (create_new_property && ecma_op_ordinary_object_is_extensible (object_p))
|
||||
{
|
||||
const ecma_object_base_type_t obj_base_type = ecma_get_object_base_type (object_p);
|
||||
|
||||
@@ -1674,13 +1637,11 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
|
||||
uint32_t index = ecma_string_get_array_index (property_name_p);
|
||||
|
||||
if (obj_base_type == ECMA_OBJECT_BASE_TYPE_ARRAY
|
||||
&& index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
if (obj_base_type == ECMA_OBJECT_BASE_TYPE_ARRAY && index != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
if (index < UINT32_MAX
|
||||
&& index >= ext_object_p->u.array.length)
|
||||
if (index < UINT32_MAX && index >= ext_object_p->u.array.length)
|
||||
{
|
||||
if (!ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count))
|
||||
{
|
||||
@@ -1712,10 +1673,8 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
|
||||
return ecma_raise_readonly_assignment (property_name_p, is_throw);
|
||||
}
|
||||
|
||||
ecma_value_t ret_value = ecma_op_function_call (ECMA_GET_NON_NULL_POINTER (ecma_object_t, setter_cp),
|
||||
receiver,
|
||||
&value,
|
||||
1);
|
||||
ecma_value_t ret_value =
|
||||
ecma_op_function_call (ECMA_GET_NON_NULL_POINTER (ecma_object_t, setter_cp), receiver, &value, 1);
|
||||
|
||||
if (!ECMA_IS_VALUE_ERROR (ret_value))
|
||||
{
|
||||
@@ -1742,7 +1701,8 @@ ecma_op_object_delete_by_index (ecma_object_t *obj_p, /**< the object */
|
||||
{
|
||||
if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))
|
||||
{
|
||||
return ecma_op_object_delete (obj_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), is_throw);;
|
||||
return ecma_op_object_delete (obj_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), is_throw);
|
||||
;
|
||||
}
|
||||
|
||||
ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);
|
||||
@@ -1769,8 +1729,7 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_string_t *property_name_p, /**< property name */
|
||||
bool is_strict) /**< flag that controls failure handling */
|
||||
{
|
||||
JERRY_ASSERT (obj_p != NULL
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT (property_name_p != NULL);
|
||||
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
@@ -1782,9 +1741,7 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
|
||||
JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p));
|
||||
|
||||
return ecma_op_general_object_delete (obj_p,
|
||||
property_name_p,
|
||||
is_strict);
|
||||
return ecma_op_general_object_delete (obj_p, property_name_p, is_strict);
|
||||
} /* ecma_op_object_delete */
|
||||
|
||||
/**
|
||||
@@ -1800,8 +1757,7 @@ ecma_value_t
|
||||
ecma_op_object_default_value (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_preferred_type_hint_t hint) /**< hint on preferred result type */
|
||||
{
|
||||
JERRY_ASSERT (obj_p != NULL
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p));
|
||||
|
||||
@@ -1839,8 +1795,7 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
|
||||
const ecma_property_descriptor_t *property_desc_p) /**< property
|
||||
* descriptor */
|
||||
{
|
||||
JERRY_ASSERT (obj_p != NULL
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
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);
|
||||
@@ -1918,10 +1873,8 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
|
||||
|
||||
ecma_property_ref_t property_ref;
|
||||
property_ref.virtual_value = ECMA_VALUE_EMPTY;
|
||||
ecma_property_t property = ecma_op_object_get_own_property (object_p,
|
||||
property_name_p,
|
||||
&property_ref,
|
||||
ECMA_PROPERTY_GET_VALUE);
|
||||
ecma_property_t property =
|
||||
ecma_op_object_get_own_property (object_p, property_name_p, &property_ref, ECMA_PROPERTY_GET_VALUE);
|
||||
|
||||
if (!ECMA_PROPERTY_IS_FOUND (property))
|
||||
{
|
||||
@@ -1932,14 +1885,13 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND
|
||||
|| property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);
|
||||
JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);
|
||||
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
|
||||
uint32_t flags = ecma_is_property_enumerable (property) ? JERRY_PROP_IS_ENUMERABLE : JERRY_PROP_NO_OPTS;
|
||||
flags |= ecma_is_property_configurable (property) ? JERRY_PROP_IS_CONFIGURABLE: JERRY_PROP_NO_OPTS;
|
||||
flags |= ecma_is_property_configurable (property) ? JERRY_PROP_IS_CONFIGURABLE : JERRY_PROP_NO_OPTS;
|
||||
|
||||
prop_desc_p->flags = (uint16_t) (JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE_DEFINED | flags);
|
||||
|
||||
@@ -1961,8 +1913,8 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
|
||||
}
|
||||
|
||||
prop_desc_p->flags |= (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED);
|
||||
prop_desc_p->flags = (uint16_t) (prop_desc_p->flags | (ecma_is_property_writable (property) ? JERRY_PROP_IS_WRITABLE
|
||||
: JERRY_PROP_NO_OPTS));
|
||||
prop_desc_p->flags = (uint16_t) (
|
||||
prop_desc_p->flags | (ecma_is_property_writable (property) ? JERRY_PROP_IS_WRITABLE : JERRY_PROP_NO_OPTS));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2029,8 +1981,7 @@ ecma_value_t
|
||||
ecma_op_object_has_instance (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_value_t value) /**< argument 'V' */
|
||||
{
|
||||
JERRY_ASSERT (obj_p != NULL
|
||||
&& !ecma_is_lexical_environment (obj_p));
|
||||
JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));
|
||||
|
||||
JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p));
|
||||
|
||||
@@ -2128,8 +2079,7 @@ ecma_op_object_is_prototype_of (ecma_object_t *base_p, /**< base object */
|
||||
|
||||
/* Advance up on prototype chain. */
|
||||
target_p = proto_p;
|
||||
}
|
||||
while (true);
|
||||
} while (true);
|
||||
} /* ecma_op_object_is_prototype_of */
|
||||
|
||||
/**
|
||||
@@ -2219,10 +2169,7 @@ ecma_op_object_get_enumerable_property_names (ecma_object_t *obj_p, /**< routine
|
||||
0,
|
||||
names_buffer_p[i],
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
|
||||
ecma_builtin_helper_def_prop_by_index (entry_p,
|
||||
1,
|
||||
value,
|
||||
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
|
||||
ecma_builtin_helper_def_prop_by_index (entry_p, 1, value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
|
||||
ecma_free_value (value);
|
||||
|
||||
/* 4.a.ii.2.c.iii */
|
||||
@@ -2405,7 +2352,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
|
||||
}
|
||||
|
||||
ecma_collection_t *prop_names_p = ecma_new_collection ();
|
||||
ecma_property_counter_t prop_counter = {0, 0, 0};
|
||||
ecma_property_counter_t prop_counter = { 0, 0, 0 };
|
||||
|
||||
ecma_object_list_lazy_property_names (obj_p, prop_names_p, &prop_counter, filter);
|
||||
|
||||
@@ -2440,8 +2387,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
|
||||
{
|
||||
ecma_property_t *property_p = prop_iter_p->types + i;
|
||||
|
||||
if (!ECMA_PROPERTY_IS_RAW (*property_p)
|
||||
|| (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN))
|
||||
if (!ECMA_PROPERTY_IS_RAW (*property_p) || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -2455,8 +2401,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
|
||||
continue;
|
||||
}
|
||||
|
||||
ecma_string_t *name_p = ecma_string_from_property_name (*property_p,
|
||||
prop_pair_p->names_cp[i]);
|
||||
ecma_string_t *name_p = ecma_string_from_property_name (*property_p, prop_pair_p->names_cp[i]);
|
||||
|
||||
if (ecma_string_get_array_index (name_p) != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
@@ -2518,8 +2463,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
|
||||
#if JERRY_ESNEXT
|
||||
ecma_value_t *symbol_current_p = string_current_p + symbol_named_props + prop_counter.symbol_named_props;
|
||||
|
||||
if (prop_counter.symbol_named_props > 0
|
||||
&& (array_index_named_props + string_named_props) > 0)
|
||||
if (prop_counter.symbol_named_props > 0 && (array_index_named_props + string_named_props) > 0)
|
||||
{
|
||||
memmove ((void *) string_current_p,
|
||||
(void *) (buffer_p + prop_counter.array_index_named_props + prop_counter.string_named_props),
|
||||
@@ -2527,8 +2471,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
if (prop_counter.string_named_props > 0
|
||||
&& array_index_named_props > 0)
|
||||
if (prop_counter.string_named_props > 0 && array_index_named_props > 0)
|
||||
{
|
||||
memmove ((void *) array_index_current_p,
|
||||
(void *) (buffer_p + prop_counter.array_index_named_props),
|
||||
@@ -2544,8 +2487,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
|
||||
{
|
||||
ecma_property_t *property_p = prop_iter_p->types + i;
|
||||
|
||||
if (!ECMA_PROPERTY_IS_RAW (*property_p)
|
||||
|| (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN))
|
||||
if (!ECMA_PROPERTY_IS_RAW (*property_p) || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -2559,8 +2501,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
|
||||
continue;
|
||||
}
|
||||
|
||||
ecma_string_t *name_p = ecma_string_from_property_name (*property_p,
|
||||
prop_pair_p->names_cp[i]);
|
||||
ecma_string_t *name_p = ecma_string_from_property_name (*property_p, prop_pair_p->names_cp[i]);
|
||||
|
||||
if (ecma_string_get_array_index (name_p) != ECMA_STRING_NOT_ARRAY_INDEX)
|
||||
{
|
||||
@@ -2595,8 +2536,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
|
||||
prop_iter_cp = prop_iter_p->next_property_cp;
|
||||
}
|
||||
|
||||
if (array_index_named_props > 1
|
||||
|| (array_index_named_props == 1 && prop_counter.array_index_named_props > 0))
|
||||
if (array_index_named_props > 1 || (array_index_named_props == 1 && prop_counter.array_index_named_props > 0))
|
||||
{
|
||||
uint32_t prev_value = 0;
|
||||
ecma_value_t *array_index_p = buffer_p + prop_counter.array_index_named_props;
|
||||
@@ -2619,8 +2559,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
|
||||
do
|
||||
{
|
||||
ecma_op_object_heap_sort_shift_down (buffer_p, array_props, i);
|
||||
}
|
||||
while (i-- > 0);
|
||||
} while (i-- > 0);
|
||||
|
||||
i = array_props - 1;
|
||||
|
||||
@@ -2631,15 +2570,13 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
|
||||
buffer_p[0] = tmp;
|
||||
|
||||
ecma_op_object_heap_sort_shift_down (buffer_p, i, 0);
|
||||
}
|
||||
while (--i > 0);
|
||||
} while (--i > 0);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
prev_value = value;
|
||||
}
|
||||
while (array_index_p < array_index_end_p);
|
||||
} while (array_index_p < array_index_end_p);
|
||||
}
|
||||
|
||||
return prop_names_p;
|
||||
@@ -2774,8 +2711,7 @@ ecma_builtin_is (ecma_object_t *object_p, /**< pointer to an object */
|
||||
{
|
||||
ecma_extended_object_t *built_in_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
return (built_in_object_p->u.built_in.id == builtin_id
|
||||
&& built_in_object_p->u.built_in.routine_id == 0);
|
||||
return (built_in_object_p->u.built_in.id == builtin_id && built_in_object_p->u.built_in.routine_id == 0);
|
||||
}
|
||||
case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:
|
||||
case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:
|
||||
@@ -2874,8 +2810,7 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */
|
||||
/**
|
||||
* Used by ecma_object_get_class_name to get the magic string id of class objects
|
||||
*/
|
||||
static const uint16_t ecma_class_object_magic_string_id[] =
|
||||
{
|
||||
static const uint16_t ecma_class_object_magic_string_id[] = {
|
||||
/* These objects require custom property resolving. */
|
||||
LIT_MAGIC_STRING_STRING_UL, /**< magic string id of ECMA_OBJECT_CLASS_STRING */
|
||||
LIT_MAGIC_STRING_ARGUMENTS_UL, /**< magic string id of ECMA_OBJECT_CLASS_ARGUMENTS */
|
||||
@@ -2884,9 +2819,9 @@ static const uint16_t ecma_class_object_magic_string_id[] =
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
LIT_MAGIC_STRING_MODULE_UL, /**< magic string id of ECMA_OBJECT_CLASS_MODULE_NAMESPACE */
|
||||
#endif
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
|
||||
/* These objects are marked by Garbage Collector. */
|
||||
/* These objects are marked by Garbage Collector. */
|
||||
#if JERRY_ESNEXT
|
||||
LIT_MAGIC_STRING_GENERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_GENERATOR */
|
||||
LIT_MAGIC_STRING_ASYNC_GENERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_ASYNC_GENERATOR */
|
||||
@@ -2899,7 +2834,7 @@ static const uint16_t ecma_class_object_magic_string_id[] =
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
LIT_MAGIC_STRING_MODULE_UL, /**< magic string id of ECMA_OBJECT_CLASS_MODULE */
|
||||
#endif
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
#if JERRY_ESNEXT
|
||||
LIT_MAGIC_STRING_PROMISE_UL, /**< magic string id of ECMA_OBJECT_CLASS_PROMISE */
|
||||
LIT_MAGIC_STRING_OBJECT_UL, /**< magic string id of ECMA_OBJECT_CLASS_PROMISE_CAPABILITY */
|
||||
@@ -3073,8 +3008,7 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
|
||||
}
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_GENERAL
|
||||
|| type == ECMA_OBJECT_TYPE_PROXY);
|
||||
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_GENERAL || type == ECMA_OBJECT_TYPE_PROXY);
|
||||
|
||||
return LIT_MAGIC_STRING_OBJECT_UL;
|
||||
}
|
||||
@@ -3116,8 +3050,8 @@ ecma_op_is_concat_spreadable (ecma_value_t arg) /**< argument */
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
|
||||
ecma_value_t spreadable = ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg),
|
||||
LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE);
|
||||
ecma_value_t spreadable =
|
||||
ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg), LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (spreadable))
|
||||
{
|
||||
@@ -3152,8 +3086,7 @@ ecma_op_is_regexp (ecma_value_t arg) /**< argument */
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
|
||||
ecma_value_t is_regexp = ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg),
|
||||
LIT_GLOBAL_SYMBOL_MATCH);
|
||||
ecma_value_t is_regexp = ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg), LIT_GLOBAL_SYMBOL_MATCH);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (is_regexp))
|
||||
{
|
||||
@@ -3452,10 +3385,8 @@ ecma_op_ordinary_object_has_own_property (ecma_object_t *object_p, /**< the obje
|
||||
{
|
||||
JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));
|
||||
|
||||
ecma_property_t property = ecma_op_object_get_own_property (object_p,
|
||||
property_name_p,
|
||||
NULL,
|
||||
ECMA_PROPERTY_GET_NO_OPTIONS);
|
||||
ecma_property_t property =
|
||||
ecma_op_object_get_own_property (object_p, property_name_p, NULL, ECMA_PROPERTY_GET_NO_OPTIONS);
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
if (JERRY_UNLIKELY (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_THROW))
|
||||
@@ -3464,8 +3395,7 @@ ecma_op_ordinary_object_has_own_property (ecma_object_t *object_p, /**< the obje
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
JERRY_ASSERT (ECMA_PROPERTY_IS_FOUND (property)
|
||||
|| property == ECMA_PROPERTY_TYPE_NOT_FOUND
|
||||
JERRY_ASSERT (ECMA_PROPERTY_IS_FOUND (property) || property == ECMA_PROPERTY_TYPE_NOT_FOUND
|
||||
|| property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);
|
||||
|
||||
return ecma_make_boolean_value (ECMA_PROPERTY_IS_FOUND (property));
|
||||
@@ -3530,8 +3460,8 @@ ecma_op_object_unref_weak (ecma_object_t *object_p, /**< this argument */
|
||||
ecma_property_t *property_p = ecma_find_named_property (object_p, weak_refs_string_p);
|
||||
JERRY_ASSERT (property_p != NULL);
|
||||
|
||||
ecma_collection_t *refs_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
|
||||
ECMA_PROPERTY_VALUE_PTR (property_p)->value);
|
||||
ecma_collection_t *refs_p =
|
||||
ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, ECMA_PROPERTY_VALUE_PTR (property_p)->value);
|
||||
ecma_value_t *buffer_p = refs_p->buffer_p;
|
||||
|
||||
while (true)
|
||||
|
||||
Reference in New Issue
Block a user