Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions jerry-core/api/jerry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1811,7 +1811,7 @@ jerry_has_property (const jerry_value_t obj_val, /**< object value */
if (!ecma_is_value_object (obj_val)
|| !ecma_is_value_string (prop_name_val))
{
return ecma_make_boolean_value (false);
return ECMA_VALUE_FALSE;
}

bool has_property = ecma_op_object_has_property (ecma_get_object_from_value (obj_val),
Expand All @@ -1835,7 +1835,7 @@ jerry_has_own_property (const jerry_value_t obj_val, /**< object value */
if (!ecma_is_value_object (obj_val)
|| !ecma_is_value_string (prop_name_val))
{
return ecma_make_boolean_value (false);
return ECMA_VALUE_FALSE;
}

bool has_property = ecma_op_object_has_own_property (ecma_get_object_from_value (obj_val),
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ecma_builtin_arraybuffer_object_is_view (ecma_value_t this_arg, /**< 'this' argu

/* TODO: if arg has [[ViewArrayBuffer]], return true */

return ecma_make_boolean_value (false);
return ECMA_VALUE_FALSE;
} /* ecma_builtin_arraybuffer_object_is_view */

/**
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ ecma_builtin_boolean_dispatch_call (const ecma_value_t *arguments_list_p, /**< a
arg_value = arguments_list_p[0];
}

return ecma_op_to_boolean (arg_value) ? ECMA_VALUE_TRUE : ECMA_VALUE_FALSE;
return ecma_make_boolean_value (ecma_op_to_boolean (arg_value));
} /* ecma_builtin_boolean_dispatch_call */

/**
Expand Down
7 changes: 2 additions & 5 deletions jerry-core/ecma/builtin-objects/ecma-builtin-global.c
Original file line number Diff line number Diff line change
Expand Up @@ -532,9 +532,7 @@ ecma_builtin_global_object_is_nan (ecma_value_t this_arg, /**< this argument */

ECMA_OP_TO_NUMBER_TRY_CATCH (arg_num, arg, ret_value);

bool is_nan = ecma_number_is_nan (arg_num);

ret_value = is_nan ? ECMA_VALUE_TRUE : ECMA_VALUE_FALSE;
ret_value = ecma_make_boolean_value (ecma_number_is_nan (arg_num));

ECMA_OP_TO_NUMBER_FINALIZE (arg_num);

Expand All @@ -561,8 +559,7 @@ ecma_builtin_global_object_is_finite (ecma_value_t this_arg, /**< this argument

bool is_finite = !(ecma_number_is_nan (arg_num)
|| ecma_number_is_infinity (arg_num));

ret_value = is_finite ? ECMA_VALUE_TRUE : ECMA_VALUE_FALSE;
ret_value = ecma_make_boolean_value (is_finite);

ECMA_OP_TO_NUMBER_FINALIZE (arg_num);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ ecma_builtin_object_prototype_object_is_prototype_of (ecma_value_t this_arg, /**
ecma_object_t *v_obj_p = ecma_get_object_from_value (v_obj_value);

bool is_prototype_of = ecma_op_object_is_prototype_of (obj_p, v_obj_p);
return_value = is_prototype_of ? ECMA_VALUE_TRUE : ECMA_VALUE_FALSE;
return_value = ecma_make_boolean_value (is_prototype_of);
ECMA_FINALIZE (v_obj_value);

ECMA_FINALIZE (obj_value);
Expand Down
27 changes: 7 additions & 20 deletions jerry-core/ecma/builtin-objects/ecma-builtin-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -512,17 +512,15 @@ ecma_builtin_object_frozen_or_sealed_helper (ecma_value_t this_arg, /**< 'this'
{
ecma_object_t *obj_p = ecma_get_object_from_value (arg);

bool is_sealed_or_frozen;

/* 3. */
if (ecma_get_object_extensible (obj_p))
{
is_sealed_or_frozen = false;
ret_value = ECMA_VALUE_FALSE;
}
else
{
/* the value can be updated in the loop below */
is_sealed_or_frozen = true;
ret_value = ECMA_VALUE_TRUE;

/* 2. */
ecma_collection_header_t *props_p = ecma_op_object_get_property_names (obj_p, ECMA_LIST_NO_OPTS);
Expand All @@ -545,23 +543,20 @@ ecma_builtin_object_frozen_or_sealed_helper (ecma_value_t this_arg, /**< 'this'
&& ECMA_PROPERTY_GET_TYPE (property) != ECMA_PROPERTY_TYPE_NAMEDACCESSOR
&& ecma_is_property_writable (property))
{
is_sealed_or_frozen = false;
ret_value = ECMA_VALUE_FALSE;
break;
}

/* 2.b for isSealed, 2.c for isFrozen */
if (ecma_is_property_configurable (property))
{
is_sealed_or_frozen = false;
ret_value = ECMA_VALUE_FALSE;
break;
}
}

ecma_free_values_collection (props_p, 0);
}

/* 4. */
ret_value = is_sealed_or_frozen ? ECMA_VALUE_TRUE : ECMA_VALUE_FALSE;
}

return ret_value;
Expand Down Expand Up @@ -613,22 +608,14 @@ ecma_builtin_object_object_is_extensible (ecma_value_t this_arg, /**< 'this' arg
ecma_value_t arg) /**< routine's argument */
{
JERRY_UNUSED (this_arg);
ecma_value_t ret_value = ECMA_VALUE_EMPTY;

if (!ecma_is_value_object (arg))
{
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object."));
}
else
{
ecma_object_t *obj_p = ecma_get_object_from_value (arg);

bool extensible = ecma_get_object_extensible (obj_p);

ret_value = extensible ? ECMA_VALUE_TRUE : ECMA_VALUE_FALSE;
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object."));
}

return ret_value;
ecma_object_t *obj_p = ecma_get_object_from_value (arg);
return ecma_make_boolean_value (ecma_get_object_extensible (obj_p));
} /* ecma_builtin_object_object_is_extensible */

/**
Expand Down
4 changes: 2 additions & 2 deletions jerry-core/ecma/builtin-objects/ecma-builtin-promise.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ ecma_builtin_promise_all_handler (const ecma_value_t function, /**< the function
/* 3. */
ecma_op_object_put (function_p,
already_called_str_p,
ecma_make_boolean_value (true),
ECMA_VALUE_TRUE,
false);

ecma_string_t *str_index_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_PROMISE_PROPERTY_INDEX);
Expand Down Expand Up @@ -500,7 +500,7 @@ ecma_builtin_promise_do_all (ecma_value_t array, /**< the array for all */
/* l. */
ecma_op_object_put (res_ele_p,
already_called_str_p,
ecma_make_boolean_value (false),
ECMA_VALUE_FALSE,
false);
/* m. */
ecma_op_object_put (res_ele_p,
Expand Down
6 changes: 3 additions & 3 deletions jerry-core/ecma/operations/ecma-function-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
ecma_object_t *prototype_obj_p = ecma_get_object_from_value (prototype_obj_value);
JERRY_ASSERT (prototype_obj_p != NULL);

bool result = false;
ecma_value_t result = ECMA_VALUE_FALSE;

while (true)
{
Expand All @@ -386,13 +386,13 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *

if (v_obj_p == prototype_obj_p)
{
result = true;
result = ECMA_VALUE_TRUE;
break;
}
}

ecma_deref_object (prototype_obj_p);
return ecma_make_boolean_value (result);
return result;
} /* ecma_op_function_has_instance */


Expand Down
8 changes: 4 additions & 4 deletions jerry-core/ecma/operations/ecma-promise-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ecma_get_already_resolved_bool_value (ecma_value_t already_resolved) /**< the al

JERRY_ASSERT (ext_object_p->u.class_prop.class_id == LIT_MAGIC_STRING_BOOLEAN_UL);

return ext_object_p->u.class_prop.u.value == ecma_make_boolean_value (true);
return ext_object_p->u.class_prop.u.value == ECMA_VALUE_TRUE;
} /* ecma_get_already_resolved_bool_value */

/**
Expand Down Expand Up @@ -421,7 +421,7 @@ ecma_promise_resolving_functions_t *
ecma_promise_create_resolving_functions (ecma_object_t *object_p) /**< the promise object */
{
/* 1. */
ecma_value_t already_resolved = ecma_op_create_boolean_object (ecma_make_boolean_value (false));
ecma_value_t already_resolved = ecma_op_create_boolean_object (ECMA_VALUE_FALSE);

ecma_string_t *str_promise_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_PROMISE);
ecma_string_t *str_already_resolved_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_ALREADY_RESOLVED);
Expand Down Expand Up @@ -670,13 +670,13 @@ ecma_promise_do_then (ecma_value_t promise, /**< the promise which call 'then' *
/* 3. boolean true indicates "indentity" */
if (!ecma_op_is_callable (on_fulfilled))
{
on_fulfilled = ecma_make_boolean_value (true);
on_fulfilled = ECMA_VALUE_TRUE;
}

/* 4. boolean false indicates "thrower" */
if (!ecma_op_is_callable (on_rejected))
{
on_rejected = ecma_make_boolean_value (false);
on_rejected = ECMA_VALUE_FALSE;
}

/* 5-6. */
Expand Down