Outsource magic error messages (#4821)
Modify tools/gen-magic-strings.py to generate error messages. JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu
This commit is contained in:
@@ -172,7 +172,7 @@ ecma_op_new_array_object_from_length (ecma_length_t length) /**< length of the n
|
||||
#if JERRY_ESNEXT
|
||||
if (length > UINT32_MAX)
|
||||
{
|
||||
ecma_raise_range_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH);
|
||||
return NULL;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
@@ -757,7 +757,7 @@ ecma_op_array_species_create (ecma_object_t *original_array_p, /**< The object f
|
||||
if (!ecma_is_constructor (constructor))
|
||||
{
|
||||
ecma_free_value (constructor);
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Invalid species constructor"));
|
||||
ecma_raise_type_error (ECMA_ERR_INVALID_SPECIES_CONSTRUCTOR);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -997,7 +997,7 @@ ecma_op_array_object_set_length (ecma_object_t *object_p, /**< the array object
|
||||
|
||||
if (((ecma_number_t) new_len_uint32) != new_len_num)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH);
|
||||
}
|
||||
|
||||
/* Only the writable and data properties can be modified. */
|
||||
|
||||
@@ -190,14 +190,14 @@ ecma_arraybuffer_allocate_buffer_throw (ecma_object_t *arraybuffer_p)
|
||||
|
||||
if (ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_DETACHED)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
uint8_t *buffer_p = ecma_arraybuffer_allocate_buffer (arraybuffer_p);
|
||||
|
||||
if (buffer_p == NULL)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Cannot allocate memory for ArrayBuffer"));
|
||||
return ecma_raise_range_error (ECMA_ERR_ALLOCATE_ARRAY_BUFFER);
|
||||
}
|
||||
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
@@ -290,7 +290,7 @@ ecma_op_create_arraybuffer_object (const ecma_value_t *arguments_list_p, /**< li
|
||||
if (length_num <= -1.0 || length_num > (ecma_number_t) maximum_size_in_byte + 0.5)
|
||||
{
|
||||
ecma_deref_object (proto_p);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid ArrayBuffer length"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_ARRAYBUFFER_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -491,28 +491,28 @@ ecma_builtin_arraybuffer_slice (ecma_value_t this_arg, const ecma_value_t *argum
|
||||
if (!(ecma_object_class_is (new_arraybuffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)
|
||||
|| ecma_object_is_shared_arraybuffer (new_arraybuffer_p)))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Return value is not an ArrayBuffer object"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_RETURN_VALUE_IS_NOT_AN_ARRAYBUFFER_OBJECT);
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 14-15. */
|
||||
if (ECMA_ARRAYBUFFER_CHECK_BUFFER_ERROR (new_arraybuffer_p))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Returned ArrayBuffer has been detached"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_RETURNED_ARRAYBUFFER_HAS_BEEN_DETACHED);
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 16. */
|
||||
if (new_arraybuffer == this_arg)
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer subclass returned this from species constructor"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_ARRAY_BUFFER_RETURNED_THIS_FROM_CONSTRUCTOR);
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 17. */
|
||||
if (ecma_arraybuffer_get_length (new_arraybuffer_p) < new_len)
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Derived ArrayBuffer constructor created a too small buffer"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_DERIVED_ARRAY_BUFFER_CTOR_BUFFER_TOO_SMALL);
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-errors.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-gc.h"
|
||||
@@ -144,7 +145,7 @@ ecma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< a
|
||||
|
||||
if (result == ECMA_VALUE_UNDEFINED)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'throw' is not available"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ITERATOR_THROW_IS_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
result = ecma_async_yield_call (result, async_generator_object_p, ECMA_VALUE_EMPTY);
|
||||
@@ -351,7 +352,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl
|
||||
if (!ecma_is_value_object (value))
|
||||
{
|
||||
ecma_free_value (value);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Value received by yield* is not object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_VALUE_RECEIVED_BY_YIELD_IS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *result_obj_p = ecma_get_object_from_value (value);
|
||||
@@ -432,11 +433,11 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl
|
||||
}
|
||||
case ECMA_AWAIT_YIELD_CLOSE:
|
||||
{
|
||||
const char *msg_p = (ecma_is_value_object (value) ? ECMA_ERR_MSG ("Iterator 'throw' is not available")
|
||||
: ECMA_ERR_MSG ("Value received by yield* is not object"));
|
||||
ecma_error_msg_t msg = (ecma_is_value_object (value) ? ECMA_ERR_ITERATOR_THROW_IS_NOT_AVAILABLE
|
||||
: ECMA_ERR_VALUE_RECEIVED_BY_YIELD_IS_NOT_OBJECT);
|
||||
|
||||
ecma_free_value (value);
|
||||
return ecma_raise_type_error (msg_p);
|
||||
return ecma_raise_type_error (msg);
|
||||
}
|
||||
case ECMA_AWAIT_FOR_CLOSE:
|
||||
{
|
||||
@@ -447,7 +448,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl
|
||||
if (!is_value_object
|
||||
&& VM_GET_CONTEXT_TYPE (executable_object_p->frame_ctx.stack_top_p[-1]) != VM_CONTEXT_FINALLY_THROW)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'return' result is not object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ITERATOR_RETURN_RESULT_IS_NOT_OBJECT);
|
||||
}
|
||||
return ECMA_VALUE_EMPTY;
|
||||
}
|
||||
@@ -460,7 +461,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl
|
||||
if (!ecma_is_value_object (value))
|
||||
{
|
||||
ecma_free_value (value);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Value received by for-async-of is not object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_VALUE_RECEIVED_BY_FOR_ASYNC_OF_IS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *result_obj_p = ecma_get_object_from_value (value);
|
||||
|
||||
@@ -53,7 +53,7 @@ ecma_validate_shared_integer_typedarray (ecma_value_t typedarray, /**< typedArra
|
||||
/* 2. */
|
||||
if (!ecma_is_value_object (typedarray))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
/* 3-4. */
|
||||
@@ -65,7 +65,7 @@ ecma_validate_shared_integer_typedarray (ecma_value_t typedarray, /**< typedArra
|
||||
{
|
||||
if (!(target_info.id == ECMA_BIGINT64_ARRAY || target_info.id == ECMA_INT32_ARRAY))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not supported"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_NOT_SUPPORTED);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -73,7 +73,7 @@ ecma_validate_shared_integer_typedarray (ecma_value_t typedarray, /**< typedArra
|
||||
if (target_info.id == ECMA_UINT8_CLAMPED_ARRAY || target_info.id == ECMA_FLOAT32_ARRAY
|
||||
|| target_info.id == ECMA_FLOAT64_ARRAY)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not supported"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_NOT_SUPPORTED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ ecma_validate_shared_integer_typedarray (ecma_value_t typedarray, /**< typedArra
|
||||
|
||||
if (!ecma_object_class_is (buffer, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not SharedArrayBuffer"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_NOT_SHARED_ARRAY_BUFFER);
|
||||
}
|
||||
|
||||
return ecma_make_object_value (buffer);
|
||||
@@ -124,7 +124,7 @@ ecma_validate_atomic_access (ecma_value_t typedarray, /**< typedArray argument *
|
||||
/* 5-6. */
|
||||
if (JERRY_UNLIKELY (access_index >= target_info.length))
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid length"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_LENGTH);
|
||||
}
|
||||
|
||||
return ecma_make_number_value (access_index);
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
static ecma_value_t
|
||||
ecma_bigint_raise_memory_error (void)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Cannot allocate memory for a BigInt value"));
|
||||
return ecma_raise_range_error (ECMA_ERR_ALLOCATE_BIGINT_VALUE);
|
||||
} /* ecma_bigint_raise_memory_error */
|
||||
|
||||
/**
|
||||
@@ -172,7 +172,7 @@ ecma_bigint_parse_string (const lit_utf8_byte_t *string_p, /**< string represena
|
||||
{
|
||||
return ECMA_VALUE_FALSE;
|
||||
}
|
||||
return ecma_raise_syntax_error (ECMA_ERR_MSG ("String cannot be converted to BigInt value"));
|
||||
return ecma_raise_syntax_error (ECMA_ERR_STRING_CANNOT_BE_CONVERTED_TO_BIGINT_VALUE);
|
||||
}
|
||||
|
||||
result_p = ecma_big_uint_mul_digit (result_p, radix, digit);
|
||||
@@ -239,7 +239,7 @@ ecma_bigint_to_string (ecma_value_t value, /**< BigInt value */
|
||||
|
||||
if (JERRY_UNLIKELY (string_buffer_p == NULL))
|
||||
{
|
||||
ecma_raise_range_error (ECMA_ERR_MSG ("Cannot allocate memory for a string representation of a BigInt value"));
|
||||
ecma_raise_range_error (ECMA_ERR_ALLOCATE_BIGINT_STRING);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -382,7 +382,7 @@ ecma_bigint_number_to_bigint (ecma_number_t number) /**< ecma number */
|
||||
{
|
||||
if (ecma_number_is_nan (number) || ecma_number_is_infinity (number))
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Infinity or NaN cannot be converted to BigInt"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INFINITY_OR_NAN_CANNOT_BE_CONVERTED_TO_BIGINT);
|
||||
}
|
||||
|
||||
ecma_bigint_digit_t digits[3];
|
||||
@@ -393,7 +393,7 @@ ecma_bigint_number_to_bigint (ecma_number_t number) /**< ecma number */
|
||||
|
||||
if (result & ECMA_BIGINT_NUMBER_TO_DIGITS_HAS_FRACTION)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Only integer numbers can be converted to BigInt"));
|
||||
return ecma_raise_range_error (ECMA_ERR_ONLY_INTEGER_NUMBERS_CAN_BE_CONVERTED_TO_BIGINT);
|
||||
}
|
||||
|
||||
uint32_t digits_size = ECMA_BIGINT_NUMBER_TO_DIGITS_GET_DIGITS_SIZE (result);
|
||||
@@ -483,7 +483,7 @@ ecma_bigint_to_bigint (ecma_value_t value, /**< any value */
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ecma_raise_type_error (ECMA_ERR_MSG ("Value cannot be converted to BigInt"));
|
||||
result = ecma_raise_type_error (ECMA_ERR_VALUE_CANNOT_BE_CONVERTED_TO_BIGINT);
|
||||
}
|
||||
|
||||
if (free_value)
|
||||
@@ -665,7 +665,7 @@ ecma_bigint_get_bigint (ecma_value_t value, /**< any value */
|
||||
ecma_free_value (default_value);
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a BigInt value to a number"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONVERT_BIGINT_TO_NUMBER);
|
||||
} /* ecma_bigint_get_bigint */
|
||||
|
||||
/**
|
||||
@@ -1306,7 +1306,7 @@ ecma_bigint_div_mod (ecma_value_t left_value, /**< left BigInt value */
|
||||
|
||||
if (right_value == ECMA_BIGINT_ZERO)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("BigInt division by zero"));
|
||||
return ecma_raise_range_error (ECMA_ERR_BIGINT_ZERO_DIVISION);
|
||||
}
|
||||
|
||||
if (left_value == ECMA_BIGINT_ZERO)
|
||||
@@ -1473,7 +1473,7 @@ ecma_bigint_pow (ecma_value_t left_value, /**< left BigInt value */
|
||||
|
||||
if (right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Negative exponent is not allowed for BigInts"));
|
||||
return ecma_raise_range_error (ECMA_ERR_NEGATIVE_EXPONENT_IS_NOT_ALLOWED_FOR_BIGINTS);
|
||||
}
|
||||
|
||||
if (left_value == ECMA_BIGINT_ZERO)
|
||||
|
||||
@@ -415,7 +415,7 @@ ecma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments l
|
||||
if (!ecma_op_is_callable (result))
|
||||
{
|
||||
ecma_free_value (result);
|
||||
result = ecma_raise_type_error (ECMA_ERR_MSG ("Function add/set is not callable"));
|
||||
result = ecma_raise_type_error (ECMA_ERR_FUNCTION_ADD_ORSET_IS_NOT_CALLABLE);
|
||||
goto cleanup_object;
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ ecma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments l
|
||||
if (!ecma_is_value_object (result))
|
||||
{
|
||||
ecma_free_value (result);
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Iterator value is not an object"));
|
||||
ecma_raise_type_error (ECMA_ERR_ITERATOR_VALUE_IS_NOT_AN_OBJECT);
|
||||
result = ecma_op_iterator_close (iterator);
|
||||
JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result));
|
||||
goto cleanup_iterator;
|
||||
@@ -560,7 +560,7 @@ ecma_op_container_get_object (ecma_value_t this_arg, /**< this argument */
|
||||
"Expected a % object",
|
||||
ecma_make_string_value (ecma_get_magic_string (lit_id)));
|
||||
#else /* !JERRY_ERROR_MESSAGES */
|
||||
ecma_raise_type_error (NULL);
|
||||
ecma_raise_type_error (ECMA_ERR_EMPTY);
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
|
||||
return NULL;
|
||||
@@ -681,7 +681,7 @@ ecma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */
|
||||
|
||||
if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0 && !ecma_is_value_object (key_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Key must be an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_KEY_MUST_BE_AN_OBJECT);
|
||||
}
|
||||
|
||||
ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);
|
||||
@@ -720,7 +720,7 @@ ecma_op_container_foreach (ecma_extended_object_t *map_object_p, /**< map object
|
||||
{
|
||||
if (!ecma_op_is_callable (predicate))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_callback_is_not_callable));
|
||||
return ecma_raise_type_error (ECMA_ERR_CALLBACK_IS_NOT_CALLABLE);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_object (predicate));
|
||||
@@ -972,7 +972,7 @@ ecma_op_container_iterator_next (ecma_value_t this_val, /**< this argument */
|
||||
{
|
||||
if (!ecma_is_value_object (this_val))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (this_val);
|
||||
@@ -980,7 +980,7 @@ ecma_op_container_iterator_next (ecma_value_t this_val, /**< this argument */
|
||||
|
||||
if (!ecma_object_class_is (obj_p, iterator_type))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_ITERATOR);
|
||||
}
|
||||
|
||||
ecma_value_t iterated_value = ext_obj_p->u.cls.u3.iterated_value;
|
||||
|
||||
@@ -61,7 +61,7 @@ ecma_op_require_object_coercible (ecma_value_t value) /**< ecma value */
|
||||
|
||||
if (ecma_is_value_undefined (value) || ecma_is_value_null (value))
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Argument cannot be converted to an object"));
|
||||
ecma_raise_type_error (ECMA_ERR_ARGUMENT_CANNOT_CONVERT_TO_OBJECT);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -339,7 +339,7 @@ ecma_op_to_numeric (ecma_value_t value, /**< ecma value */
|
||||
#if JERRY_ESNEXT
|
||||
if (ecma_is_value_symbol (value))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a Symbol value to a number"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONVERT_SYMBOL_TO_NUMBER);
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
@@ -350,7 +350,7 @@ ecma_op_to_numeric (ecma_value_t value, /**< ecma value */
|
||||
{
|
||||
return ecma_copy_value (value);
|
||||
}
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a BigInt value to a number"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONVERT_BIGINT_TO_NUMBER);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
|
||||
@@ -436,7 +436,7 @@ ecma_op_to_string (ecma_value_t value) /**< ecma value */
|
||||
#if JERRY_ESNEXT
|
||||
if (ecma_is_value_symbol (value))
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a Symbol value to a string"));
|
||||
ecma_raise_type_error (ECMA_ERR_CONVERT_SYMBOL_TO_STRING);
|
||||
return NULL;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
@@ -564,7 +564,7 @@ ecma_op_to_object (ecma_value_t value) /**< ecma 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"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_CANNOT_CONVERT_TO_OBJECT);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -695,7 +695,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
/* 1. */
|
||||
if (!ecma_is_value_object (obj_value))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Expected an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_EXPECTED_AN_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (obj_value);
|
||||
@@ -786,7 +786,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
if (!ecma_op_is_callable (get_prop_value) && !ecma_is_value_undefined (get_prop_value))
|
||||
{
|
||||
ecma_free_value (get_prop_value);
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION);
|
||||
goto free_desc;
|
||||
}
|
||||
|
||||
@@ -822,7 +822,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
if (!ecma_op_is_callable (set_prop_value) && !ecma_is_value_undefined (set_prop_value))
|
||||
{
|
||||
ecma_free_value (set_prop_value);
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION);
|
||||
goto free_desc;
|
||||
}
|
||||
|
||||
@@ -849,7 +849,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
if ((prop_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED))
|
||||
&& (prop_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Accessors cannot be writable"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_ACCESSOR_WRITABLE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1035,7 +1035,7 @@ ecma_op_to_index (ecma_value_t value, /**< ecma value */
|
||||
/* 2.b - 2.d */
|
||||
if (integer_index < 0.0f || integer_index > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid or out-of-range index"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_OR_OUT_OF_RANGE_INDEX);
|
||||
}
|
||||
|
||||
/* 3. */
|
||||
@@ -1064,7 +1064,7 @@ ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */
|
||||
/* 3. */
|
||||
if (!ecma_is_value_object (arr))
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);
|
||||
return NULL;
|
||||
}
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (arr);
|
||||
@@ -1093,7 +1093,7 @@ ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */
|
||||
{
|
||||
ecma_free_value (next);
|
||||
ecma_collection_free (list_ptr);
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Property name is neither Symbol nor string"));
|
||||
ecma_raise_type_error (ECMA_ERR_PROPERTY_NAME_IS_NEITHER_SYMBOL_NOR_STRING);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li
|
||||
/* 2. */
|
||||
if (!ecma_is_value_object (buffer))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'buffer' is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_BUFFER_NOT_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *buffer_p = ecma_get_object_from_value (buffer);
|
||||
@@ -66,7 +66,7 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li
|
||||
if (!(ecma_object_class_is (buffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)
|
||||
|| ecma_object_is_shared_arraybuffer (buffer_p)))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'buffer' is not an ArrayBuffer or SharedArrayBuffer"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_BUFFER_NOT_ARRAY_OR_SHARED_BUFFER);
|
||||
}
|
||||
|
||||
/* 3. */
|
||||
@@ -84,7 +84,7 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li
|
||||
/* 4. */
|
||||
if (ecma_arraybuffer_is_detached (buffer_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
@@ -93,7 +93,7 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li
|
||||
/* 6. */
|
||||
if (offset > buffer_byte_length)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Start offset is outside the bounds of the buffer"));
|
||||
return ecma_raise_range_error (ECMA_ERR_START_OFFSET_IS_OUTSIDE_THE_BOUNDS_OF_THE_BUFFER);
|
||||
}
|
||||
|
||||
/* 7. */
|
||||
@@ -112,7 +112,7 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li
|
||||
/* 8.b */
|
||||
if (offset + byte_length_to_index > buffer_byte_length)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Start offset is outside the bounds of the buffer"));
|
||||
return ecma_raise_range_error (ECMA_ERR_START_OFFSET_IS_OUTSIDE_THE_BOUNDS_OF_THE_BUFFER);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (byte_length_to_index <= UINT32_MAX);
|
||||
@@ -136,7 +136,7 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li
|
||||
if (ecma_arraybuffer_is_detached (buffer_p))
|
||||
{
|
||||
ecma_deref_object (prototype_obj_p);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
/* 9. */
|
||||
@@ -179,7 +179,7 @@ ecma_op_dataview_get_object (ecma_value_t this_arg) /**< this argument */
|
||||
}
|
||||
}
|
||||
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Expected a DataView object"));
|
||||
ecma_raise_type_error (ECMA_ERR_EXPECTED_A_DATAVIEW_OBJECT);
|
||||
return NULL;
|
||||
} /* ecma_op_dataview_get_object */
|
||||
|
||||
@@ -317,7 +317,7 @@ ecma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'vi
|
||||
if (get_index + element_size > (ecma_number_t) view_size)
|
||||
{
|
||||
ecma_free_value (value_to_set);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Start offset is outside the bounds of the buffer"));
|
||||
return ecma_raise_range_error (ECMA_ERR_START_OFFSET_IS_OUTSIDE_THE_BOUNDS_OF_THE_BUFFER);
|
||||
}
|
||||
|
||||
if (ECMA_ARRAYBUFFER_CHECK_BUFFER_ERROR (buffer_p))
|
||||
|
||||
@@ -98,7 +98,7 @@ ecma_op_eval_chars_buffer (void *source_p, /**< source code */
|
||||
JERRY_UNUSED (code_buffer_size);
|
||||
JERRY_UNUSED (parse_opts);
|
||||
|
||||
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Source code parsing is disabled"));
|
||||
return ecma_raise_syntax_error (ECMA_ERR_PARSER_NOT_SUPPORTED);
|
||||
#endif /* JERRY_PARSER */
|
||||
} /* ecma_op_eval_chars_buffer */
|
||||
|
||||
|
||||
@@ -298,7 +298,7 @@ ecma_get_error_type (ecma_object_t *error_object_p) /**< possible error object *
|
||||
* @return ecma value
|
||||
* Returned value must be freed with ecma_free_value
|
||||
*/
|
||||
static ecma_value_t
|
||||
ecma_value_t
|
||||
ecma_raise_standard_error (jerry_error_t error_type, /**< error type */
|
||||
const lit_utf8_byte_t *msg_p) /**< error message */
|
||||
{
|
||||
@@ -414,9 +414,9 @@ ecma_raise_standard_error_with_format (jerry_error_t error_type, /**< error type
|
||||
* Returned value must be freed with ecma_free_value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_raise_common_error (const char *msg_p) /**< error message */
|
||||
ecma_raise_common_error (ecma_error_msg_t msg) /**< error message */
|
||||
{
|
||||
return ecma_raise_standard_error (JERRY_ERROR_COMMON, (const lit_utf8_byte_t *) msg_p);
|
||||
return ecma_raise_standard_error (JERRY_ERROR_COMMON, ecma_get_error_utf8 (msg));
|
||||
} /* ecma_raise_common_error */
|
||||
|
||||
/**
|
||||
@@ -428,9 +428,9 @@ ecma_raise_common_error (const char *msg_p) /**< error message */
|
||||
* Returned value must be freed with ecma_free_value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_raise_range_error (const char *msg_p) /**< error message */
|
||||
ecma_raise_range_error (ecma_error_msg_t msg) /**< error message */
|
||||
{
|
||||
return ecma_raise_standard_error (JERRY_ERROR_RANGE, (const lit_utf8_byte_t *) msg_p);
|
||||
return ecma_raise_standard_error (JERRY_ERROR_RANGE, ecma_get_error_utf8 (msg));
|
||||
} /* ecma_raise_range_error */
|
||||
|
||||
/**
|
||||
@@ -442,9 +442,9 @@ ecma_raise_range_error (const char *msg_p) /**< error message */
|
||||
* Returned value must be freed with ecma_free_value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_raise_reference_error (const char *msg_p) /**< error message */
|
||||
ecma_raise_reference_error (ecma_error_msg_t msg) /**< error message */
|
||||
{
|
||||
return ecma_raise_standard_error (JERRY_ERROR_REFERENCE, (const lit_utf8_byte_t *) msg_p);
|
||||
return ecma_raise_standard_error (JERRY_ERROR_REFERENCE, ecma_get_error_utf8 (msg));
|
||||
} /* ecma_raise_reference_error */
|
||||
|
||||
/**
|
||||
@@ -456,9 +456,9 @@ ecma_raise_reference_error (const char *msg_p) /**< error message */
|
||||
* Returned value must be freed with ecma_free_value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_raise_syntax_error (const char *msg_p) /**< error message */
|
||||
ecma_raise_syntax_error (ecma_error_msg_t msg) /**< error message */
|
||||
{
|
||||
return ecma_raise_standard_error (JERRY_ERROR_SYNTAX, (const lit_utf8_byte_t *) msg_p);
|
||||
return ecma_raise_standard_error (JERRY_ERROR_SYNTAX, ecma_get_error_utf8 (msg));
|
||||
} /* ecma_raise_syntax_error */
|
||||
|
||||
/**
|
||||
@@ -470,9 +470,9 @@ ecma_raise_syntax_error (const char *msg_p) /**< error message */
|
||||
* Returned value must be freed with ecma_free_value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_raise_type_error (const char *msg_p) /**< error message */
|
||||
ecma_raise_type_error (ecma_error_msg_t msg) /**< error message */
|
||||
{
|
||||
return ecma_raise_standard_error (JERRY_ERROR_TYPE, (const lit_utf8_byte_t *) msg_p);
|
||||
return ecma_raise_standard_error (JERRY_ERROR_TYPE, ecma_get_error_utf8 (msg));
|
||||
} /* ecma_raise_type_error */
|
||||
|
||||
/**
|
||||
@@ -484,11 +484,25 @@ ecma_raise_type_error (const char *msg_p) /**< error message */
|
||||
* Returned value must be freed with ecma_free_value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_raise_uri_error (const char *msg_p) /**< error message */
|
||||
ecma_raise_uri_error (ecma_error_msg_t msg) /**< error message */
|
||||
{
|
||||
return ecma_raise_standard_error (JERRY_ERROR_URI, (const lit_utf8_byte_t *) msg_p);
|
||||
return ecma_raise_standard_error (JERRY_ERROR_URI, ecma_get_error_utf8 (msg));
|
||||
} /* ecma_raise_uri_error */
|
||||
|
||||
#if (JERRY_STACK_LIMIT != 0)
|
||||
/**
|
||||
* Raise a RangeError with "Maximum call stack size exceeded" message.
|
||||
*
|
||||
* @return ecma value
|
||||
* Returned value must be freed with ecma_free_value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_raise_maximum_callstack_error (void)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MAXIMUM_CALL_STACK_SIZE_EXCEEDED);
|
||||
} /* ecma_raise_maximum_callstack_error */
|
||||
#endif /* (JERRY_STACK_LIMIT != 0) */
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,23 +27,21 @@
|
||||
* @{
|
||||
*/
|
||||
|
||||
#if JERRY_ERROR_MESSAGES
|
||||
#define ECMA_ERR_MSG(msg) msg
|
||||
#else /* !JERRY_ERROR_MESSAGES */
|
||||
#define ECMA_ERR_MSG(msg) NULL
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
|
||||
jerry_error_t ecma_get_error_type (ecma_object_t *error_object_p);
|
||||
ecma_object_t *ecma_new_standard_error (jerry_error_t error_type, ecma_string_t *message_string_p);
|
||||
#if JERRY_ERROR_MESSAGES
|
||||
ecma_value_t ecma_raise_standard_error_with_format (jerry_error_t error_type, const char *msg_p, ...);
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
ecma_value_t ecma_raise_common_error (const char *msg_p);
|
||||
ecma_value_t ecma_raise_range_error (const char *msg_p);
|
||||
ecma_value_t ecma_raise_reference_error (const char *msg_p);
|
||||
ecma_value_t ecma_raise_syntax_error (const char *msg_p);
|
||||
ecma_value_t ecma_raise_type_error (const char *msg_p);
|
||||
ecma_value_t ecma_raise_uri_error (const char *msg_p);
|
||||
ecma_value_t ecma_raise_standard_error (jerry_error_t error_type, const lit_utf8_byte_t *msg_p);
|
||||
ecma_value_t ecma_raise_common_error (ecma_error_msg_t msg);
|
||||
ecma_value_t ecma_raise_range_error (ecma_error_msg_t msg);
|
||||
ecma_value_t ecma_raise_reference_error (ecma_error_msg_t msg);
|
||||
ecma_value_t ecma_raise_syntax_error (ecma_error_msg_t msg);
|
||||
ecma_value_t ecma_raise_type_error (ecma_error_msg_t msg);
|
||||
ecma_value_t ecma_raise_uri_error (ecma_error_msg_t msg);
|
||||
#if (JERRY_STACK_LIMIT != 0)
|
||||
ecma_value_t ecma_raise_maximum_callstack_error (void);
|
||||
#endif /* (JERRY_STACK_LIMIT != 0) */
|
||||
#if JERRY_ESNEXT
|
||||
ecma_value_t ecma_new_aggregate_error (ecma_value_t error_list_val, ecma_value_t message_val);
|
||||
ecma_value_t ecma_raise_aggregate_error (ecma_value_t error_list_val, ecma_value_t message_val);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "ecma-alloc.h"
|
||||
#include "ecma-builtin-handlers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-errors.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-extended-info.h"
|
||||
#include "ecma-gc.h"
|
||||
@@ -153,9 +154,9 @@ ecma_op_is_callable (ecma_value_t value) /**< ecma value */
|
||||
*
|
||||
*
|
||||
* @return ECMA_IS_VALID_CONSTRUCTOR - if object is a valid for constructor call
|
||||
* any other value - if object is not a valid constructor, the pointer contains the error message.
|
||||
* ecma_error_msg_t id of error - otherwise
|
||||
*/
|
||||
char *
|
||||
ecma_error_msg_t
|
||||
ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
|
||||
{
|
||||
JERRY_ASSERT (!ecma_is_lexical_environment (obj_p));
|
||||
@@ -164,7 +165,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
|
||||
|
||||
if (JERRY_UNLIKELY (type < ECMA_OBJECT_TYPE_PROXY))
|
||||
{
|
||||
return ECMA_ERR_MSG ("Invalid type for constructor call");
|
||||
return ECMA_ERR_INVALID_TYPE_FOR_CONSTRUCTOR_CALL;
|
||||
}
|
||||
|
||||
while (JERRY_UNLIKELY (type == ECMA_OBJECT_TYPE_BOUND_FUNCTION))
|
||||
@@ -189,40 +190,40 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
|
||||
{
|
||||
case CBC_FUNCTION_SCRIPT:
|
||||
{
|
||||
return "Script (global) functions cannot be invoked with 'new'";
|
||||
return ECMA_ERR_SCRIPT_GLOBAL_FUNCTIONS_INVOKE_WITH_NEW;
|
||||
}
|
||||
case CBC_FUNCTION_GENERATOR:
|
||||
{
|
||||
return "Generator functions cannot be invoked with 'new'";
|
||||
return ECMA_ERR_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW;
|
||||
}
|
||||
case CBC_FUNCTION_ASYNC:
|
||||
{
|
||||
return "Async functions cannot be invoked with 'new'";
|
||||
return ECMA_ERR_ASYNC_FUNCTIONS_INVOKE_WITH_NEW;
|
||||
}
|
||||
case CBC_FUNCTION_ASYNC_GENERATOR:
|
||||
{
|
||||
return "Async generator functions cannot be invoked with 'new'";
|
||||
return ECMA_ERR_ASYNC_GENERATOR_FUNCTIONS_INVOKE_WITH_NEW;
|
||||
}
|
||||
case CBC_FUNCTION_ACCESSOR:
|
||||
{
|
||||
return "Accessor functions cannot be invoked with 'new'";
|
||||
return ECMA_ERR_ACCESSOR_FUNCTIONS_INVOKE_WITH_NEW;
|
||||
}
|
||||
case CBC_FUNCTION_METHOD:
|
||||
{
|
||||
return "Methods cannot be invoked with 'new'";
|
||||
return ECMA_ERR_METHODS_INVOKE_WITH_NEW;
|
||||
}
|
||||
case CBC_FUNCTION_ARROW:
|
||||
{
|
||||
return "Arrow functions cannot be invoked with 'new'";
|
||||
return ECMA_ERR_ARROW_FUNCTIONS_INVOKE_WITH_NEW;
|
||||
}
|
||||
default:
|
||||
{
|
||||
JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (byte_code_p->status_flags) == CBC_FUNCTION_ASYNC_ARROW);
|
||||
return "Async arrow functions cannot be invoked with 'new'";
|
||||
return ECMA_ERR_ASYNC_ARROW_FUNCTIONS_INVOKE_WITH_NEW;
|
||||
}
|
||||
}
|
||||
#else /* !JERRY_ERROR_MESSAGES */
|
||||
return NULL;
|
||||
return ECMA_ERR_EMPTY;
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
}
|
||||
#endif /* JERRY_NEXT */
|
||||
@@ -235,7 +236,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
|
||||
{
|
||||
if (!(obj_p->u2.prototype_cp & ECMA_PROXY_IS_CONSTRUCTABLE))
|
||||
{
|
||||
return ECMA_ERR_MSG ("Proxy target is not a constructor");
|
||||
return ECMA_ERR_PROXY_TARGET_IS_NOT_A_CONSTRUCTOR;
|
||||
}
|
||||
|
||||
return ECMA_IS_VALID_CONSTRUCTOR;
|
||||
@@ -249,7 +250,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
|
||||
{
|
||||
if (ecma_builtin_function_is_routine (obj_p))
|
||||
{
|
||||
return ECMA_ERR_MSG ("Built-in routines have no constructor");
|
||||
return ECMA_ERR_BULTIN_ROUTINES_HAVE_NO_CONSTRUCTOR;
|
||||
}
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
@@ -264,14 +265,14 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
|
||||
* Implement IsConstructor abstract operation.
|
||||
*
|
||||
* @return ECMA_IS_VALID_CONSTRUCTOR - if the input value is a constructor.
|
||||
* any other value - if the input value is not a valid constructor, the pointer contains the error message.
|
||||
* ecma_error_msg_t id of error - otherwise
|
||||
*/
|
||||
extern inline char *JERRY_ATTR_ALWAYS_INLINE
|
||||
extern inline ecma_error_msg_t JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_check_constructor (ecma_value_t value) /**< ecma object */
|
||||
{
|
||||
if (!ecma_is_value_object (value))
|
||||
{
|
||||
return ECMA_ERR_MSG ("Invalid type for constructor call");
|
||||
return ECMA_ERR_INVALID_TYPE_FOR_CONSTRUCTOR_CALL;
|
||||
}
|
||||
|
||||
return ecma_object_check_constructor (ecma_get_object_from_value (value));
|
||||
@@ -824,7 +825,7 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob
|
||||
ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) func_obj_p;
|
||||
if (ecma_is_value_null (proxy_obj_p->handler))
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Prototype from revoked Proxy is invalid"));
|
||||
ecma_raise_type_error (ECMA_ERR_PROTOTYPE_FROM_REVOKED_PROXY_IS_INVALID);
|
||||
return NULL;
|
||||
}
|
||||
func_obj_p = ecma_get_object_from_value (proxy_obj_p->target);
|
||||
@@ -888,7 +889,7 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
|
||||
if (!ecma_is_value_object (prototype_obj_value))
|
||||
{
|
||||
ecma_free_value (prototype_obj_value);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Object expected"));
|
||||
return ecma_raise_type_error (ECMA_ERR_OBJECT_EXPECTED);
|
||||
}
|
||||
|
||||
ecma_object_t *prototype_obj_p = ecma_get_object_from_value (prototype_obj_value);
|
||||
@@ -959,7 +960,7 @@ ecma_op_function_get_super_constructor (ecma_object_t *func_obj_p) /**< function
|
||||
{
|
||||
ecma_deref_object (super_ctor_p);
|
||||
}
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Super binding must be a constructor"));
|
||||
return ecma_raise_type_error (ECMA_ERR_SUPER_BINDING_MUST_BE_A_CONSTRUCTOR);
|
||||
}
|
||||
|
||||
return ecma_make_object_value (super_ctor_p);
|
||||
@@ -1002,7 +1003,7 @@ ecma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, /**< construc
|
||||
ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) ctor_obj_p;
|
||||
if (ecma_is_value_null (proxy_obj_p->handler))
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Prototype from revoked Proxy is invalid"));
|
||||
ecma_raise_type_error (ECMA_ERR_PROTOTYPE_FROM_REVOKED_PROXY_IS_INVALID);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1042,7 +1043,7 @@ ecma_op_function_call_constructor (vm_frame_ctx_shared_args_t *shared_args_p, /*
|
||||
|
||||
if (JERRY_CONTEXT (current_new_target_p) == NULL)
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Class constructor requires 'new'"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_CLASS_CONSTRUCTOR_REQUIRES_NEW);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -1073,7 +1074,7 @@ ecma_op_function_call_constructor (vm_frame_ctx_shared_args_t *shared_args_p, /*
|
||||
if (!ecma_is_value_undefined (ret_value))
|
||||
{
|
||||
ecma_free_value (ret_value);
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Derived constructors may only return object or undefined"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_DERIVED_CTOR_RETURN_NOR_OBJECT_OR_UNDEFINED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1395,7 +1396,7 @@ ecma_op_function_validated_call (ecma_value_t callee, /**< callee */
|
||||
{
|
||||
if (!ecma_is_value_object (callee))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function));
|
||||
return ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION);
|
||||
}
|
||||
|
||||
return ecma_op_function_call (ecma_get_object_from_value (callee),
|
||||
@@ -1453,7 +1454,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
#if JERRY_ESNEXT
|
||||
case ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION:
|
||||
{
|
||||
result = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_class_constructor_new));
|
||||
result = ecma_raise_type_error (ECMA_ERR_CLASS_CONSTRUCTOR_NEW);
|
||||
break;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
@@ -1469,7 +1470,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
|
||||
}
|
||||
default:
|
||||
{
|
||||
result = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function));
|
||||
result = ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,10 +46,9 @@ bool ecma_object_is_constructor (ecma_object_t *obj_p);
|
||||
*
|
||||
* Use after the ecma_*_check_constructor calls.
|
||||
*/
|
||||
#define ECMA_IS_VALID_CONSTRUCTOR ((char *) 0x1)
|
||||
|
||||
char *ecma_object_check_constructor (ecma_object_t *obj_p);
|
||||
char *ecma_check_constructor (ecma_value_t value);
|
||||
ecma_error_msg_t ecma_object_check_constructor (ecma_object_t *obj_p);
|
||||
ecma_error_msg_t ecma_check_constructor (ecma_value_t value);
|
||||
|
||||
ecma_object_t *ecma_op_create_simple_function_object (ecma_object_t *scope_p,
|
||||
const ecma_compiled_code_t *bytecode_data_p);
|
||||
|
||||
@@ -65,7 +65,7 @@ ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))
|
||||
{
|
||||
return ecma_raise_reference_error (ECMA_ERR_MSG (ecma_error_let_const_not_initialized));
|
||||
return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
@@ -93,7 +93,7 @@ ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
|
||||
if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))
|
||||
{
|
||||
return ecma_raise_reference_error (ECMA_ERR_MSG (ecma_error_let_const_not_initialized));
|
||||
return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);
|
||||
}
|
||||
|
||||
return ecma_fast_copy_value (property_value_p->value);
|
||||
@@ -134,7 +134,7 @@ ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
"% is not defined",
|
||||
ecma_make_string_value (name_p));
|
||||
#else /* JERRY_ERROR_MESSAGES */
|
||||
return ecma_raise_reference_error (NULL);
|
||||
return ecma_raise_reference_error (ECMA_ERR_EMPTY);
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
|
||||
} /* ecma_op_get_value_lex_env_base */
|
||||
@@ -322,7 +322,7 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
|
||||
"% is not defined",
|
||||
ecma_make_string_value (name_p));
|
||||
#else /* !JERRY_ERROR_MESSAGES */
|
||||
return ecma_raise_reference_error (NULL);
|
||||
return ecma_raise_reference_error (ECMA_ERR_EMPTY);
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +259,7 @@ ecma_op_get_iterator (ecma_value_t value, /**< value to get iterator from */
|
||||
if (!ecma_is_value_object (iterator))
|
||||
{
|
||||
ecma_free_value (iterator);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ITERATOR_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (iterator);
|
||||
@@ -305,7 +305,7 @@ ecma_op_iterator_next (ecma_value_t iterator, /**< iterator value */
|
||||
/* 1 - 2. */
|
||||
if (next_method == ECMA_VALUE_UNDEFINED)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'next' is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ITERATOR_NEXT_IS_NOT_CALLABLE);
|
||||
}
|
||||
|
||||
ecma_object_t *next_method_obj_p = ecma_get_object_from_value (next_method);
|
||||
@@ -391,7 +391,7 @@ ecma_op_iterator_throw (ecma_value_t iterator, /**< iterator value */
|
||||
}
|
||||
|
||||
ecma_free_value (result);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'throw' is not available"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ITERATOR_THROW_IS_NOT_AVAILABLE);
|
||||
}
|
||||
|
||||
ecma_value_t result = ecma_op_function_validated_call (func_throw, iterator, &value, 1);
|
||||
@@ -530,7 +530,7 @@ ecma_op_iterator_close (ecma_value_t iterator) /**< iterator value */
|
||||
if (!is_object)
|
||||
{
|
||||
ecma_free_value (completion);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("method 'return' is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_METHOD_RETURN_IS_NOT_CALLABLE);
|
||||
}
|
||||
|
||||
/* 10. */
|
||||
@@ -570,7 +570,7 @@ ecma_op_iterator_step (ecma_value_t iterator, /**< iterator value */
|
||||
if (!ecma_is_value_object (result))
|
||||
{
|
||||
ecma_free_value (result);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator result is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ITERATOR_RESULT_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
|
||||
/* 3. */
|
||||
@@ -638,7 +638,7 @@ ecma_op_iterator_do (ecma_iterator_command_type_t command, /**< command to be ex
|
||||
if (!ecma_is_value_object (result))
|
||||
{
|
||||
ecma_free_value (result);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator result is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ITERATOR_RESULT_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (result);
|
||||
|
||||
@@ -110,18 +110,18 @@ ecma_op_raise_set_binding_error (ecma_property_t *property_p, /**< property */
|
||||
|
||||
if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))
|
||||
{
|
||||
return ecma_raise_reference_error (ECMA_ERR_MSG (ecma_error_let_const_not_initialized));
|
||||
return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (!ecma_is_property_writable (*property_p));
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constant bindings cannot be reassigned"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTANT_BINDINGS_CANNOT_BE_REASSIGNED);
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
if (is_strict)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Binding cannot be set"));
|
||||
return ecma_raise_type_error (ECMA_ERR_BINDING_CANNOT_SET);
|
||||
}
|
||||
return ECMA_VALUE_EMPTY;
|
||||
} /* ecma_op_raise_set_binding_error */
|
||||
@@ -387,7 +387,7 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
|
||||
{
|
||||
if (is_strict)
|
||||
{
|
||||
result = ecma_raise_reference_error (ECMA_ERR_MSG ("Binding does not exist or is uninitialised"));
|
||||
result = ecma_raise_reference_error (ECMA_ERR_BINDING_NOT_EXIST_OR_UNINITIALIZED);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -636,8 +636,7 @@ ecma_op_get_this_binding (ecma_object_t *lex_env_p) /**< lexical environment */
|
||||
|
||||
if (this_value == ECMA_VALUE_UNINITIALIZED)
|
||||
{
|
||||
return ecma_raise_reference_error (ECMA_ERR_MSG ("Must call super constructor in derived class before "
|
||||
"accessing 'this' or returning from it"));
|
||||
return ecma_raise_reference_error (ECMA_ERR_CALL_SUPER_CONSTRUCTOR_DERIVED_CLASS_BEFORE_THIS);
|
||||
}
|
||||
|
||||
ecma_ref_object (ecma_get_object_from_value (this_value));
|
||||
|
||||
@@ -112,7 +112,7 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */
|
||||
/* 4. */
|
||||
if (is_throw)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Expected a configurable property"));
|
||||
return ecma_raise_type_error (ECMA_ERR_EXPECTED_A_CONFIGURABLE_PROPERTY);
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
@@ -258,7 +258,7 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
|
||||
|
||||
ecma_free_value (result);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Result of [[DefaultValue]] is invalid"));
|
||||
return ecma_raise_type_error (ECMA_ERR_RESULT_OF_DEFAULTVALUE_IS_INVALID);
|
||||
}
|
||||
|
||||
ecma_free_value (exotic_to_prim);
|
||||
@@ -330,7 +330,7 @@ ecma_op_general_object_ordinary_value (ecma_object_t *obj_p, /**< the object */
|
||||
ecma_free_value (call_completion);
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Result of [[DefaultValue]] is invalid"));
|
||||
return ecma_raise_type_error (ECMA_ERR_RESULT_OF_DEFAULTVALUE_IS_INVALID);
|
||||
} /* ecma_op_general_object_ordinary_value */
|
||||
|
||||
/**
|
||||
@@ -475,7 +475,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
|
||||
{
|
||||
if (JERRY_UNLIKELY (ext_property_ref.property_ref.virtual_value == ECMA_VALUE_UNINITIALIZED))
|
||||
{
|
||||
return ecma_raise_reference_error (ECMA_ERR_MSG (ecma_error_let_const_not_initialized));
|
||||
return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);
|
||||
}
|
||||
|
||||
if (property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED)
|
||||
|
||||
@@ -614,7 +614,7 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
|
||||
|
||||
if (JERRY_UNLIKELY (prop_value_p->value == ECMA_VALUE_UNINITIALIZED))
|
||||
{
|
||||
return ecma_raise_reference_error (ECMA_ERR_MSG (ecma_error_let_const_not_initialized));
|
||||
return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1096,7 +1096,7 @@ ecma_op_get_method (ecma_value_t value, /**< ecma value */
|
||||
if (!ecma_op_is_callable (func))
|
||||
{
|
||||
ecma_free_value (func);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ITERATOR_IS_NOT_CALLABLE);
|
||||
}
|
||||
|
||||
/* 6. */
|
||||
@@ -1219,7 +1219,7 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
|
||||
/* 5.b */
|
||||
if (!ecma_is_value_object (receiver))
|
||||
{
|
||||
return ECMA_REJECT (is_throw, "Receiver must be an object");
|
||||
return ECMA_REJECT (is_throw, ECMA_ERR_RECEIVER_MUST_BE_AN_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *receiver_obj_p = ecma_get_object_from_value (receiver);
|
||||
@@ -1257,7 +1257,7 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
|
||||
|
||||
if (JERRY_UNLIKELY (ecma_is_value_false (result)))
|
||||
{
|
||||
result = ECMA_REJECT (is_throw, "Proxy trap returned falsish");
|
||||
result = ECMA_REJECT (is_throw, ECMA_ERR_PROXY_TRAP_RETURNED_FALSISH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1279,7 +1279,7 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
|
||||
|
||||
if (JERRY_UNLIKELY (ecma_is_value_false (ret_value)))
|
||||
{
|
||||
ret_value = ECMA_REJECT (is_throw, "Proxy trap returned falsish");
|
||||
ret_value = ECMA_REJECT (is_throw, ECMA_ERR_PROXY_TRAP_RETURNED_FALSISH);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
@@ -1906,7 +1906,7 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
if (JERRY_UNLIKELY (property_ref.virtual_value == ECMA_VALUE_UNINITIALIZED))
|
||||
{
|
||||
return ecma_raise_reference_error (ECMA_ERR_MSG (ecma_error_let_const_not_initialized));
|
||||
return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);
|
||||
}
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
prop_desc_p->value = property_ref.virtual_value;
|
||||
@@ -1990,7 +1990,7 @@ ecma_op_object_has_instance (ecma_object_t *obj_p, /**< the object */
|
||||
return ecma_op_function_has_instance (obj_p, value);
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION_OBJECT);
|
||||
} /* ecma_op_object_has_instance */
|
||||
|
||||
/**
|
||||
@@ -3131,7 +3131,7 @@ ecma_op_species_constructor (ecma_object_t *this_value, /**< This Value */
|
||||
if (!ecma_is_value_object (constructor))
|
||||
{
|
||||
ecma_free_value (constructor);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor must be an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_NOT_AN_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *ctor_object_p = ecma_get_object_from_value (constructor);
|
||||
@@ -3152,7 +3152,7 @@ ecma_op_species_constructor (ecma_object_t *this_value, /**< This Value */
|
||||
if (!ecma_is_constructor (species))
|
||||
{
|
||||
ecma_free_value (species);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Species must be a constructor"));
|
||||
return ecma_raise_type_error (ECMA_ERR_SPECIES_MUST_BE_A_CONSTRUCTOR);
|
||||
}
|
||||
|
||||
return species;
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
/**
|
||||
* Reject with TypeError depending on is_throw flags wit the given message
|
||||
*/
|
||||
#define ECMA_REJECT(is_throw, msg) ((is_throw) ? ecma_raise_type_error (NULL) : ECMA_VALUE_FALSE)
|
||||
#define ECMA_REJECT(is_throw, msg) ((is_throw) ? ecma_raise_type_error (ECMA_ERR_EMPTY) : ECMA_VALUE_FALSE)
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
|
||||
ecma_value_t ecma_raise_property_redefinition (ecma_string_t *property_name_p, uint16_t flags);
|
||||
|
||||
@@ -250,7 +250,7 @@ ecma_fulfill_promise (ecma_value_t promise, /**< promise */
|
||||
|
||||
if (promise == value)
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("A promise cannot be resolved with itself"));
|
||||
ecma_raise_type_error (ECMA_ERR_PROMISE_RESOLVE_ITSELF);
|
||||
ecma_value_t exception = jcontext_take_exception ();
|
||||
ecma_reject_promise (promise, exception);
|
||||
ecma_free_value (exception);
|
||||
@@ -699,13 +699,13 @@ ecma_op_get_capabilities_executor_cb (ecma_object_t *function_obj_p, /**< functi
|
||||
/* 4. */
|
||||
if (!ecma_is_value_undefined (capability_p->resolve))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Resolve must be undefined"));
|
||||
return ecma_raise_type_error (ECMA_ERR_RESOLVE_MUST_BE_UNDEFINED);
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
if (!ecma_is_value_undefined (capability_p->reject))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Reject must be undefined"));
|
||||
return ecma_raise_type_error (ECMA_ERR_REJECT_MUST_BE_UNDEFINED);
|
||||
}
|
||||
|
||||
/* 6. */
|
||||
@@ -732,7 +732,7 @@ ecma_promise_new_capability (ecma_value_t constructor, /**< constructor function
|
||||
/* 1. */
|
||||
if (!ecma_is_constructor (constructor))
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Invalid capability"));
|
||||
ecma_raise_type_error (ECMA_ERR_INVALID_CAPABILITY);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -783,7 +783,7 @@ ecma_promise_new_capability (ecma_value_t constructor, /**< constructor function
|
||||
{
|
||||
ecma_free_value (promise);
|
||||
ecma_deref_object (capability_obj_p);
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("'resolve' parameter must be callable"));
|
||||
ecma_raise_type_error (ECMA_ERR_PARAMETER_RESOLVE_MUST_BE_CALLABLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -792,7 +792,7 @@ ecma_promise_new_capability (ecma_value_t constructor, /**< constructor function
|
||||
{
|
||||
ecma_free_value (promise);
|
||||
ecma_deref_object (capability_obj_p);
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("'reject' parameter must be callable"));
|
||||
ecma_raise_type_error (ECMA_ERR_PARAMETER_REJECT_MUST_BE_CALLABLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -818,7 +818,7 @@ ecma_promise_reject_or_resolve (ecma_value_t this_arg, /**< "this" argument */
|
||||
{
|
||||
if (!ecma_is_value_object (this_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
if (is_resolve && ecma_is_value_object (value) && ecma_is_promise (ecma_get_object_from_value (value)))
|
||||
@@ -882,14 +882,14 @@ ecma_promise_then (ecma_value_t promise, /**< the promise which call 'then' */
|
||||
{
|
||||
if (!ecma_is_value_object (promise))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *obj = ecma_get_object_from_value (promise);
|
||||
|
||||
if (!ecma_is_promise (obj))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Promise"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_PROMISE);
|
||||
}
|
||||
|
||||
ecma_value_t species = ecma_op_species_constructor (obj, ECMA_BUILTIN_ID_PROMISE);
|
||||
@@ -1064,7 +1064,7 @@ ecma_promise_finally (ecma_value_t promise, /**< the promise which call 'finally
|
||||
/* 2. */
|
||||
if (!ecma_is_value_object (promise))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *obj = ecma_get_object_from_value (promise);
|
||||
|
||||
@@ -57,7 +57,7 @@ ecma_proxy_create (ecma_value_t target, /**< proxy target */
|
||||
/* ES11+: 1 - 2. */
|
||||
if (!ecma_is_value_object (target) || !ecma_is_value_object (handler))
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Cannot create Proxy with a non-object target or handler"));
|
||||
ecma_raise_type_error (ECMA_ERR_CANNOT_CREATE_PROXY);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -240,7 +240,7 @@ ecma_validate_proxy_object (ecma_value_t handler, /**< proxy handler */
|
||||
{
|
||||
if (ecma_is_value_null (handler))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Handler cannot be null"));
|
||||
return ecma_raise_type_error (ECMA_ERR_HANDLER_CANNOT_BE_NULL);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_object (handler));
|
||||
@@ -308,7 +308,7 @@ ecma_proxy_object_get_prototype_of (ecma_object_t *obj_p) /**< proxy object */
|
||||
{
|
||||
ecma_free_value (handler_proto);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned neither object nor null"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TRAP_RETURNED_NEITHER_OBJECT_NOR_NULL);
|
||||
}
|
||||
|
||||
if (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)
|
||||
@@ -349,8 +349,7 @@ ecma_proxy_object_get_prototype_of (ecma_object_t *obj_p) /**< proxy object */
|
||||
{
|
||||
ecma_free_value (handler_proto);
|
||||
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Proxy target is non-extensible, but the trap did not "
|
||||
"return its actual prototype"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_TARGET_NOT_EXTENSIBLE_NOT_RETURNED_ITS_PROTOTYPE);
|
||||
}
|
||||
|
||||
ecma_free_value (target_proto);
|
||||
@@ -471,8 +470,7 @@ ecma_proxy_object_set_prototype_of (ecma_object_t *obj_p, /**< proxy object */
|
||||
/* 16. */
|
||||
if (boolean_trap_result && (target_proto != proto))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Target object is non-extensible and trap "
|
||||
"returned different prototype"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_TARGET_NOT_EXTENSIBLE_DIFFERENT_PROTOTYPE_RETURNED);
|
||||
}
|
||||
|
||||
ecma_free_value (target_proto);
|
||||
@@ -567,7 +565,7 @@ ecma_proxy_object_is_extensible (ecma_object_t *obj_p) /**< proxy object */
|
||||
/* 12. */
|
||||
if (boolean_trap_result != target_result)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Trap result does not reflect extensibility of Proxy target"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_EXTENSIBILITY);
|
||||
}
|
||||
|
||||
return ecma_make_boolean_value (boolean_trap_result);
|
||||
@@ -651,7 +649,7 @@ ecma_proxy_object_prevent_extensions (ecma_object_t *obj_p) /**< proxy object */
|
||||
|
||||
if (ecma_is_value_true (target_is_ext))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Trap result does not reflect inextensibility of Proxy target"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TRAP_RESULT_NOT_REFLECT_TARGET_INEXTENSIBILITY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -723,7 +721,7 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy
|
||||
if (!ecma_is_value_object (trap_result) && !ecma_is_value_undefined (trap_result))
|
||||
{
|
||||
ecma_free_value (trap_result);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Trap is neither an object nor undefined"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TRAP_IS_NEITHER_AN_OBJECT_NOR_UNDEFINED);
|
||||
}
|
||||
|
||||
if (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION)
|
||||
@@ -768,8 +766,7 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy
|
||||
if (!(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE))
|
||||
{
|
||||
ecma_free_property_descriptor (&target_desc);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Given property is a non-configurable"
|
||||
" data property on the proxy target"));
|
||||
return ecma_raise_type_error (ECMA_ERR_GIVEN_PROPERTY_IS_A_NON_CONFIGURABLE);
|
||||
}
|
||||
|
||||
/* .c */
|
||||
@@ -788,7 +785,7 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy
|
||||
/* .f */
|
||||
if (ecma_is_value_false (extensible_target))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Target not extensible"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TARGET_NOT_EXTENSIBLE);
|
||||
}
|
||||
|
||||
/* .g */
|
||||
@@ -846,7 +843,7 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy
|
||||
if (!is_valid)
|
||||
{
|
||||
ecma_free_property_descriptor (prop_desc_p);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("The two descriptors are incompatible"));
|
||||
return ecma_raise_type_error (ECMA_ERR_THE_TWO_DESCRIPTORS_ARE_INCOMPATIBLE);
|
||||
}
|
||||
|
||||
/* 22. */
|
||||
@@ -858,7 +855,7 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy
|
||||
|| ((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"));
|
||||
return ecma_raise_type_error (ECMA_ERR_THE_TWO_DESCRIPTORS_ARE_INCOMPATIBLE);
|
||||
}
|
||||
}
|
||||
return ECMA_VALUE_TRUE;
|
||||
@@ -981,14 +978,12 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object *
|
||||
{
|
||||
if (!is_target_ext)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned truish for adding property "
|
||||
"to the non-extensible target"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_ADDING_PROPERTY_NON_EXTENSIBLE_TARGET);
|
||||
}
|
||||
|
||||
if (setting_config_false)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned truish for defining non-configurable property "
|
||||
"which is non-existent in the target"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_DEFINING_NON_EXISTENT_PROPERTY);
|
||||
}
|
||||
}
|
||||
/* 20. */
|
||||
@@ -998,13 +993,11 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object *
|
||||
|
||||
if (!ecma_op_is_compatible_property_descriptor (prop_desc_p, &target_desc, is_target_ext))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned truish for adding property that is "
|
||||
"incompatible with the existing property in the target"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_ADD_PROPERTY_INCOMPATIBLE_OTHER_PROP);
|
||||
}
|
||||
else if (setting_config_false && (target_desc.flags & JERRY_PROP_IS_CONFIGURABLE))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned truish for defining non-configurable property "
|
||||
"which is configurable in the target"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_DEFINING_NON_EXISTENT_PROPERTY);
|
||||
}
|
||||
/* ES11: 16.c */
|
||||
else if ((target_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED)) != 0
|
||||
@@ -1013,8 +1006,7 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object *
|
||||
&& (target_desc.flags & (JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_CONFIGURABLE)) == JERRY_PROP_IS_WRITABLE)
|
||||
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned truish for defining non-configurable property "
|
||||
"which is configurable in the target"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_DEFINING_NON_EXISTENT_PROPERTY);
|
||||
}
|
||||
|
||||
ecma_free_property_descriptor (&target_desc);
|
||||
@@ -1110,8 +1102,7 @@ ecma_proxy_object_has (ecma_object_t *obj_p, /**< proxy object */
|
||||
|
||||
if (!prop_is_configurable)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned falsish for property which exists "
|
||||
"in the proxy target as non-configurable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TRAP_FALSISH_PROPERTY_NON_CONFIGURABLE);
|
||||
}
|
||||
|
||||
ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);
|
||||
@@ -1123,8 +1114,7 @@ ecma_proxy_object_has (ecma_object_t *obj_p, /**< proxy object */
|
||||
|
||||
if (ecma_is_value_false (extensible_target))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned falsish for property but "
|
||||
"the proxy target is not extensible"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TRAP_FALSISH_PROPERTY_TARGET_NOT_EXTENSIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1209,14 +1199,13 @@ ecma_proxy_object_get (ecma_object_t *obj_p, /**< proxy object */
|
||||
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"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_INCORRECT_RETURN_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))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Property of a Proxy is non-configurable and "
|
||||
"does not have a getter function"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_PROXY_PROPERTY_NOT_CONFIGURABLE_NOT_HAVE_GETTER);
|
||||
}
|
||||
|
||||
ecma_free_property_descriptor (&target_desc);
|
||||
@@ -1303,7 +1292,7 @@ ecma_proxy_object_set (ecma_object_t *obj_p, /**< proxy object */
|
||||
{
|
||||
if (is_strict)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Proxy trap returned falsish"));
|
||||
return ecma_raise_type_error (ECMA_ERR_PROXY_TRAP_RETURNED_FALSISH);
|
||||
}
|
||||
|
||||
return ECMA_VALUE_FALSE;
|
||||
@@ -1333,14 +1322,13 @@ ecma_proxy_object_set (ecma_object_t *obj_p, /**< proxy object */
|
||||
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"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_INCORRECT_RETURN_PROXY_SET_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.set_p == NULL)
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("The property of a Proxy target is a non "
|
||||
"configurable accessor without a setter"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_TARGET_PROPERTY_CONFIGURE_ACCESSOR_WITHOUT_SETTER);
|
||||
}
|
||||
|
||||
ecma_free_property_descriptor (&target_desc);
|
||||
@@ -1451,15 +1439,14 @@ ecma_proxy_object_delete_property (ecma_object_t *obj_p, /**< proxy object */
|
||||
/* 15. */
|
||||
if (!(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned truish for property which is "
|
||||
"non-configurable in the proxy target"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_PROPERTY_NON_CONFIGURABLE);
|
||||
}
|
||||
/* ES11: 13-14 */
|
||||
ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p);
|
||||
|
||||
if (!ecma_is_value_true (extensible_target))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned truish for target is not extensible"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_TRAP_TRUISH_TARGET_NOT_EXTENSIBLE);
|
||||
}
|
||||
|
||||
ecma_free_property_descriptor (&target_desc);
|
||||
@@ -1551,7 +1538,7 @@ ecma_proxy_check_invariants_for_own_prop_keys (ecma_collection_t *trap_result,
|
||||
unchecked_result_keys,
|
||||
&unchecked_prop_name_counter)))
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Trap result did not include all non-configurable keys"));
|
||||
ecma_raise_type_error (ECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_NON_CONFIGURABLE_KEYS);
|
||||
}
|
||||
/* 22. */
|
||||
else if (ecma_is_value_true (extensible_target))
|
||||
@@ -1563,12 +1550,12 @@ ecma_proxy_check_invariants_for_own_prop_keys (ecma_collection_t *trap_result,
|
||||
unchecked_result_keys,
|
||||
&unchecked_prop_name_counter)))
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Trap result did not include all configurable keys"));
|
||||
ecma_raise_type_error (ECMA_ERR_TRAP_RESULT_NOT_INCLUDE_ALL_CONFIGURABLE_KEYS);
|
||||
}
|
||||
/* 24. */
|
||||
else if (unchecked_result_keys->item_count != unchecked_prop_name_counter)
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned extra keys for a non-extensible Proxy target"));
|
||||
ecma_raise_type_error (ECMA_ERR_TRAP_EXTRA_KEYS_FOR_A_NON_EXTENSIBLE_TARGET);
|
||||
}
|
||||
/* 25. */
|
||||
else
|
||||
@@ -1649,7 +1636,7 @@ ecma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */
|
||||
if (ecma_collection_check_duplicated_entries (trap_result))
|
||||
{
|
||||
ecma_collection_free (trap_result);
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned with duplicated entries"));
|
||||
ecma_raise_type_error (ECMA_ERR_TRAP_WITH_DUPLICATED_ENTRIES);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1760,7 +1747,7 @@ ecma_proxy_object_call (ecma_object_t *obj_p, /**< proxy object */
|
||||
|
||||
if (!ecma_op_proxy_object_is_callable (obj_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function));
|
||||
return ecma_raise_type_error (ECMA_ERR_EXPECTED_A_FUNCTION);
|
||||
}
|
||||
|
||||
ECMA_CHECK_STACK_USAGE ();
|
||||
@@ -1873,7 +1860,7 @@ ecma_proxy_object_construct (ecma_object_t *obj_p, /**< proxy object */
|
||||
{
|
||||
ecma_free_value (new_obj);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Trap must return with an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TRAP_MUST_RETURN_WITH_AN_OBJECT);
|
||||
}
|
||||
|
||||
/* 12. */
|
||||
|
||||
@@ -308,7 +308,7 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
|
||||
#if JERRY_ESNEXT
|
||||
if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))
|
||||
{
|
||||
return ecma_raise_reference_error (ECMA_ERR_MSG (ecma_error_let_const_not_initialized));
|
||||
return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
@@ -336,7 +336,7 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
|
||||
|
||||
if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED))
|
||||
{
|
||||
return ecma_raise_reference_error (ECMA_ERR_MSG (ecma_error_let_const_not_initialized));
|
||||
return ecma_raise_reference_error (ECMA_ERR_LET_CONST_NOT_INITIALIZED);
|
||||
}
|
||||
|
||||
return ecma_fast_copy_value (property_value_p->value);
|
||||
@@ -410,7 +410,7 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
|
||||
ecma_value_t error_value =
|
||||
ecma_raise_standard_error_with_format (JERRY_ERROR_REFERENCE, "% is not defined", name_val);
|
||||
#else /* JERRY_ERROR_MESSAGES */
|
||||
ecma_value_t error_value = ecma_raise_reference_error (NULL);
|
||||
ecma_value_t error_value = ecma_raise_reference_error (ECMA_ERR_EMPTY);
|
||||
#endif /* !JERRY_ERROR_MESSAGES */
|
||||
return error_value;
|
||||
} /* ecma_op_resolve_reference_value */
|
||||
|
||||
@@ -114,7 +114,7 @@ ecma_regexp_parse_flags (ecma_string_t *flags_str_p, /**< Input string with flag
|
||||
|
||||
if (flag == RE_FLAG_EMPTY || (result_flags & flag) != 0)
|
||||
{
|
||||
ret_value = ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid RegExp flags"));
|
||||
ret_value = ecma_raise_syntax_error (ECMA_ERR_INVALID_REGEXP_FLAGS);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1883,7 +1883,7 @@ match_found:
|
||||
|
||||
if (ECMA_RE_STACK_LIMIT_REACHED (matched_p))
|
||||
{
|
||||
ret_value = ecma_raise_range_error (ECMA_ERR_MSG ("Stack limit exceeded"));
|
||||
ret_value = ecma_raise_range_error (ECMA_ERR_STACK_LIMIT_EXCEEDED);
|
||||
goto cleanup_context;
|
||||
}
|
||||
|
||||
@@ -1973,7 +1973,7 @@ ecma_regexp_search_helper (ecma_value_t regexp_arg, /**< regexp argument */
|
||||
/* 2. */
|
||||
if (!ecma_is_value_object (regexp_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
ecma_value_t result = ECMA_VALUE_ERROR;
|
||||
@@ -2079,7 +2079,7 @@ ecma_regexp_split_helper (ecma_value_t this_arg, /**< this value */
|
||||
/* 2. */
|
||||
if (!ecma_is_value_object (this_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
ecma_value_t result = ECMA_VALUE_ERROR;
|
||||
@@ -2447,7 +2447,7 @@ cleanup_string:
|
||||
|
||||
if (ECMA_RE_STACK_LIMIT_REACHED (matched_p))
|
||||
{
|
||||
result = ecma_raise_range_error (ECMA_ERR_MSG ("Stack limit exceeded"));
|
||||
result = ecma_raise_range_error (ECMA_ERR_STACK_LIMIT_EXCEEDED);
|
||||
goto cleanup_array;
|
||||
}
|
||||
|
||||
@@ -2472,7 +2472,7 @@ cleanup_string:
|
||||
|
||||
if (ECMA_RE_STACK_LIMIT_REACHED (matched_p))
|
||||
{
|
||||
result = ecma_raise_range_error (ECMA_ERR_MSG ("Stack limit exceeded"));
|
||||
result = ecma_raise_range_error (ECMA_ERR_STACK_LIMIT_EXCEEDED);
|
||||
goto cleanup_array;
|
||||
}
|
||||
|
||||
@@ -2658,7 +2658,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
|
||||
{
|
||||
if (ECMA_RE_STACK_LIMIT_REACHED (matched_p))
|
||||
{
|
||||
result = ecma_raise_range_error (ECMA_ERR_MSG ("Stack limit exceeded"));
|
||||
result = ecma_raise_range_error (ECMA_ERR_STACK_LIMIT_EXCEEDED);
|
||||
goto cleanup_builder;
|
||||
}
|
||||
|
||||
@@ -2830,7 +2830,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
|
||||
/* 2. */
|
||||
if (!ecma_is_value_object (this_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *this_obj_p = ecma_get_object_from_value (this_arg);
|
||||
@@ -2956,7 +2956,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
|
||||
if (!ecma_is_value_object (result) && !ecma_is_value_null (result))
|
||||
{
|
||||
ecma_free_value (result);
|
||||
result = ecma_raise_type_error (ECMA_ERR_MSG ("Return value of 'exec' must be an object or null"));
|
||||
result = ecma_raise_type_error (ECMA_ERR_RETURN_VALUE_OF_EXEC_MUST_BE_AN_OBJECT_OR_NULL);
|
||||
goto cleanup_results;
|
||||
}
|
||||
}
|
||||
@@ -2966,7 +2966,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
|
||||
|
||||
if (!ecma_object_class_is (this_obj_p, ECMA_OBJECT_CLASS_REGEXP))
|
||||
{
|
||||
result = ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a valid RegExp object"));
|
||||
result = ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP_OBJECT);
|
||||
goto cleanup_results;
|
||||
}
|
||||
|
||||
@@ -3305,7 +3305,7 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
|
||||
{
|
||||
if (!ecma_is_value_object (this_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
ecma_string_t *str_p = ecma_op_to_string (string_arg);
|
||||
@@ -3503,7 +3503,7 @@ ecma_op_regexp_exec (ecma_value_t this_arg, /**< this argument */
|
||||
if (!ecma_is_value_object (result) && !ecma_is_value_null (result))
|
||||
{
|
||||
ecma_free_value (result);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Return value of 'exec' must be an object or null"));
|
||||
return ecma_raise_type_error (ECMA_ERR_RETURN_VALUE_OF_EXEC_MUST_BE_AN_OBJECT_OR_NULL);
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -3516,7 +3516,7 @@ ecma_op_regexp_exec (ecma_value_t this_arg, /**< this argument */
|
||||
|
||||
if (!ecma_object_is_regexp_object (this_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a valid RegExp"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_REG_EXP);
|
||||
}
|
||||
|
||||
return ecma_regexp_exec_helper (arg_obj_p, str_p);
|
||||
|
||||
@@ -104,7 +104,7 @@ ecma_op_create_shared_arraybuffer_object (const ecma_value_t *arguments_list_p,
|
||||
if (length_num <= -1.0 || length_num > (ecma_number_t) maximum_size_in_byte + 0.5)
|
||||
{
|
||||
ecma_deref_object (proto_p);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid Shared ArrayBuffer length"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_SHARED_ARRAYBUFFER_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -170,7 +170,7 @@ ecma_symbol_this_value (ecma_value_t this_arg) /**< this argument value */
|
||||
}
|
||||
|
||||
/* 3. */
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' must be a Symbol"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_SYMBOL);
|
||||
} /* ecma_symbol_this_value */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -811,7 +811,7 @@ ecma_typedarray_create_object_with_length (uint32_t array_length, /**< length of
|
||||
ecma_free_value (array_length_value);
|
||||
return result;
|
||||
#else /* !JERRY_ERROR_MESSAGES */
|
||||
return ecma_raise_range_error (NULL);
|
||||
return ecma_raise_range_error (ECMA_ERR_EMPTY);
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
}
|
||||
|
||||
@@ -850,7 +850,7 @@ ecma_typedarray_create_object_with_length (uint32_t array_length, /**< length of
|
||||
if (ecma_arraybuffer_is_detached (src_buffer_p))
|
||||
{
|
||||
ecma_deref_object (new_arraybuffer_p);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -925,7 +925,7 @@ ecma_typedarray_create_object_with_typedarray (ecma_object_t *typedarray_p, /**<
|
||||
if ((ECMA_TYPEDARRAY_IS_BIGINT_TYPE (src_id) ^ ECMA_TYPEDARRAY_IS_BIGINT_TYPE (typedarray_id)) == 1)
|
||||
{
|
||||
ecma_deref_object (new_typedarray_p);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Incompatible TypedArray types"));
|
||||
return ecma_raise_type_error (ECMA_ERR_INCOMPATIBLE_TYPEDARRAY_TYPES);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
|
||||
@@ -1159,7 +1159,7 @@ ecma_typedarray_create_object_with_object (ecma_value_t items_val, /**< the sour
|
||||
if (length_index >= UINT32_MAX)
|
||||
{
|
||||
ecma_deref_object (arraylike_object_p);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid TypedArray length"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_TYPEDARRAY_LENGTH);
|
||||
}
|
||||
|
||||
uint32_t len = (uint32_t) length_index;
|
||||
@@ -1392,7 +1392,7 @@ ecma_op_typedarray_from (ecma_value_t this_val, /**< this value */
|
||||
if (length_index >= UINT32_MAX)
|
||||
{
|
||||
ecma_deref_object (arraylike_object_p);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid TypedArray length"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_TYPEDARRAY_LENGTH);
|
||||
}
|
||||
|
||||
uint32_t len = (uint32_t) length_index;
|
||||
@@ -1614,7 +1614,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
"Invalid typed array length: %",
|
||||
arguments_list_p[0]);
|
||||
#else /* !JERRY_ERROR_MESSAGES */
|
||||
return ecma_raise_range_error (NULL);
|
||||
return ecma_raise_range_error (ECMA_ERR_EMPTY);
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
}
|
||||
|
||||
@@ -1658,7 +1658,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
}
|
||||
else
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid offset"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_OFFSET);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1671,14 +1671,12 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
|
||||
if (ecma_arraybuffer_is_detached (arraybuffer_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
const char *invalid_length_p = ECMA_ERR_MSG ("Invalid length");
|
||||
|
||||
if (offset > UINT32_MAX)
|
||||
{
|
||||
return ecma_raise_range_error (invalid_length_p);
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_LENGTH);
|
||||
}
|
||||
|
||||
uint32_t byte_offset = (uint32_t) offset;
|
||||
@@ -1690,7 +1688,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
{
|
||||
if ((buf_byte_length % (uint32_t) (1 << element_size_shift) != 0) || (buf_byte_length < byte_offset))
|
||||
{
|
||||
return ecma_raise_range_error (invalid_length_p);
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_LENGTH);
|
||||
}
|
||||
|
||||
new_byte_length = (uint32_t) (buf_byte_length - byte_offset);
|
||||
@@ -1699,14 +1697,14 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
{
|
||||
if (new_length > (UINT32_MAX >> element_size_shift))
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Maximum TypedArray size is reached"));
|
||||
return ecma_raise_range_error (ECMA_ERR_MAXIMUM_TYPEDARRAY_SIZE_IS_REACHED);
|
||||
}
|
||||
|
||||
new_byte_length = (uint32_t) new_length << element_size_shift;
|
||||
|
||||
if (byte_offset > buf_byte_length || new_byte_length > (buf_byte_length - byte_offset))
|
||||
{
|
||||
return ecma_raise_range_error (invalid_length_p);
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_LENGTH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1927,7 +1925,7 @@ ecma_typedarray_create (ecma_object_t *constructor_p, /**< constructor function
|
||||
if (!ecma_is_typedarray (ret_val))
|
||||
{
|
||||
ecma_free_value (ret_val);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructed object is not TypedArray"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTED_OBJECT_IS_NOT_TYPEDARRAY);
|
||||
}
|
||||
|
||||
ecma_object_t *typedarray_p = ecma_get_object_from_value (ret_val);
|
||||
@@ -1937,7 +1935,7 @@ ecma_typedarray_create (ecma_object_t *constructor_p, /**< constructor function
|
||||
if (ecma_arraybuffer_is_detached (arraybuffer_p))
|
||||
{
|
||||
ecma_deref_object (typedarray_p);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
if ((arguments_list_len == 1) && (ecma_is_value_number (arguments_list_p[0])))
|
||||
@@ -1948,7 +1946,7 @@ ecma_typedarray_create (ecma_object_t *constructor_p, /**< constructor function
|
||||
if (info.length < num)
|
||||
{
|
||||
ecma_free_value (ret_val);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructed TypedArray is smaller than filter call result"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TYPEDARRAY_SMALLER_THAN_FILTER_CALL_RESULT);
|
||||
}
|
||||
}
|
||||
return ret_val;
|
||||
@@ -2000,7 +1998,7 @@ ecma_typedarray_species_create (ecma_value_t this_arg, /**< this argument */
|
||||
if (ECMA_TYPEDARRAY_IS_BIGINT_TYPE (info.id) ^ ECMA_TYPEDARRAY_IS_BIGINT_TYPE (result_info.id))
|
||||
{
|
||||
ecma_free_value (result);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("TypedArray returned by [[ContentType]] does not match source"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONTENTTYPE_RETURNED_TYPEDARRAY_NOT_MATCH_SOURCE);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user