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,19 +13,21 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-proxy-object.h"
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-array-object.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-builtin-handlers.h"
|
||||
#include "ecma-builtin-object.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-objects.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
#include "ecma-objects.h"
|
||||
|
||||
#include "jcontext.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -162,8 +164,7 @@ ecma_proxy_create_revocable (ecma_value_t target, /**< target argument */
|
||||
|
||||
/* 3. */
|
||||
ecma_object_t *func_obj_p;
|
||||
func_obj_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROXY_REVOKE,
|
||||
sizeof (ecma_revocable_proxy_object_t));
|
||||
func_obj_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROXY_REVOKE, sizeof (ecma_revocable_proxy_object_t));
|
||||
|
||||
/* 4. */
|
||||
ecma_revocable_proxy_object_t *rev_proxy_p = (ecma_revocable_proxy_object_t *) func_obj_p;
|
||||
@@ -173,9 +174,8 @@ ecma_proxy_create_revocable (ecma_value_t target, /**< target argument */
|
||||
ecma_value_t revoker = ecma_make_object_value (func_obj_p);
|
||||
|
||||
/* 5. */
|
||||
ecma_object_t *obj_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE),
|
||||
0,
|
||||
ECMA_OBJECT_TYPE_GENERAL);
|
||||
ecma_object_t *obj_p =
|
||||
ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL);
|
||||
|
||||
/* 6. */
|
||||
prop_value_p = ecma_create_named_data_property (obj_p,
|
||||
@@ -640,8 +640,7 @@ ecma_proxy_object_prevent_extensions (ecma_object_t *obj_p) /**< proxy object */
|
||||
ecma_free_value (trap_result);
|
||||
|
||||
/* 10. */
|
||||
if (boolean_trap_result
|
||||
&& !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
|
||||
if (boolean_trap_result && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
|
||||
{
|
||||
ecma_value_t target_is_ext = ecma_builtin_object_object_is_extensible (target_obj_p);
|
||||
|
||||
@@ -834,7 +833,7 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy
|
||||
is_extensible);
|
||||
|
||||
bool target_has_desc = ecma_is_value_true (target_status);
|
||||
bool target_is_writable = (target_desc.flags & JERRY_PROP_IS_WRITABLE) ;
|
||||
bool target_is_writable = (target_desc.flags & JERRY_PROP_IS_WRITABLE);
|
||||
bool target_is_configurable = false;
|
||||
|
||||
if (target_has_desc)
|
||||
@@ -855,10 +854,8 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy
|
||||
{
|
||||
const uint16_t mask = (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE);
|
||||
|
||||
if (!target_has_desc
|
||||
|| target_is_configurable
|
||||
|| ((prop_desc_p->flags & mask) == JERRY_PROP_IS_WRITABLE_DEFINED
|
||||
&& target_is_writable))
|
||||
if (!target_has_desc || target_is_configurable
|
||||
|| ((prop_desc_p->flags & mask) == JERRY_PROP_IS_WRITABLE_DEFINED && target_is_writable))
|
||||
{
|
||||
ecma_free_property_descriptor (prop_desc_p);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("The two descriptors are incompatible"));
|
||||
@@ -917,7 +914,7 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object *
|
||||
ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);
|
||||
ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p);
|
||||
ecma_value_t desc_obj_value = ecma_make_object_value (desc_obj);
|
||||
ecma_value_t args[] = {target, prop_value, desc_obj_value};
|
||||
ecma_value_t args[] = { target, prop_value, desc_obj_value };
|
||||
|
||||
/* 10. */
|
||||
ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 3);
|
||||
@@ -976,8 +973,8 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object *
|
||||
}
|
||||
|
||||
/* 17. */
|
||||
bool setting_config_false = ((prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED)
|
||||
&& !(prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE));
|
||||
bool setting_config_false =
|
||||
((prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED) && !(prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE));
|
||||
|
||||
/* 19. */
|
||||
if (!target_prop_found)
|
||||
@@ -1012,7 +1009,7 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object *
|
||||
/* ES11: 16.c */
|
||||
else if ((target_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED)) != 0
|
||||
&& (prop_desc_p->flags & (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE))
|
||||
== JERRY_PROP_IS_WRITABLE_DEFINED
|
||||
== JERRY_PROP_IS_WRITABLE_DEFINED
|
||||
&& (target_desc.flags & (JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_CONFIGURABLE)) == JERRY_PROP_IS_WRITABLE)
|
||||
|
||||
{
|
||||
@@ -1076,7 +1073,7 @@ ecma_proxy_object_has (ecma_object_t *obj_p, /**< proxy object */
|
||||
|
||||
ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);
|
||||
ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p);
|
||||
ecma_value_t args[] = {target, prop_value};
|
||||
ecma_value_t args[] = { target, prop_value };
|
||||
|
||||
/* 9. */
|
||||
ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 2);
|
||||
@@ -1094,8 +1091,7 @@ ecma_proxy_object_has (ecma_object_t *obj_p, /**< proxy object */
|
||||
ecma_free_value (trap_result);
|
||||
|
||||
/* 11. */
|
||||
if (!boolean_trap_result
|
||||
&& !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
|
||||
if (!boolean_trap_result && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
|
||||
{
|
||||
ecma_property_descriptor_t target_desc;
|
||||
|
||||
@@ -1189,8 +1185,7 @@ ecma_proxy_object_get (ecma_object_t *obj_p, /**< proxy object */
|
||||
ecma_deref_object (func_obj_p);
|
||||
|
||||
/* 10. */
|
||||
if (ECMA_IS_VALUE_ERROR (trap_result)
|
||||
|| (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
|
||||
if (ECMA_IS_VALUE_ERROR (trap_result) || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
|
||||
{
|
||||
return trap_result;
|
||||
}
|
||||
@@ -1211,17 +1206,14 @@ ecma_proxy_object_get (ecma_object_t *obj_p, /**< proxy object */
|
||||
{
|
||||
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
|
||||
|
||||
if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED)
|
||||
&& !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)
|
||||
&& !(target_desc.flags & JERRY_PROP_IS_WRITABLE)
|
||||
&& !ecma_op_same_value (trap_result, target_desc.value))
|
||||
if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)
|
||||
&& !(target_desc.flags & JERRY_PROP_IS_WRITABLE) && !ecma_op_same_value (trap_result, target_desc.value))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incorrect value is returned by a Proxy 'get' trap"));
|
||||
}
|
||||
else if (!(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)
|
||||
&& (target_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))
|
||||
&& target_desc.get_p == NULL
|
||||
&& !ecma_is_value_undefined (trap_result))
|
||||
&& target_desc.get_p == NULL && !ecma_is_value_undefined (trap_result))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Property of a Proxy is non-configurable and "
|
||||
"does not have a getter function"));
|
||||
@@ -1338,10 +1330,8 @@ ecma_proxy_object_set (ecma_object_t *obj_p, /**< proxy object */
|
||||
{
|
||||
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
|
||||
|
||||
if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED)
|
||||
&& !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)
|
||||
&& !(target_desc.flags & JERRY_PROP_IS_WRITABLE)
|
||||
&& !ecma_op_same_value (value, target_desc.value))
|
||||
if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)
|
||||
&& !(target_desc.flags & JERRY_PROP_IS_WRITABLE) && !ecma_op_same_value (value, target_desc.value))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incorrect value is returned by a Proxy 'set' trap"));
|
||||
}
|
||||
@@ -1650,8 +1640,7 @@ ecma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */
|
||||
|
||||
ecma_free_value (trap_result_array);
|
||||
|
||||
if (trap_result == NULL
|
||||
|| (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
|
||||
if (trap_result == NULL || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
|
||||
{
|
||||
return trap_result;
|
||||
}
|
||||
@@ -1697,9 +1686,7 @@ ecma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */
|
||||
|
||||
ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (target_keys->buffer_p[i]);
|
||||
|
||||
ecma_value_t status = ecma_op_object_get_own_property_descriptor (target_obj_p,
|
||||
prop_name_p,
|
||||
&target_desc);
|
||||
ecma_value_t status = ecma_op_object_get_own_property_descriptor (target_obj_p, prop_name_p, &target_desc);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (status))
|
||||
{
|
||||
@@ -1709,8 +1696,7 @@ ecma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */
|
||||
|
||||
ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p);
|
||||
|
||||
if (ecma_is_value_true (status)
|
||||
&& !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE))
|
||||
if (ecma_is_value_true (status) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE))
|
||||
{
|
||||
ecma_collection_push_back (target_non_configurable_keys, prop_value);
|
||||
}
|
||||
@@ -1806,7 +1792,7 @@ ecma_proxy_object_call (ecma_object_t *obj_p, /**< proxy object */
|
||||
|
||||
/* 8. */
|
||||
ecma_value_t args_array = ecma_op_new_array_object_from_buffer (args_p, argc);
|
||||
ecma_value_t value_array[] = {target, this_argument, args_array};
|
||||
ecma_value_t value_array[] = { target, this_argument, args_array };
|
||||
ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);
|
||||
/* 9. */
|
||||
ecma_value_t ret_value = ecma_op_function_call (func_obj_p, handler, value_array, 3);
|
||||
@@ -1836,7 +1822,7 @@ ecma_proxy_object_construct (ecma_object_t *obj_p, /**< proxy object */
|
||||
JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));
|
||||
ECMA_CHECK_STACK_USAGE ();
|
||||
|
||||
ecma_proxy_object_t * proxy_obj_p = (ecma_proxy_object_t *) obj_p;
|
||||
ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;
|
||||
|
||||
/* 1. */
|
||||
ecma_value_t handler = proxy_obj_p->handler;
|
||||
@@ -1868,7 +1854,7 @@ ecma_proxy_object_construct (ecma_object_t *obj_p, /**< proxy object */
|
||||
|
||||
ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);
|
||||
ecma_value_t new_target_value = ecma_make_object_value (new_target_p);
|
||||
ecma_value_t function_call_args[] = {target, args_array, new_target_value};
|
||||
ecma_value_t function_call_args[] = { target, args_array, new_target_value };
|
||||
|
||||
/* 9. */
|
||||
ecma_value_t new_obj = ecma_op_function_call (func_obj_p, handler, function_call_args, 3);
|
||||
|
||||
Reference in New Issue
Block a user