Refactor ecma_op_check_object_coercible (#4169)

The method returns bool now instead of an ecma_value_t

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
Szilagyi Adam
2020-08-28 13:12:50 +02:00
committed by GitHub
parent e98f5342f9
commit 9589771f7a
7 changed files with 28 additions and 39 deletions
+12 -14
View File
@@ -44,29 +44,27 @@
*/
/**
* CheckObjectCoercible operation.
* RequireObjectCoercible operation.
*
* See also:
* ECMA-262 v5, 9.10
* ECMA-262 v11, 7.2.1
*
* @return ecma value
* Returned value must be freed with ecma_free_value
* @return true - if the value can be coerced to object without any exceptions
* false - otherwise
*/
ecma_value_t
ecma_op_check_object_coercible (ecma_value_t value) /**< ecma value */
bool
ecma_op_require_object_coercible (ecma_value_t value) /**< ecma value */
{
ecma_check_value_type_is_spec_defined (value);
if (ecma_is_value_undefined (value)
|| ecma_is_value_null (value))
if (ecma_is_value_undefined (value) || ecma_is_value_null (value))
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument cannot be converted to an object."));
ecma_raise_type_error (ECMA_ERR_MSG ("Argument cannot be converted to an object."));
return false;
}
else
{
return ECMA_VALUE_EMPTY;
}
} /* ecma_op_check_object_coercible */
return true;
} /* ecma_op_require_object_coercible */
/**
* SameValue operation.
+1 -1
View File
@@ -46,7 +46,7 @@ typedef enum
ECMA_TO_NUMERIC_ALLOW_BIGINT = (1 << 0), /**< allow BigInt values (ignored if BigInts are disabled) */
} ecma_to_numeric_options_t;
ecma_value_t ecma_op_check_object_coercible (ecma_value_t value);
bool ecma_op_require_object_coercible (ecma_value_t value);
bool ecma_op_same_value (ecma_value_t x, ecma_value_t y);
#if ENABLED (JERRY_BUILTIN_MAP)
bool ecma_op_same_value_zero (ecma_value_t x, ecma_value_t y, bool strict_equality);