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:
Robert Fancsik
2021-11-05 14:15:47 +01:00
committed by GitHub
parent bc091e1742
commit badfdf4dba
564 changed files with 10195 additions and 15090 deletions
@@ -13,22 +13,24 @@
* limitations under the License.
*/
#include "ecma-function-object.h"
#include "ecma-alloc.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtin-handlers.h"
#include "ecma-builtin-helpers.h"
#include "ecma-exceptions.h"
#include "ecma-extended-info.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-helpers.h"
#include "ecma-promise-object.h"
#include "lit-char-helpers.h"
#include "ecma-lex-env.h"
#include "ecma-objects.h"
#include "ecma-objects-general.h"
#include "ecma-objects.h"
#include "ecma-promise-object.h"
#include "ecma-proxy-object.h"
#include "ecma-symbol-object.h"
#include "jcontext.h"
#include "lit-char-helpers.h"
#include "opcodes.h"
/** \addtogroup ecma ECMA
@@ -143,8 +145,7 @@ ecma_op_object_is_callable (ecma_object_t *obj_p) /**< ecma object */
bool
ecma_op_is_callable (ecma_value_t value) /**< ecma value */
{
return (ecma_is_value_object (value)
&& ecma_op_object_is_callable (ecma_get_object_from_value (value)));
return (ecma_is_value_object (value) && ecma_op_object_is_callable (ecma_get_object_from_value (value)));
} /* ecma_op_is_callable */
/**
@@ -170,8 +171,8 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
{
ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) obj_p;
obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
bound_func_p->header.u.bound_function.target_function);
obj_p =
ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);
type = ecma_get_object_type (obj_p);
}
@@ -241,8 +242,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
}
#endif /* JERRY_BUILTIN_PROXY */
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION
|| type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION || type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION
|| type == ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION);
if (type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION)
@@ -298,8 +298,7 @@ ecma_object_is_constructor (ecma_object_t *obj_p) /**< ecma object */
bool
ecma_is_constructor (ecma_value_t value) /**< ecma value */
{
return (ecma_is_value_object (value)
&& ecma_object_is_constructor (ecma_get_object_from_value (value)));
return (ecma_is_value_object (value) && ecma_object_is_constructor (ecma_get_object_from_value (value)));
} /* ecma_is_constructor */
/**
@@ -382,9 +381,7 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
}
#endif /* JERRY_SNAPSHOT_EXEC */
ecma_object_t *func_p = ecma_create_object (prototype_obj_p,
function_object_size,
ECMA_OBJECT_TYPE_FUNCTION);
ecma_object_t *func_p = ecma_create_object (prototype_obj_p, function_object_size, ECMA_OBJECT_TYPE_FUNCTION);
/* 2., 6., 7., 8. */
/*
@@ -447,8 +444,8 @@ ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p, /**< argu
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
ecma_string_t *arguments_str_p = ecma_op_create_dynamic_function_arguments_helper (arguments_list_p,
arguments_list_len);
ecma_string_t *arguments_str_p =
ecma_op_create_dynamic_function_arguments_helper (arguments_list_p, arguments_list_len);
if (JERRY_UNLIKELY (arguments_str_p == NULL))
{
@@ -637,9 +634,7 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
}
#endif /* JERRY_SNAPSHOT_EXEC */
ecma_object_t *func_p = ecma_create_object (prototype_obj_p,
arrow_function_object_size,
ECMA_OBJECT_TYPE_FUNCTION);
ecma_object_t *func_p = ecma_create_object (prototype_obj_p, arrow_function_object_size, ECMA_OBJECT_TYPE_FUNCTION);
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) func_p;
@@ -686,9 +681,8 @@ ecma_op_create_external_function_object (ecma_native_handler_t handler_cb) /**<
{
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
ecma_object_t *function_obj_p = ecma_create_object (prototype_obj_p,
sizeof (ecma_native_function_t),
ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
ecma_object_t *function_obj_p =
ecma_create_object (prototype_obj_p, sizeof (ecma_native_function_t), ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
/*
* [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_NATIVE_FUNCTION type.
@@ -698,8 +692,7 @@ ecma_op_create_external_function_object (ecma_native_handler_t handler_cb) /**<
ecma_native_function_t *native_function_p = (ecma_native_function_t *) function_obj_p;
#if JERRY_BUILTIN_REALMS
ECMA_SET_INTERNAL_VALUE_POINTER (native_function_p->realm_value,
ecma_builtin_get_global ());
ECMA_SET_INTERNAL_VALUE_POINTER (native_function_p->realm_value, ecma_builtin_get_global ());
#endif /* JERRY_BUILTIN_REALMS */
native_function_p->native_handler_cb = handler_cb;
@@ -719,9 +712,7 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */
{
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
ecma_object_t *function_obj_p = ecma_create_object (prototype_obj_p,
object_size,
ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
ecma_object_t *function_obj_p = ecma_create_object (prototype_obj_p, object_size, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) function_obj_p;
ext_func_obj_p->u.built_in.id = ECMA_BUILTIN_ID_HANDLER;
@@ -729,8 +720,7 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */
ext_func_obj_p->u.built_in.u2.routine_flags = ECMA_NATIVE_HANDLER_FLAGS_NONE;
#if JERRY_BUILTIN_REALMS
ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_obj_p->u.built_in.realm_value,
ecma_builtin_get_global ());
ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_obj_p->u.built_in.realm_value, ecma_builtin_get_global ());
#endif /* JERRY_BUILTIN_REALMS */
return function_obj_p;
@@ -743,20 +733,18 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */
*
* @return compiled code
*/
extern inline const ecma_compiled_code_t * JERRY_ATTR_ALWAYS_INLINE
extern inline const ecma_compiled_code_t *JERRY_ATTR_ALWAYS_INLINE
ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< function pointer */
{
#if JERRY_SNAPSHOT_EXEC
if (JERRY_LIKELY (function_p->u.function.bytecode_cp != ECMA_NULL_POINTER))
{
return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
function_p->u.function.bytecode_cp);
return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t, function_p->u.function.bytecode_cp);
}
return ((ecma_static_function_t *) function_p)->bytecode_p;
#else /* !JERRY_SNAPSHOT_EXEC */
return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
function_p->u.function.bytecode_cp);
return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t, function_p->u.function.bytecode_cp);
#endif /* JERRY_SNAPSHOT_EXEC */
} /* ecma_op_function_get_compiled_code */
@@ -770,7 +758,7 @@ ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< fun
*
* @return pointer to realm (global) object
*/
extern inline ecma_global_object_t * JERRY_ATTR_ALWAYS_INLINE
extern inline ecma_global_object_t *JERRY_ATTR_ALWAYS_INLINE
ecma_op_function_get_realm (const ecma_compiled_code_t *bytecode_header_p) /**< byte code header */
{
#if JERRY_SNAPSHOT_EXEC
@@ -811,15 +799,13 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob
if (type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION)
{
ecma_extended_object_t *ext_function_obj_p = (ecma_extended_object_t *) func_obj_p;
return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
ext_function_obj_p->u.built_in.realm_value);
return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, ext_function_obj_p->u.built_in.realm_value);
}
if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION)
{
ecma_native_function_t *native_function_p = (ecma_native_function_t *) func_obj_p;
return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
native_function_p->realm_value);
return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value);
}
#if JERRY_ESNEXT
@@ -848,8 +834,8 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_BOUND_FUNCTION);
ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p;
func_obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
bound_func_p->header.u.bound_function.target_function);
func_obj_p =
ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);
}
} /* ecma_op_function_get_function_realm */
@@ -866,8 +852,7 @@ ecma_value_t
ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object */
ecma_value_t value) /**< argument 'V' */
{
JERRY_ASSERT (func_obj_p != NULL
&& !ecma_is_lexical_environment (func_obj_p));
JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p));
if (!ecma_is_value_object (value))
{
@@ -881,8 +866,8 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
/* 1. 3. */
ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p;
func_obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
bound_func_p->header.u.bound_function.target_function);
func_obj_p =
ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);
}
JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION
@@ -893,8 +878,7 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
ecma_object_t *v_obj_p = ecma_get_object_from_value (value);
ecma_value_t prototype_obj_value = ecma_op_object_get_by_magic_id (func_obj_p,
LIT_MAGIC_STRING_PROTOTYPE);
ecma_value_t prototype_obj_value = ecma_op_object_get_by_magic_id (func_obj_p, LIT_MAGIC_STRING_PROTOTYPE);
if (ECMA_IS_VALUE_ERROR (prototype_obj_value))
{
@@ -1133,8 +1117,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
/* Entering Function Code (ECMA-262 v5, 10.4.3) */
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) func_obj_p;
ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
ext_func_p->u.function.scope_cp);
ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_func_p->u.function.scope_cp);
/* 8. */
const ecma_compiled_code_t *bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p);
@@ -1190,8 +1173,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
break;
}
if (ecma_is_value_undefined (this_binding)
|| ecma_is_value_null (this_binding))
if (ecma_is_value_undefined (this_binding) || ecma_is_value_null (this_binding))
{
/* 2. */
#if JERRY_BUILTIN_REALMS
@@ -1253,14 +1235,12 @@ ecma_op_function_call_native_built_in (ecma_object_t *func_obj_p, /**< Function
ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);
ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p;
JERRY_CONTEXT (global_object_p) = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
ext_func_obj_p->u.built_in.realm_value);
JERRY_CONTEXT (global_object_p) =
ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, ext_func_obj_p->u.built_in.realm_value);
#endif /* JERRY_BUILTIN_REALMS */
ecma_value_t ret_value = ecma_builtin_dispatch_call (func_obj_p,
this_arg_value,
arguments_list_p,
arguments_list_len);
ecma_value_t ret_value =
ecma_builtin_dispatch_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
#if JERRY_BUILTIN_REALMS
JERRY_CONTEXT (global_object_p) = saved_global_object_p;
@@ -1285,8 +1265,8 @@ ecma_op_function_call_native (ecma_object_t *func_obj_p, /**< Function object */
#if JERRY_BUILTIN_REALMS
ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);
JERRY_CONTEXT (global_object_p) = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
native_function_p->realm_value);
JERRY_CONTEXT (global_object_p) =
ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value);
#endif /* JERRY_BUILTIN_REALMS */
jerry_call_info_t call_info;
@@ -1301,9 +1281,7 @@ ecma_op_function_call_native (ecma_object_t *func_obj_p, /**< Function object */
#endif /* JERRY_ESNEXT */
JERRY_ASSERT (native_function_p->native_handler_cb != NULL);
ecma_value_t ret_value = native_function_p->native_handler_cb (&call_info,
arguments_list_p,
arguments_list_len);
ecma_value_t ret_value = native_function_p->native_handler_cb (&call_info, arguments_list_p, arguments_list_len);
#if JERRY_BUILTIN_REALMS
JERRY_CONTEXT (global_object_p) = saved_global_object_p;
#endif /* JERRY_BUILTIN_REALMS */
@@ -1337,8 +1315,8 @@ ecma_op_bound_function_get_argument_list (ecma_object_t *func_obj_p, /**< bound
ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p;
func_obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
bound_func_p->header.u.bound_function.target_function);
func_obj_p =
ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);
ecma_value_t args_len_or_this = bound_func_p->header.u.bound_function.args_len_or_this;
@@ -1438,8 +1416,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< length of arguments list */
{
JERRY_ASSERT (func_obj_p != NULL
&& !ecma_is_lexical_environment (func_obj_p));
JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p));
ECMA_CHECK_STACK_USAGE ();
@@ -1702,10 +1679,7 @@ ecma_op_function_construct_constructor (ecma_object_t *func_obj_p, /**< Function
}
ecma_object_t *super_ctor_p = ecma_get_object_from_value (super_ctor);
ecma_value_t result = ecma_op_function_construct (super_ctor_p,
new_target_p,
arguments_list_p,
arguments_list_len);
ecma_value_t result = ecma_op_function_construct (super_ctor_p, new_target_p, arguments_list_p, arguments_list_len);
ecma_deref_object (super_ctor_p);
if (ecma_is_value_object (result))
@@ -1785,8 +1759,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< length of arguments list */
{
JERRY_ASSERT (func_obj_p != NULL
&& !ecma_is_lexical_environment (func_obj_p));
JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p));
switch (ecma_get_object_type (func_obj_p))
{
@@ -1852,8 +1825,7 @@ ecma_op_lazy_instantiate_prototype_object (ecma_object_t *object_p) /**< the fun
{
ecma_native_function_t *native_function_p = (ecma_native_function_t *) object_p;
global_object_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
native_function_p->realm_value);
global_object_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value);
}
#endif /* JERRY_BUILTIN_REALMS */
@@ -1997,10 +1969,8 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
}
ecma_property_t *value_prop_p;
ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
property_name_p,
ECMA_PROPERTY_BUILT_IN_CONFIGURABLE,
&value_prop_p);
ecma_property_value_t *value_p =
ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &value_prop_p);
value_p->value = ecma_make_uint32_value (len);
return value_prop_p;
}
@@ -2026,10 +1996,8 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
/* Initialize 'name' property */
ecma_property_t *value_prop_p;
ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
property_name_p,
ECMA_PROPERTY_BUILT_IN_CONFIGURABLE,
&value_prop_p);
ecma_property_value_t *value_p =
ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &value_prop_p);
value_p->value = ecma_copy_value (value);
return value_prop_p;
}
@@ -2043,8 +2011,7 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
const bool is_arguments = ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS);
if (is_arguments
|| ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER))
if (is_arguments || ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER))
{
const ecma_compiled_code_t *bytecode_data_p;
bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);
@@ -2055,10 +2022,8 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
{
ecma_property_t *value_prop_p;
/* The property_name_p argument contains the name. */
ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
property_name_p,
ECMA_PROPERTY_BUILT_IN_FIXED,
&value_prop_p);
ecma_property_value_t *value_p =
ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_FIXED, &value_prop_p);
value_p->value = is_arguments ? ECMA_VALUE_NULL : ECMA_VALUE_UNDEFINED;
return value_prop_p;
}
@@ -2146,8 +2111,8 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
length_attributes = ECMA_PROPERTY_BUILT_IN_FIXED;
ecma_object_t *target_func_p;
target_func_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
bound_func_p->header.u.bound_function.target_function);
target_func_p =
ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);
if (ecma_object_get_class_name (target_func_p) == LIT_MAGIC_STRING_FUNCTION_UL)
{
@@ -2167,10 +2132,8 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
}
ecma_property_t *len_prop_p;
ecma_property_value_t *len_prop_value_p = ecma_create_named_data_property (object_p,
property_name_p,
length_attributes,
&len_prop_p);
ecma_property_value_t *len_prop_value_p =
ecma_create_named_data_property (object_p, property_name_p, length_attributes, &len_prop_p);
len_prop_value_p->value = ecma_make_number_value (length);
return len_prop_p;