Styles fixes in libecmaobjects, libecmaoperations: indentation and braces rules.
This commit is contained in:
@@ -40,12 +40,12 @@ static ecma_object_t*
|
||||
ecma_get_lex_env_binding_object (ecma_object_t* obj_lex_env_p) /**< object lexical environment */
|
||||
{
|
||||
JERRY_ASSERT(obj_lex_env_p != NULL
|
||||
&& obj_lex_env_p->is_lexical_environment
|
||||
&& obj_lex_env_p->u.lexical_environment.type == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND);
|
||||
&& obj_lex_env_p->is_lexical_environment
|
||||
&& obj_lex_env_p->u.lexical_environment.type == ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND);
|
||||
|
||||
ecma_property_t *binding_obj_prop_p = ECMA_GET_POINTER(obj_lex_env_p->properties_p);
|
||||
JERRY_ASSERT(binding_obj_prop_p != NULL
|
||||
&& binding_obj_prop_p->u.internal_property.type == ECMA_INTERNAL_PROPERTY_BINDING_OBJECT);
|
||||
&& binding_obj_prop_p->u.internal_property.type == ECMA_INTERNAL_PROPERTY_BINDING_OBJECT);
|
||||
|
||||
return ECMA_GET_POINTER(binding_obj_prop_p->u.internal_property.value);
|
||||
} /* ecma_get_lex_env_binding_object */
|
||||
@@ -61,7 +61,7 @@ ecma_get_lex_env_binding_object (ecma_object_t* obj_lex_env_p) /**< object lexic
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_char_t *name_p) /**< argument N */
|
||||
const ecma_char_t *name_p) /**< argument N */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment);
|
||||
|
||||
@@ -73,8 +73,7 @@ ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
{
|
||||
ecma_property_t *property_p = ecma_find_named_property (lex_env_p, name_p);
|
||||
|
||||
has_binding = (property_p != NULL) ? ECMA_SIMPLE_VALUE_TRUE
|
||||
: ECMA_SIMPLE_VALUE_FALSE;
|
||||
has_binding = (property_p != NULL) ? ECMA_SIMPLE_VALUE_TRUE : ECMA_SIMPLE_VALUE_FALSE;
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -82,16 +81,22 @@ 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);
|
||||
|
||||
has_binding = ecma_op_object_has_property (binding_obj_p, name_p) ? ECMA_SIMPLE_VALUE_TRUE
|
||||
: ECMA_SIMPLE_VALUE_FALSE;
|
||||
if (ecma_op_object_has_property (binding_obj_p, name_p))
|
||||
{
|
||||
has_binding = ECMA_SIMPLE_VALUE_TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
has_binding = ECMA_SIMPLE_VALUE_FALSE;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL,
|
||||
ecma_make_simple_value (has_binding),
|
||||
ECMA_TARGET_ID_RESERVED);
|
||||
ecma_make_simple_value (has_binding),
|
||||
ECMA_TARGET_ID_RESERVED);
|
||||
} /* ecma_op_has_binding */
|
||||
|
||||
/**
|
||||
@@ -104,8 +109,8 @@ ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_char_t *name_p, /**< argument N */
|
||||
bool is_deletable) /**< argument D */
|
||||
const ecma_char_t *name_p, /**< argument N */
|
||||
bool is_deletable) /**< argument D */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment);
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
@@ -121,7 +126,7 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
ECMA_PROPERTY_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
is_deletable ? ECMA_PROPERTY_CONFIGURABLE
|
||||
: ECMA_PROPERTY_NOT_CONFIGURABLE);
|
||||
: ECMA_PROPERTY_NOT_CONFIGURABLE);
|
||||
|
||||
|
||||
break;
|
||||
@@ -133,20 +138,19 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
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;
|
||||
prop_desc.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
{
|
||||
prop_desc.is_value_defined = true;
|
||||
prop_desc.value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
|
||||
prop_desc.is_writable_defined = true;
|
||||
prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
||||
prop_desc.is_writable_defined = true;
|
||||
prop_desc.writable = ECMA_PROPERTY_WRITABLE;
|
||||
|
||||
prop_desc.is_enumerable_defined = true;
|
||||
prop_desc.enumerable = ECMA_PROPERTY_ENUMERABLE;
|
||||
prop_desc.is_enumerable_defined = true;
|
||||
prop_desc.enumerable = ECMA_PROPERTY_ENUMERABLE;
|
||||
|
||||
prop_desc.is_configurable_defined = true;
|
||||
prop_desc.configurable = is_deletable ? ECMA_PROPERTY_CONFIGURABLE
|
||||
: ECMA_PROPERTY_NOT_CONFIGURABLE;
|
||||
}
|
||||
prop_desc.is_configurable_defined = true;
|
||||
prop_desc.configurable = is_deletable ? ECMA_PROPERTY_CONFIGURABLE : ECMA_PROPERTY_NOT_CONFIGURABLE;
|
||||
}
|
||||
|
||||
ecma_completion_value_t completion = ecma_op_object_define_own_property (binding_obj_p,
|
||||
name_p,
|
||||
@@ -154,12 +158,12 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
true);
|
||||
|
||||
if (!(ecma_is_completion_value_normal_true (completion)
|
||||
|| ecma_is_completion_value_normal_false (completion)))
|
||||
{
|
||||
JERRY_ASSERT(ecma_is_completion_value_throw (completion));
|
||||
|| ecma_is_completion_value_normal_false (completion)))
|
||||
{
|
||||
JERRY_ASSERT(ecma_is_completion_value_throw (completion));
|
||||
|
||||
return completion;
|
||||
}
|
||||
return completion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,9 +180,9 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_char_t *name_p, /**< argument N */
|
||||
ecma_value_t value, /**< argument V */
|
||||
bool is_strict) /**< argument S */
|
||||
const ecma_char_t *name_p, /**< argument N */
|
||||
ecma_value_t value, /**< argument V */
|
||||
bool is_strict) /**< argument S */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment);
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
@@ -192,16 +196,16 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
ecma_property_t *property_p = ecma_get_named_data_property (lex_env_p, name_p);
|
||||
|
||||
if (property_p->u.named_data_property.writable == ECMA_PROPERTY_WRITABLE)
|
||||
{
|
||||
ecma_free_value (property_p->u.named_data_property.value, false);
|
||||
property_p->u.named_data_property.value = ecma_copy_value (value, false);
|
||||
{
|
||||
ecma_free_value (property_p->u.named_data_property.value, false);
|
||||
property_p->u.named_data_property.value = ecma_copy_value (value, false);
|
||||
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, value);
|
||||
}
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, value);
|
||||
}
|
||||
else if (is_strict)
|
||||
{
|
||||
return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
{
|
||||
return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_TYPE));
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -214,12 +218,12 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
value,
|
||||
is_strict);
|
||||
if (!(ecma_is_completion_value_normal_true (completion)
|
||||
|| ecma_is_completion_value_normal_false (completion)))
|
||||
{
|
||||
JERRY_ASSERT(ecma_is_completion_value_throw (completion));
|
||||
|| ecma_is_completion_value_normal_false (completion)))
|
||||
{
|
||||
JERRY_ASSERT(ecma_is_completion_value_throw (completion));
|
||||
|
||||
return completion;
|
||||
}
|
||||
return completion;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@@ -238,8 +242,8 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_char_t *name_p, /**< argument N */
|
||||
bool is_strict) /**< argument S */
|
||||
const ecma_char_t *name_p, /**< argument N */
|
||||
bool is_strict) /**< argument S */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment);
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
@@ -281,16 +285,16 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
bool has_prop = ecma_op_object_has_property (binding_obj_p, name_p);
|
||||
|
||||
if (!has_prop)
|
||||
{
|
||||
if (is_strict)
|
||||
{
|
||||
if (is_strict)
|
||||
{
|
||||
return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
return ecma_make_throw_value (ecma_new_standard_error (ECMA_ERROR_REFERENCE));
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_op_object_get (binding_obj_p, name_p);
|
||||
}
|
||||
@@ -310,7 +314,7 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
*/
|
||||
ecma_completion_value_t
|
||||
ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_char_t *name_p) /**< argument N */
|
||||
const ecma_char_t *name_p) /**< argument N */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment);
|
||||
JERRY_ASSERT(name_p != NULL);
|
||||
@@ -318,32 +322,32 @@ ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type)
|
||||
{
|
||||
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
|
||||
{
|
||||
ecma_property_t *prop_p = ecma_find_named_property (lex_env_p, name_p);
|
||||
ecma_simple_value_t ret_val;
|
||||
{
|
||||
ecma_property_t *prop_p = ecma_find_named_property (lex_env_p, name_p);
|
||||
ecma_simple_value_t ret_val;
|
||||
|
||||
if (prop_p == NULL)
|
||||
if (prop_p == NULL)
|
||||
{
|
||||
ret_val = ECMA_SIMPLE_VALUE_TRUE;
|
||||
} else
|
||||
{
|
||||
JERRY_ASSERT(prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||
|
||||
if (prop_p->u.named_data_property.configurable == ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
{
|
||||
ret_val = ECMA_SIMPLE_VALUE_TRUE;
|
||||
ret_val = ECMA_SIMPLE_VALUE_FALSE;
|
||||
} else
|
||||
{
|
||||
JERRY_ASSERT(prop_p->type == ECMA_PROPERTY_NAMEDDATA);
|
||||
ecma_delete_property (lex_env_p, prop_p);
|
||||
|
||||
if (prop_p->u.named_data_property.configurable == ECMA_PROPERTY_NOT_CONFIGURABLE)
|
||||
{
|
||||
ret_val = ECMA_SIMPLE_VALUE_FALSE;
|
||||
} else
|
||||
{
|
||||
ecma_delete_property (lex_env_p, prop_p);
|
||||
|
||||
ret_val = ECMA_SIMPLE_VALUE_TRUE;
|
||||
}
|
||||
ret_val = ECMA_SIMPLE_VALUE_TRUE;
|
||||
}
|
||||
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL,
|
||||
ecma_make_simple_value (ret_val),
|
||||
ECMA_TARGET_ID_RESERVED);
|
||||
}
|
||||
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL,
|
||||
ecma_make_simple_value (ret_val),
|
||||
ECMA_TARGET_ID_RESERVED);
|
||||
}
|
||||
case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND:
|
||||
{
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
@@ -371,9 +375,9 @@ ecma_op_implicit_this_value (ecma_object_t *lex_env_p) /**< lexical environment
|
||||
switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type)
|
||||
{
|
||||
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND:
|
||||
{
|
||||
ecma_property_t *provide_this_prop_p = ecma_get_internal_property (lex_env_p,
|
||||
@@ -382,18 +386,18 @@ ecma_op_implicit_this_value (ecma_object_t *lex_env_p) /**< lexical environment
|
||||
bool provide_this = provide_this_prop_p->u.internal_property.value;
|
||||
|
||||
if (provide_this)
|
||||
{
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
ecma_ref_object (binding_obj_p);
|
||||
{
|
||||
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
|
||||
ecma_ref_object (binding_obj_p);
|
||||
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL,
|
||||
ecma_make_object_value (binding_obj_p),
|
||||
ECMA_TARGET_ID_RESERVED);
|
||||
}
|
||||
return ecma_make_completion_value (ECMA_COMPLETION_TYPE_NORMAL,
|
||||
ecma_make_object_value (binding_obj_p),
|
||||
ECMA_TARGET_ID_RESERVED);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
{
|
||||
return ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_UNDEFINED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,31 +411,31 @@ ecma_op_implicit_this_value (ecma_object_t *lex_env_p) /**< lexical environment
|
||||
*/
|
||||
void
|
||||
ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_char_t *name_p) /**< argument N */
|
||||
const ecma_char_t *name_p) /**< argument N */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment);
|
||||
|
||||
switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type)
|
||||
{
|
||||
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
|
||||
{
|
||||
JERRY_ASSERT(ecma_is_completion_value_normal_false (ecma_op_has_binding (lex_env_p, name_p)));
|
||||
{
|
||||
JERRY_ASSERT(ecma_is_completion_value_normal_false (ecma_op_has_binding (lex_env_p, name_p)));
|
||||
|
||||
/*
|
||||
* Warning:
|
||||
* Whether immutable bindings are deletable seems not to be defined by ECMA v5.
|
||||
*/
|
||||
ecma_property_t *prop_p = ecma_create_named_data_property (lex_env_p,
|
||||
name_p,
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE);
|
||||
/*
|
||||
* Warning:
|
||||
* Whether immutable bindings are deletable seems not to be defined by ECMA v5.
|
||||
*/
|
||||
ecma_property_t *prop_p = ecma_create_named_data_property (lex_env_p,
|
||||
name_p,
|
||||
ECMA_PROPERTY_NOT_WRITABLE,
|
||||
ECMA_PROPERTY_NOT_ENUMERABLE,
|
||||
ECMA_PROPERTY_NOT_CONFIGURABLE);
|
||||
|
||||
JERRY_ASSERT(ecma_is_value_undefined (prop_p->u.named_data_property.value));
|
||||
JERRY_ASSERT(ecma_is_value_undefined (prop_p->u.named_data_property.value));
|
||||
|
||||
prop_p->u.named_data_property.value.value_type = ECMA_TYPE_SIMPLE;
|
||||
prop_p->u.named_data_property.value.value = ECMA_SIMPLE_VALUE_EMPTY;
|
||||
}
|
||||
prop_p->u.named_data_property.value.value_type = ECMA_TYPE_SIMPLE;
|
||||
prop_p->u.named_data_property.value.value = ECMA_SIMPLE_VALUE_EMPTY;
|
||||
}
|
||||
case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND:
|
||||
{
|
||||
JERRY_UNREACHABLE();
|
||||
@@ -448,27 +452,27 @@ ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environ
|
||||
*/
|
||||
void
|
||||
ecma_op_initialize_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
const ecma_char_t *name_p, /**< argument N */
|
||||
ecma_value_t value) /**< argument V */
|
||||
const ecma_char_t *name_p, /**< argument N */
|
||||
ecma_value_t value) /**< argument V */
|
||||
{
|
||||
JERRY_ASSERT(lex_env_p != NULL && lex_env_p->is_lexical_environment);
|
||||
|
||||
switch ((ecma_lexical_environment_type_t) lex_env_p->u.lexical_environment.type)
|
||||
{
|
||||
case ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE:
|
||||
{
|
||||
JERRY_ASSERT(ecma_is_completion_value_normal_true (ecma_op_has_binding (lex_env_p, name_p)));
|
||||
{
|
||||
JERRY_ASSERT(ecma_is_completion_value_normal_true (ecma_op_has_binding (lex_env_p, name_p)));
|
||||
|
||||
ecma_property_t *prop_p = ecma_get_named_data_property (lex_env_p, name_p);
|
||||
ecma_property_t *prop_p = ecma_get_named_data_property (lex_env_p, name_p);
|
||||
|
||||
/* The binding must be unitialized immutable binding */
|
||||
JERRY_ASSERT(prop_p->u.named_data_property.writable == ECMA_PROPERTY_NOT_WRITABLE
|
||||
&& ecma_is_value_empty (prop_p->u.named_data_property.value));
|
||||
/* The binding must be unitialized immutable binding */
|
||||
JERRY_ASSERT(prop_p->u.named_data_property.writable == ECMA_PROPERTY_NOT_WRITABLE
|
||||
&& ecma_is_value_empty (prop_p->u.named_data_property.value));
|
||||
|
||||
prop_p->u.named_data_property.value = ecma_copy_value (value, false);
|
||||
prop_p->u.named_data_property.value = ecma_copy_value (value, false);
|
||||
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, value);
|
||||
}
|
||||
ecma_gc_update_may_ref_younger_object_flag_by_value (lex_env_p, value);
|
||||
}
|
||||
case ECMA_LEXICAL_ENVIRONMENT_OBJECTBOUND:
|
||||
{
|
||||
JERRY_UNREACHABLE();
|
||||
|
||||
Reference in New Issue
Block a user