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:
@@ -70,7 +70,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t
|
||||
/* 1 - 2. */
|
||||
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);
|
||||
@@ -79,7 +79,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t
|
||||
/* 3. */
|
||||
if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARRAY_ITERATOR))
|
||||
{
|
||||
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;
|
||||
@@ -100,7 +100,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t
|
||||
ecma_object_t *arraybuffer_p = ecma_typedarray_get_arraybuffer (array_object_p);
|
||||
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);
|
||||
}
|
||||
|
||||
/* b. */
|
||||
|
||||
@@ -434,7 +434,7 @@ ecma_builtin_array_prototype_object_push (const ecma_value_t *argument_list_p, /
|
||||
{
|
||||
if ((ecma_number_t) (length + arguments_number) > UINT32_MAX)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH);
|
||||
}
|
||||
|
||||
if (arguments_number == 0)
|
||||
@@ -460,7 +460,7 @@ ecma_builtin_array_prototype_object_push (const ecma_value_t *argument_list_p, /
|
||||
/* 5. */
|
||||
if ((ecma_number_t) (length + arguments_number) > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Pushing element over 2**53-1 length is disallowed"));
|
||||
return ecma_raise_type_error (ECMA_ERR_PUSHING_TOO_HIGH_ELEMENT);
|
||||
}
|
||||
|
||||
/* 6. */
|
||||
@@ -1089,7 +1089,7 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum
|
||||
/* Check if the provided compare function is callable. */
|
||||
if (!ecma_is_value_undefined (arg1) && !ecma_op_is_callable (arg1))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Compare function is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_COMPARE_FUNC_NOT_CALLABLE);
|
||||
}
|
||||
|
||||
ecma_length_t len;
|
||||
@@ -1284,7 +1284,7 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
|
||||
/* ES11: 8. */
|
||||
if ((ecma_number_t) new_length > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid new Array length"));
|
||||
return ecma_raise_type_error (ECMA_ERR_INVALID_NEW_ARRAY_LENGTH);
|
||||
}
|
||||
|
||||
/* ES11: 9. */
|
||||
@@ -1486,7 +1486,7 @@ ecma_builtin_array_prototype_object_unshift (const ecma_value_t args[], /**< arg
|
||||
{
|
||||
if (args_number > UINT32_MAX - len)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH);
|
||||
}
|
||||
|
||||
if (args_number == 0)
|
||||
@@ -1523,7 +1523,7 @@ ecma_builtin_array_prototype_object_unshift (const ecma_value_t args[], /**< arg
|
||||
/* ES11:4.a. */
|
||||
if ((ecma_number_t) (len + args_number) > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Unshift elements over 2**53-1 length is disallowed"));
|
||||
return ecma_raise_type_error (ECMA_ERR_UNSHIFT_TOO_HIGH);
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
@@ -1854,7 +1854,7 @@ ecma_builtin_array_apply (ecma_value_t arg1, /**< callbackfn */
|
||||
/* 4. */
|
||||
if (!ecma_op_is_callable (arg1))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/* We already checked that arg1 is callable */
|
||||
@@ -1937,7 +1937,7 @@ ecma_builtin_array_prototype_object_map (ecma_value_t arg1, /**< callbackfn */
|
||||
/* 4. */
|
||||
if (!ecma_op_is_callable (arg1))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/* 6. */
|
||||
@@ -2028,7 +2028,7 @@ ecma_builtin_array_prototype_object_filter (ecma_value_t arg1, /**< callbackfn *
|
||||
/* 4. */
|
||||
if (!ecma_op_is_callable (arg1))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/* 6. */
|
||||
@@ -2133,13 +2133,13 @@ ecma_builtin_array_reduce_from (const ecma_value_t args_p[], /**< routine's argu
|
||||
/* 4. */
|
||||
if (!ecma_op_is_callable (args_p[0]))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
if (len == 0 && args_number == 1)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Reduce of empty Array with no initial value"));
|
||||
return ecma_raise_type_error (ECMA_ERR_REDUCE_OF_EMPTY_ARRAY_WITH_NO_INITIAL_VALUE);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_object (args_p[0]));
|
||||
@@ -2191,7 +2191,7 @@ ecma_builtin_array_reduce_from (const ecma_value_t args_p[], /**< routine's argu
|
||||
/* 8.c */
|
||||
if (!k_present)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Missing Array element"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MISSING_ARRAY_ELEMENT);
|
||||
}
|
||||
}
|
||||
/* 9. */
|
||||
@@ -2343,7 +2343,7 @@ ecma_builtin_array_prototype_object_find (ecma_value_t predicate, /**< callback
|
||||
/* 5. */
|
||||
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);
|
||||
}
|
||||
|
||||
/* We already checked that predicate is callable, so it will always be an object. */
|
||||
@@ -2825,7 +2825,7 @@ ecma_builtin_array_prototype_object_flat_map (ecma_value_t callback, /**< callba
|
||||
{
|
||||
if (!ecma_op_is_callable (callback))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/* 4. */
|
||||
|
||||
@@ -97,7 +97,7 @@ ecma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */
|
||||
/* 3.a */
|
||||
if (!ecma_op_is_callable (mapfn))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
/* 3.b */
|
||||
@@ -136,7 +136,7 @@ ecma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */
|
||||
if (ecma_is_value_undefined (array) || ecma_is_value_null (array))
|
||||
{
|
||||
ecma_free_value (using_iterator);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_cannot_convert_to_object));
|
||||
return ecma_raise_type_error (ECMA_ERR_CANNOT_CONVERT_TO_OBJECT);
|
||||
}
|
||||
|
||||
/* 6.c */
|
||||
@@ -297,7 +297,7 @@ iterator_cleanup:
|
||||
|
||||
if (ecma_is_value_undefined (array) || ecma_is_value_null (array))
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_cannot_convert_to_object));
|
||||
ecma_raise_type_error (ECMA_ERR_CANNOT_CONVERT_TO_OBJECT);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -482,7 +482,7 @@ ecma_builtin_array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arg
|
||||
|
||||
if (num != ((ecma_number_t) num_uint32))
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_ARRAY_LENGTH);
|
||||
}
|
||||
|
||||
return ecma_make_object_value (ecma_op_new_array_object (num_uint32));
|
||||
|
||||
@@ -66,7 +66,7 @@ ecma_builtin_arraybuffer_prototype_bytelength_getter (ecma_value_t this_arg) /**
|
||||
{
|
||||
if (ecma_arraybuffer_is_detached (object_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
uint32_t len = ecma_arraybuffer_get_length (object_p);
|
||||
|
||||
@@ -74,7 +74,7 @@ ecma_builtin_arraybuffer_prototype_bytelength_getter (ecma_value_t this_arg) /**
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a ArrayBuffer object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_ARRAY_BUFFER_OBJECT);
|
||||
} /* ecma_builtin_arraybuffer_prototype_bytelength_getter */
|
||||
|
||||
/**
|
||||
@@ -93,7 +93,7 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi
|
||||
{
|
||||
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 *object_p = ecma_get_object_from_value (this_arg);
|
||||
@@ -101,7 +101,7 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi
|
||||
/* 2. */
|
||||
if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an ArrayBuffer object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_ARRAY_BUFFER_OBJECT);
|
||||
}
|
||||
|
||||
return ecma_builtin_arraybuffer_slice (this_arg, argument_list_p, arguments_number);
|
||||
|
||||
@@ -76,7 +76,7 @@ ecma_builtin_arraybuffer_dispatch_call (const ecma_value_t *arguments_list_p, /*
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor ArrayBuffer requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_ARRAYBUFFER_REQUIRES_NEW);
|
||||
} /* ecma_builtin_arraybuffer_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -255,9 +255,8 @@ ecma_builtin_async_from_sync_iterator_prototype_do (ecma_async_from_sync_iterato
|
||||
ecma_free_value (call_result);
|
||||
|
||||
#if JERRY_ERROR_MESSAGES
|
||||
const lit_utf8_byte_t *msg_p = (const lit_utf8_byte_t *) ecma_error_argument_is_not_an_object;
|
||||
lit_utf8_size_t msg_size = (lit_utf8_size_t) ecma_error_argument_is_not_an_object_length;
|
||||
JERRY_ASSERT (lit_zt_utf8_string_size (msg_p) == msg_size);
|
||||
const lit_utf8_byte_t *msg_p = ecma_get_error_utf8 (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);
|
||||
lit_utf8_size_t msg_size = ecma_get_error_size (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);
|
||||
ecma_string_t *error_msg_p = ecma_new_ecma_string_from_ascii (msg_p, msg_size);
|
||||
#else /* !JERRY_ERROR_MESSAGES */
|
||||
ecma_string_t *error_msg_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
|
||||
|
||||
@@ -111,7 +111,7 @@ ecma_builtin_async_generator_prototype_dispatch_routine (uint8_t builtin_routine
|
||||
|
||||
if (executable_object_p == NULL)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an async generator object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_ASYNC_GENERATOR);
|
||||
}
|
||||
|
||||
if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED)
|
||||
|
||||
@@ -82,7 +82,7 @@ ecma_builtin_bigint_prototype_object_value_of (ecma_value_t this_arg) /**< this
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("BigInt value expected"));
|
||||
return ecma_raise_type_error (ECMA_ERR_BIGINT_VALUE_EXCPECTED);
|
||||
} /* ecma_builtin_bigint_prototype_object_value_of */
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ ecma_builtin_bigint_prototype_object_to_string (ecma_value_t this_arg, /**< this
|
||||
|
||||
if (arg_num < 2 || arg_num > 36)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Radix must be between 2 and 36"));
|
||||
return ecma_raise_range_error (ECMA_ERR_RADIX_IS_OUT_OF_RANGE);
|
||||
}
|
||||
|
||||
radix = (uint32_t) arg_num;
|
||||
|
||||
@@ -68,7 +68,7 @@ ecma_builtin_bigint_dispatch_construct (const ecma_value_t *arguments_list_p, /*
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("BigInt function is not a constructor"));
|
||||
return ecma_raise_type_error (ECMA_ERR_BIGINT_FUNCTION_NOT_CONSTRUCTOR);
|
||||
} /* ecma_builtin_bigint_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -89,7 +89,7 @@ ecma_builtin_boolean_prototype_object_value_of (ecma_value_t this_arg) /**< this
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Boolean object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_BOOLEAN_OBJECT);
|
||||
} /* ecma_builtin_boolean_prototype_object_value_of */
|
||||
|
||||
/**
|
||||
|
||||
@@ -122,7 +122,7 @@ ecma_builtin_dataview_prototype_object_getters (ecma_value_t this_arg, /**< this
|
||||
{
|
||||
if (ecma_arraybuffer_is_detached (obj_p->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);
|
||||
}
|
||||
return ecma_make_uint32_value (obj_p->header.u.cls.u3.length);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ ecma_builtin_dataview_prototype_object_getters (ecma_value_t this_arg, /**< this
|
||||
|
||||
if (ecma_arraybuffer_is_detached (obj_p->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);
|
||||
}
|
||||
return ecma_make_uint32_value (obj_p->byte_offset);
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ ecma_builtin_dataview_dispatch_call (const ecma_value_t *arguments_list_p, /**<
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor DataView requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_DATAVIEW_REQUIRES_NEW);
|
||||
} /* ecma_builtin_dataview_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -214,7 +214,7 @@ ecma_builtin_date_prototype_to_primitive (ecma_value_t this_arg, /**< this argum
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type in toPrimitive"));
|
||||
return ecma_raise_type_error (ECMA_ERR_INVALID_ARGUMENT_TYPE_IN_TOPRIMITIVE);
|
||||
} /* ecma_builtin_date_prototype_to_primitive */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
@@ -638,7 +638,7 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b
|
||||
if (!ecma_is_value_object (this_arg)
|
||||
|| !ecma_object_class_is (ecma_get_object_from_value (this_arg), ECMA_OBJECT_CLASS_DATE))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Date object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_DATE_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *this_obj_p = ecma_get_object_from_value (this_arg);
|
||||
@@ -712,7 +712,7 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b
|
||||
{
|
||||
if (ecma_number_is_nan (date_value))
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Date must be a finite number"));
|
||||
return ecma_raise_range_error (ECMA_ERR_DATE_MUST_BE_A_FINITE_NUMBER);
|
||||
}
|
||||
|
||||
return ecma_date_value_to_iso_string (date_value);
|
||||
|
||||
@@ -101,7 +101,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
|
||||
/* 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 *obj_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
@@ -217,7 +217,7 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th
|
||||
/* 3. */
|
||||
if (!ecma_is_value_object (arg2))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (arg2);
|
||||
@@ -233,7 +233,7 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th
|
||||
|
||||
if (length >= ECMA_FUNCTION_APPLY_ARGUMENT_COUNT_LIMIT)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Too many arguments declared for Function.apply"));
|
||||
return ecma_raise_range_error (ECMA_ERR_TOO_MANY_ARGUMENTS_DECLARED_FOR_FUNCTION_APPLY);
|
||||
}
|
||||
|
||||
/* 6. */
|
||||
@@ -498,7 +498,7 @@ ecma_builtin_function_prototype_dispatch_construct (const ecma_value_t *argument
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Function.prototype is not a constructor"));
|
||||
return ecma_raise_type_error (ECMA_ERR_FUNCTION_PROTOTYPE_NOT_A_CONSTRUCTOR);
|
||||
} /* ecma_builtin_function_prototype_dispatch_construct */
|
||||
|
||||
/**
|
||||
@@ -523,7 +523,7 @@ ecma_builtin_function_prototype_dispatch_routine (uint8_t builtin_routine_id, /*
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a function"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_FUNCTION);
|
||||
}
|
||||
|
||||
ecma_object_t *func_obj_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
@@ -223,12 +223,12 @@ ecma_builtin_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /
|
||||
|
||||
if (executable_object_p == NULL)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a generator object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_GENERATOR_OBJECT);
|
||||
}
|
||||
|
||||
if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_RUNNING)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Generator is currently under execution"));
|
||||
return ecma_raise_type_error (ECMA_ERR_GENERATOR_IS_CURRENTLY_UNDER_EXECUTION);
|
||||
}
|
||||
|
||||
if (executable_object_p->extended_object.u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_COMPLETED)
|
||||
|
||||
@@ -210,7 +210,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /*
|
||||
if (hex_value == UINT32_MAX)
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid hexadecimal value"));
|
||||
return ecma_raise_uri_error (ECMA_ERR_INVALID_HEXADECIMAL_VALUE);
|
||||
}
|
||||
|
||||
ecma_char_t decoded_byte = (ecma_char_t) hex_value;
|
||||
@@ -248,7 +248,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /*
|
||||
else
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 character"));
|
||||
return ecma_raise_uri_error (ECMA_ERR_INVALID_UTF8_CHARACTER);
|
||||
}
|
||||
|
||||
lit_utf8_byte_t octets[LIT_UTF8_MAX_BYTES_IN_CODE_POINT];
|
||||
@@ -280,7 +280,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /*
|
||||
if (!is_valid || !lit_is_valid_utf8_string (octets, bytes_count, true))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 string"));
|
||||
return ecma_raise_uri_error (ECMA_ERR_INVALID_UTF8_STRING);
|
||||
}
|
||||
|
||||
lit_code_point_t cp;
|
||||
@@ -289,7 +289,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /*
|
||||
if (lit_is_code_point_utf16_high_surrogate (cp) || lit_is_code_point_utf16_low_surrogate (cp))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 codepoint"));
|
||||
return ecma_raise_uri_error (ECMA_ERR_INVALID_UTF8_CODEPOINT);
|
||||
}
|
||||
|
||||
lit_utf8_byte_t result_chars[LIT_CESU8_MAX_BYTES_IN_CODE_POINT];
|
||||
@@ -348,7 +348,7 @@ ecma_builtin_global_object_encode_uri_helper (lit_utf8_byte_t *input_start_p, /*
|
||||
if (lit_is_code_point_utf16_low_surrogate (ch))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_uri_error (ECMA_ERR_MSG ("Unicode surrogate pair missing"));
|
||||
return ecma_raise_uri_error (ECMA_ERR_UNICODE_SURROGATE_PAIR_MISSING);
|
||||
}
|
||||
|
||||
lit_code_point_t cp = ch;
|
||||
@@ -358,7 +358,7 @@ ecma_builtin_global_object_encode_uri_helper (lit_utf8_byte_t *input_start_p, /*
|
||||
if (input_char_p == input_end_p)
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_uri_error (ECMA_ERR_MSG ("Unicode surrogate pair missing"));
|
||||
return ecma_raise_uri_error (ECMA_ERR_UNICODE_SURROGATE_PAIR_MISSING);
|
||||
}
|
||||
|
||||
ecma_char_t next_ch;
|
||||
@@ -372,7 +372,7 @@ ecma_builtin_global_object_encode_uri_helper (lit_utf8_byte_t *input_start_p, /*
|
||||
else
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_uri_error (ECMA_ERR_MSG ("Unicode surrogate pair missing"));
|
||||
return ecma_raise_uri_error (ECMA_ERR_UNICODE_SURROGATE_PAIR_MISSING);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -368,7 +368,7 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *array_obj_p, /**< array *
|
||||
/* 4 . */
|
||||
if ((ecma_number_t) (*length_p + arg_len) > ECMA_NUMBER_MAX_SAFE_INTEGER)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
return ecma_raise_type_error (ECMA_ERR_INVALID_ARRAY_LENGTH);
|
||||
}
|
||||
#else /* !JERRY_ESNEXT */
|
||||
/* 5.b.ii */
|
||||
@@ -591,7 +591,7 @@ ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_st
|
||||
if (regexp == ECMA_VALUE_TRUE)
|
||||
{
|
||||
JERRY_ASSERT (ECMA_STRING_LAST_INDEX_OF < mode && mode <= ECMA_STRING_ENDS_WITH);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Search string can't be of type: RegExp"));
|
||||
return ecma_raise_type_error (ECMA_ERR_SEARCH_STRING_CANNOT_BE_OF_TYPE_REGEXP);
|
||||
}
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
@@ -172,12 +172,12 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-
|
||||
{
|
||||
if (!ecma_is_typedarray (this_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a TypedArray"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_TYPED_ARRAY);
|
||||
}
|
||||
|
||||
if (ecma_arraybuffer_is_detached (ecma_typedarray_get_arraybuffer (ecma_get_object_from_value (this_arg))))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
return ecma_typedarray_iterators_helper (this_arg, ECMA_ITERATOR_VALUES);
|
||||
@@ -208,7 +208,7 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-
|
||||
if (!ecma_is_value_object (this_arg)
|
||||
|| !ecma_object_class_is (ecma_get_object_from_value (this_arg), ECMA_OBJECT_CLASS_DATE))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Date object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_DATE_OBJECT);
|
||||
}
|
||||
|
||||
#if JERRY_ESNEXT
|
||||
|
||||
@@ -811,7 +811,7 @@ ecma_builtin_json_parse_buffer (const lit_utf8_byte_t *str_start_p, /**< String
|
||||
ecma_free_value (result);
|
||||
}
|
||||
|
||||
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid JSON format"));
|
||||
return ecma_raise_syntax_error (ECMA_ERR_INVALID_JSON_FORMAT);
|
||||
} /* ecma_builtin_json_parse_buffer */
|
||||
|
||||
/**
|
||||
@@ -987,7 +987,7 @@ ecma_builtin_json_serialize_object (ecma_json_stringify_context_t *context_p, /*
|
||||
/* 1. */
|
||||
if (ecma_json_has_object_in_stack (context_p->occurrence_stack_last_p, obj_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("The structure is cyclical"));
|
||||
return ecma_raise_type_error (ECMA_ERR_THE_STRUCTURE_IS_CYCLICAL);
|
||||
}
|
||||
|
||||
/* 2. */
|
||||
@@ -1124,7 +1124,7 @@ ecma_builtin_json_serialize_array (ecma_json_stringify_context_t *context_p, /**
|
||||
/* 1. */
|
||||
if (ecma_json_has_object_in_stack (context_p->occurrence_stack_last_p, obj_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("The structure is cyclical"));
|
||||
return ecma_raise_type_error (ECMA_ERR_THE_STRUCTURE_IS_CYCLICAL);
|
||||
}
|
||||
|
||||
/* 2. */
|
||||
@@ -1414,7 +1414,7 @@ ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,
|
||||
if (ecma_is_value_bigint (value))
|
||||
{
|
||||
ecma_free_value (value);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("BigInt cannot be serialized"));
|
||||
return ecma_raise_type_error (ECMA_ERR_BIGINT_SERIALIZED);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_BIGINT */
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ ecma_builtin_map_dispatch_call (const ecma_value_t *arguments_list_p, /**< argum
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Map requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_MAP_REQUIRES_NEW);
|
||||
} /* ecma_builtin_map_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -165,7 +165,7 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, /
|
||||
|
||||
if (radix < 2 || radix > 36)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Radix must be between 2 and 36"));
|
||||
return ecma_raise_range_error (ECMA_ERR_RADIX_IS_OUT_OF_RANGE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -451,7 +451,7 @@ ecma_builtin_number_prototype_object_value_of (ecma_value_t this_arg) /**< this
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a number or a Number object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_NUMBER);
|
||||
} /* ecma_builtin_number_prototype_object_value_of */
|
||||
|
||||
/**
|
||||
@@ -489,7 +489,7 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
|
||||
/* Argument boundary check for toFixed method */
|
||||
if (mode == NUMBER_ROUTINE_TO_FIXED && (arg_num <= -1 || arg_num >= 101))
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100"));
|
||||
return ecma_raise_range_error (ECMA_ERR_FRACTION_DIGITS_OUT_OF_RANGE);
|
||||
}
|
||||
|
||||
/* Handle NaN separately */
|
||||
@@ -557,12 +557,12 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
|
||||
if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL && (arg_num <= -1 || arg_num >= 101))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100"));
|
||||
return ecma_raise_range_error (ECMA_ERR_FRACTION_DIGITS_OUT_OF_RANGE);
|
||||
}
|
||||
else if (mode == NUMBER_ROUTINE_TO_PRECISION && (arg_num < 1 || arg_num > 100))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Precision digits must be between 1 and 100"));
|
||||
return ecma_raise_range_error (ECMA_ERR_PRECISION_DIGITS_MUST_BE_BETWEEN_IN_RANGE);
|
||||
}
|
||||
|
||||
num_of_digits = ecma_number_to_decimal (this_num, digits, &exponent);
|
||||
|
||||
@@ -241,7 +241,7 @@ ecma_builtin_object_prototype_define_getter_setter (ecma_value_t this_arg, /**<
|
||||
if (!ecma_op_is_callable (accessor))
|
||||
{
|
||||
ecma_deref_object (obj_p);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Getter is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_GETTER_IS_NOT_CALLABLE);
|
||||
}
|
||||
|
||||
ecma_object_t *accessor_obj_p = ecma_get_object_from_value (accessor);
|
||||
|
||||
@@ -198,7 +198,7 @@ ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1, /**< routine's f
|
||||
/* 3. */
|
||||
if (!ecma_is_value_object (arg2) && !ecma_is_value_null (arg2))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Prototype is neither object nor null"));
|
||||
return ecma_raise_type_error (ECMA_ERR_PROTOTYPE_IS_NEITHER_OBJECT_NOR_NULL);
|
||||
}
|
||||
|
||||
/* 4. */
|
||||
@@ -231,7 +231,7 @@ ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1, /**< routine's f
|
||||
|
||||
if (ecma_is_value_false (status))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot set [[Prototype]]"));
|
||||
return ecma_raise_type_error (ECMA_ERR_SET_PROTOTYPE);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_true (status));
|
||||
@@ -295,7 +295,7 @@ ecma_builtin_object_object_set_proto (ecma_value_t arg1, /**< routine's first ar
|
||||
|
||||
if (ecma_is_value_false (status))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot set [[Prototype]]"));
|
||||
return ecma_raise_type_error (ECMA_ERR_SET_PROTOTYPE);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_true (status));
|
||||
@@ -465,7 +465,7 @@ ecma_builtin_object_object_seal (ecma_object_t *obj_p) /**< routine's argument *
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
if (ecma_is_value_false (status))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Object cannot be sealed"));
|
||||
return ecma_raise_type_error (ECMA_ERR_OBJECT_CANNOT_BE_SEALED);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
@@ -496,7 +496,7 @@ ecma_builtin_object_object_freeze (ecma_object_t *obj_p) /**< routine's argument
|
||||
#if JERRY_BUILTIN_PROXY
|
||||
if (ecma_is_value_false (status))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Object cannot be frozen"));
|
||||
return ecma_raise_type_error (ECMA_ERR_OBJECT_CANNOT_BE_FROZEN);
|
||||
}
|
||||
#endif /* JERRY_BUILTIN_PROXY */
|
||||
|
||||
@@ -529,7 +529,7 @@ ecma_builtin_object_object_prevent_extensions (ecma_object_t *obj_p) /**< routin
|
||||
|
||||
if (ecma_is_value_false (status))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot set [[Extensible]] property of object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_SET_EXTENSIBLE_PROPERTY);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_true (status));
|
||||
@@ -945,7 +945,7 @@ ecma_builtin_object_object_create (ecma_value_t arg1, /**< routine's first argum
|
||||
/* 1. */
|
||||
if (!ecma_is_value_object (arg1) && !ecma_is_value_null (arg1))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = NULL;
|
||||
@@ -1012,7 +1012,7 @@ ecma_builtin_object_object_define_property (ecma_object_t *obj_p, /**< routine's
|
||||
|
||||
if (ecma_is_value_false (define_own_prop_ret))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("The requested property update cannot be performed"));
|
||||
return ecma_raise_type_error (ECMA_ERR_THE_REQUESTED_PROPERTY_UPDATE_CANNOT_BE_PERFORMED);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_true (define_own_prop_ret));
|
||||
@@ -1211,7 +1211,7 @@ ecma_builtin_object_from_entries (ecma_value_t iterator) /**< object's iterator
|
||||
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 (original_iterator);
|
||||
JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result));
|
||||
goto cleanup_iterator;
|
||||
@@ -1403,7 +1403,7 @@ ecma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
#if !JERRY_ESNEXT
|
||||
if (!ecma_is_value_object (arg1))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
|
||||
@@ -1412,7 +1412,7 @@ ecma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
#if JERRY_ESNEXT
|
||||
if (!ecma_is_value_object (arg1))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ ecma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for
|
||||
if (!ecma_op_is_callable (resolve))
|
||||
{
|
||||
ecma_free_value (resolve);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Resolve method must be callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_RESOLVE_METHOD_MUST_BE_CALLABLE);
|
||||
}
|
||||
|
||||
ecma_object_t *resolve_func_p = ecma_get_object_from_value (resolve);
|
||||
@@ -196,7 +196,7 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
|
||||
if (!ecma_op_is_callable (resolve))
|
||||
{
|
||||
ecma_free_value (resolve);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Resolve method must be callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_RESOLVE_METHOD_MUST_BE_CALLABLE);
|
||||
}
|
||||
|
||||
ecma_object_t *resolve_func_p = ecma_get_object_from_value (resolve);
|
||||
@@ -281,7 +281,7 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
|
||||
|
||||
if (JERRY_UNLIKELY (idx == UINT32_MAX - 1))
|
||||
{
|
||||
ecma_raise_range_error (ECMA_ERR_MSG ("Promise.all remaining elements limit reached"));
|
||||
ecma_raise_range_error (ECMA_ERR_PROMISE_ALL_REMAINING_ELEMENTS_LIMIT_REACHED);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ ecma_builtin_promise_dispatch_call (const ecma_value_t *arguments_list_p, /**< a
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Promise requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_PROMISE_REQUIRES_NEW);
|
||||
} /* ecma_builtin_promise_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -472,7 +472,7 @@ ecma_builtin_promise_dispatch_construct (const ecma_value_t *arguments_list_p, /
|
||||
|
||||
if (arguments_list_len == 0 || !ecma_op_is_callable (arguments_list_p[0]))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("First parameter must be callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_FIRST_PARAMETER_MUST_BE_CALLABLE);
|
||||
}
|
||||
|
||||
return ecma_op_create_promise_object (arguments_list_p[0],
|
||||
|
||||
@@ -93,7 +93,7 @@ ecma_builtin_proxy_dispatch_call (const ecma_value_t *arguments_list_p, /**< arg
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
/* 1. */
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Proxy requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_PROXY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_proxy_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,7 +91,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
/* 1. */
|
||||
if (arguments_number == 0 || !ecma_is_value_object (arguments_list[0]))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
|
||||
/* 2. */
|
||||
@@ -158,7 +158,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
/* 1. */
|
||||
if (arguments_number == 0 || !ecma_is_value_object (arguments_list[0]))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *target_p = ecma_get_object_from_value (arguments_list[0]);
|
||||
@@ -182,7 +182,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
/* 1. */
|
||||
if (arguments_number < 1 || !ecma_is_constructor (arguments_list[0]))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_target_is_not_a_constructor));
|
||||
return ecma_raise_type_error (ECMA_ERR_TARGET_IS_NOT_A_CONSTRUCTOR);
|
||||
}
|
||||
|
||||
ecma_object_t *target_p = ecma_get_object_from_value (arguments_list[0]);
|
||||
@@ -195,7 +195,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
/* 3. */
|
||||
if (!ecma_is_constructor (arguments_list[2]))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_target_is_not_a_constructor));
|
||||
return ecma_raise_type_error (ECMA_ERR_TARGET_IS_NOT_A_CONSTRUCTOR);
|
||||
}
|
||||
|
||||
new_target_p = ecma_get_object_from_value (arguments_list[2]);
|
||||
@@ -204,7 +204,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
/* 4. */
|
||||
if (arguments_number < 2)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Reflect.construct expects an object as second argument"));
|
||||
return ecma_raise_type_error (ECMA_ERR_REFLECT_EXPECTS_AN_OBJECT_AS_SECOND_ARGUMENT);
|
||||
}
|
||||
|
||||
ecma_collection_t *coll_p = ecma_op_create_list_from_array_like (arguments_list[1], false);
|
||||
@@ -222,7 +222,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
|
||||
if (!ecma_is_value_object (arguments_list[0]))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_OBJECT);
|
||||
}
|
||||
|
||||
switch (builtin_routine_id)
|
||||
@@ -235,7 +235,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
{
|
||||
if (!ecma_is_value_object (arguments_list[1]) && !ecma_is_value_null (arguments_list[1]))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Prototype is neither object nor null"));
|
||||
return ecma_raise_type_error (ECMA_ERR_PROTOTYPE_IS_NEITHER_OBJECT_NOR_NULL);
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (arguments_list[0]);
|
||||
@@ -258,7 +258,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
|
||||
{
|
||||
if (!ecma_op_is_callable (arguments_list[0]))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a function"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_FUNCTION);
|
||||
}
|
||||
|
||||
ecma_object_t *func_obj_p = ecma_get_object_from_value (arguments_list[0]);
|
||||
|
||||
@@ -261,7 +261,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this */
|
||||
#if !JERRY_ESNEXT
|
||||
if (ecma_get_object_from_value (this_arg) == ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_regexp));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_REGEXP);
|
||||
}
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
|
||||
@@ -275,7 +275,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this */
|
||||
{
|
||||
if (!ecma_is_value_undefined (flags_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument"));
|
||||
return ecma_raise_type_error (ECMA_ERR_INVALID_ARGUMENT);
|
||||
}
|
||||
|
||||
ecma_extended_object_t *pattern_obj_p = (ecma_extended_object_t *) ecma_get_object_from_value (pattern_arg);
|
||||
@@ -666,7 +666,7 @@ ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
|
||||
if (obj_p == NULL)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
switch (builtin_routine_id)
|
||||
@@ -723,7 +723,7 @@ ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
return ecma_make_magic_string_value (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP);
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_regexp));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_REGEXP);
|
||||
}
|
||||
|
||||
ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
@@ -743,7 +743,7 @@ ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_regexp));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_IS_NOT_AN_REGEXP);
|
||||
}
|
||||
|
||||
ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
@@ -57,7 +57,7 @@ ecma_builtin_regexp_string_iterator_prototype_object_next (ecma_value_t this_val
|
||||
/* 2. */
|
||||
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);
|
||||
@@ -65,7 +65,7 @@ ecma_builtin_regexp_string_iterator_prototype_object_next (ecma_value_t this_val
|
||||
/* 3. */
|
||||
if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR))
|
||||
{
|
||||
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_regexp_string_iterator_t *regexp_string_iterator_obj = (ecma_regexp_string_iterator_t *) obj_p;
|
||||
|
||||
@@ -152,7 +152,7 @@ ecma_builtin_regexp_dispatch_helper (const ecma_value_t *arguments_list_p, /**<
|
||||
return ecma_copy_value (pattern_value);
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument is passed to RegExp function"));
|
||||
return ecma_raise_type_error (ECMA_ERR_INVALID_ARGUMENT_IS_PASSED_TO_REGEXP_FUNCTION);
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ ecma_builtin_set_dispatch_call (const ecma_value_t *arguments_list_p, /**< argum
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Set requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_SET_REQUIRES_NEW);
|
||||
} /* ecma_builtin_set_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -71,7 +71,7 @@ ecma_builtin_shared_arraybuffer_prototype_bytelength_getter (ecma_value_t this_a
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a SharedArrayBuffer object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER);
|
||||
} /* ecma_builtin_shared_arraybuffer_prototype_bytelength_getter */
|
||||
|
||||
/**
|
||||
@@ -90,7 +90,7 @@ ecma_builtin_shared_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /
|
||||
{
|
||||
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 *object_p = ecma_get_object_from_value (this_arg);
|
||||
@@ -98,7 +98,7 @@ ecma_builtin_shared_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /
|
||||
/* 2. */
|
||||
if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an SharedArrayBuffer object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_SHARED_ARRAY_BUFFER_OBJECT);
|
||||
}
|
||||
|
||||
return ecma_builtin_arraybuffer_slice (this_arg, argument_list_p, arguments_number);
|
||||
|
||||
@@ -58,7 +58,7 @@ ecma_builtin_shared_arraybuffer_dispatch_call (const ecma_value_t *arguments_lis
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor SharedArrayBuffer requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_SHAREDARRAYBUFFER_REQUIRES_NEW);
|
||||
} /* ecma_builtin_shared_arraybuffer_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -68,7 +68,7 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**<
|
||||
/* 1 - 2. */
|
||||
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);
|
||||
@@ -77,7 +77,7 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**<
|
||||
/* 3. */
|
||||
if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_STRING_ITERATOR))
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -142,7 +142,7 @@ ecma_builtin_string_prototype_object_to_string (ecma_value_t this_arg) /**< this
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a string or a String object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_STRING_OBJECT);
|
||||
} /* ecma_builtin_string_prototype_object_to_string */
|
||||
|
||||
/**
|
||||
@@ -447,7 +447,7 @@ ecma_builtin_string_prototype_object_match_all (ecma_value_t this_argument, /**<
|
||||
|
||||
if (!(parsed_flag & RE_FLAG_GLOBAL))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("RegExp argument should have global flag"));
|
||||
return ecma_raise_type_error (ECMA_ERR_REGEXP_ARGUMENT_SHOULD_HAVE_GLOBAL_FLAG);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ ecma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /*
|
||||
|
||||
if (!have_global_flag)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("RegExp argument should have global flag"));
|
||||
return ecma_raise_type_error (ECMA_ERR_REGEXP_ARGUMENT_SHOULD_HAVE_GLOBAL_FLAG);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1258,7 +1258,7 @@ ecma_builtin_string_prototype_object_repeat (ecma_string_t *original_string_p, /
|
||||
/* 6, 7 */
|
||||
if (count_number < 0 || (!isNan && ecma_number_is_infinity (count_number)))
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid count value"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_COUNT_VALUE);
|
||||
}
|
||||
|
||||
lit_utf8_size_t size = ecma_string_get_size (original_string_p);
|
||||
@@ -1270,7 +1270,7 @@ ecma_builtin_string_prototype_object_repeat (ecma_string_t *original_string_p, /
|
||||
|
||||
if ((uint32_t) repeat_count >= (ECMA_STRING_SIZE_LIMIT / size))
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid string length"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_STRING_);
|
||||
}
|
||||
|
||||
lit_utf8_size_t total_size = size * (lit_utf8_size_t) repeat_count;
|
||||
|
||||
@@ -305,7 +305,7 @@ ecma_builtin_string_object_from_code_point (const ecma_value_t args[], /**< argu
|
||||
if (!ecma_op_is_integer (to_number_num))
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_range_error ("Error: Invalid code point");
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_CODE_POINT_ERROR);
|
||||
}
|
||||
|
||||
ecma_free_value (to_number_value);
|
||||
@@ -313,7 +313,7 @@ ecma_builtin_string_object_from_code_point (const ecma_value_t args[], /**< argu
|
||||
if (to_number_num < 0 || to_number_num > LIT_UNICODE_CODE_POINT_MAX)
|
||||
{
|
||||
ecma_stringbuilder_destroy (&builder);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid code point"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_CODE_POINT);
|
||||
}
|
||||
|
||||
lit_code_point_t code_point = (lit_code_point_t) to_number_num;
|
||||
|
||||
@@ -76,7 +76,7 @@ ecma_builtin_symbol_dispatch_construct (const ecma_value_t *arguments_list_p, /*
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Symbol is not a constructor"));
|
||||
return ecma_raise_type_error (ECMA_ERR_SYMBOL_IS_NOT_A_CONSTRUCTOR);
|
||||
} /* ecma_builtin_symbol_dispatch_construct */
|
||||
|
||||
/**
|
||||
@@ -241,7 +241,7 @@ ecma_builtin_symbol_key_for (ecma_value_t this_arg, /**< this argument */
|
||||
/* 1. */
|
||||
if (!ecma_is_value_symbol (symbol))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("The given argument is not a Symbol"));
|
||||
return ecma_raise_type_error (ECMA_ERR_THE_GIVEN_ARGUMENT_IS_NOT_A_SYMBOL);
|
||||
}
|
||||
|
||||
/* 2-4. */
|
||||
|
||||
@@ -55,8 +55,7 @@ ecma_builtin_type_error_thrower_dispatch_call (const ecma_value_t *arguments_lis
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("'caller', 'callee', and 'arguments' properties may not be accessed"
|
||||
" on strict mode functions or the arguments objects for calls to them"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CANNOT_ACCESS_CALLER_CALLE_ARGUMENTS);
|
||||
} /* ecma_builtin_type_error_thrower_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -47,7 +47,7 @@ ecma_builtin_weakmap_dispatch_call (const ecma_value_t *arguments_list_p, /**< a
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor WeakMap requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_WEAKMAP_REQUIRES_NEW);
|
||||
} /* ecma_builtin_weakmap_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -63,7 +63,7 @@ ecma_builtin_weakref_prototype_object_deref (ecma_value_t this_arg) /**< this ar
|
||||
{
|
||||
if (!ecma_is_value_object (this_arg))
|
||||
{
|
||||
return ecma_raise_type_error ("Target is not Object");
|
||||
return ecma_raise_type_error (ECMA_ERR_TARGET_IS_NOT_OBJECT);
|
||||
}
|
||||
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
@@ -71,7 +71,7 @@ ecma_builtin_weakref_prototype_object_deref (ecma_value_t this_arg) /**< this ar
|
||||
|
||||
if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_WEAKREF))
|
||||
{
|
||||
return ecma_raise_type_error ("Target is not weakRef");
|
||||
return ecma_raise_type_error (ECMA_ERR_TARGET_IS_NOT_WEAKREF);
|
||||
}
|
||||
|
||||
return ecma_copy_value (this_ext_obj->u.cls.u3.target);
|
||||
|
||||
@@ -50,7 +50,7 @@ ecma_builtin_weakref_dispatch_call (const ecma_value_t *arguments_list_p, /**< a
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor WeakRef requires 'new'."));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_WEAKREF_REQUIRES_NEW);
|
||||
} /* ecma_builtin_weakref_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -64,7 +64,7 @@ ecma_builtin_weakref_dispatch_construct (const ecma_value_t *arguments_list_p, /
|
||||
{
|
||||
if (arguments_list_len == 0 || !ecma_is_value_object (arguments_list_p[0]))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("WeakRef target must be an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_WEAKREF_TARGET_MUST_BE_AN_OBJECT);
|
||||
}
|
||||
|
||||
JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) != NULL);
|
||||
|
||||
@@ -47,7 +47,7 @@ ecma_builtin_weakset_dispatch_call (const ecma_value_t *arguments_list_p, /**< a
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor WeakSet requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_WEAKSET_REQUIRES_NEW);
|
||||
} /* ecma_builtin_weakset_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -1592,7 +1592,7 @@ ecma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */
|
||||
|
||||
if (ecma_builtin_function_is_routine (obj_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Built-in routines have no constructor"));
|
||||
return ecma_raise_type_error (ECMA_ERR_BULTIN_ROUTINES_HAVE_NO_CONSTRUCTOR);
|
||||
}
|
||||
|
||||
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
@@ -54,7 +54,7 @@ ecma_builtin_bigint64array_dispatch_call (const ecma_value_t *arguments_list_p,
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor BigInt64Array requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_BIGINT64_ARRAY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_bigint64array_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,7 +54,7 @@ ecma_builtin_biguint64array_dispatch_call (const ecma_value_t *arguments_list_p,
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor BigUInt64Array requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_BIG_UINT64_ARRAY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_biguint64array_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ ecma_builtin_float32array_dispatch_call (const ecma_value_t *arguments_list_p, /
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Float32Array requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_FLOAT32_ARRAY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_float32array_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -54,7 +54,7 @@ ecma_builtin_float64array_dispatch_call (const ecma_value_t *arguments_list_p, /
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Float64Array requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_FLOAT64_ARRAY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_float64array_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ ecma_builtin_int16array_dispatch_call (const ecma_value_t *arguments_list_p, /**
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Int16Array requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_INT16_ARRAY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_int16array_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ ecma_builtin_int32array_dispatch_call (const ecma_value_t *arguments_list_p, /**
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Int32Array requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_INT32_ARRAY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_int32array_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ ecma_builtin_int8array_dispatch_call (const ecma_value_t *arguments_list_p, /**<
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Int8Array requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_INT8_ARRAY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_int8array_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -156,7 +156,7 @@ ecma_builtin_typedarray_prototype_exec_routine (ecma_value_t this_arg, /**< this
|
||||
if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))
|
||||
{
|
||||
ecma_free_value (call_value);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
bool to_bool_result = ecma_op_to_boolean (call_value);
|
||||
@@ -263,7 +263,7 @@ ecma_builtin_typedarray_prototype_map (ecma_value_t this_arg, /**< this object *
|
||||
{
|
||||
ecma_free_value (mapped_value);
|
||||
ecma_free_value (new_typedarray);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
ecma_value_t set_element = target_typedarray_setter_cb (target_buffer_p, mapped_value);
|
||||
@@ -301,7 +301,7 @@ ecma_builtin_typedarray_prototype_reduce_with_direction (ecma_value_t this_arg,
|
||||
{
|
||||
if (arguments_number < 2)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Initial value cannot be undefined"));
|
||||
return ecma_raise_type_error (ECMA_ERR_INITIAL_VALUE_CANNOT_BE_UNDEFINED);
|
||||
}
|
||||
|
||||
return ecma_copy_value (arguments_list_p[1]);
|
||||
@@ -368,7 +368,7 @@ ecma_builtin_typedarray_prototype_reduce_with_direction (ecma_value_t this_arg,
|
||||
if (ecma_arraybuffer_is_detached (info_p->array_buffer_p))
|
||||
{
|
||||
ecma_free_value (call_value);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
accumulator = call_value;
|
||||
@@ -448,7 +448,7 @@ ecma_builtin_typedarray_prototype_filter (ecma_value_t this_arg, /**< this objec
|
||||
{
|
||||
ecma_free_value (call_value);
|
||||
ecma_fast_free_value (get_value);
|
||||
ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -563,7 +563,7 @@ ecma_op_typedarray_set_with_typedarray (ecma_value_t this_arg, /**< this argumen
|
||||
|
||||
if (target_offset_num <= -1.0 || target_offset_num >= (ecma_number_t) UINT32_MAX + 0.5)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid offset"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_OFFSET);
|
||||
}
|
||||
|
||||
ecma_object_t *target_typedarray_p = ecma_get_object_from_value (this_arg);
|
||||
@@ -588,7 +588,7 @@ ecma_op_typedarray_set_with_typedarray (ecma_value_t this_arg, /**< this argumen
|
||||
|
||||
if ((int64_t) src_info.length + target_offset_uint32 > target_info.length)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid range of index"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_RANGE_OF_INDEX);
|
||||
}
|
||||
|
||||
/* Fast path first. If the source and target arrays are the same we do not need to copy anything. */
|
||||
@@ -663,7 +663,7 @@ ecma_builtin_typedarray_prototype_set (ecma_value_t this_arg, /**< this argument
|
||||
|
||||
if (target_offset_num <= -1.0 || target_offset_num >= (ecma_number_t) UINT32_MAX + 0.5)
|
||||
{
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid offset"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_OFFSET);
|
||||
}
|
||||
uint32_t target_offset_uint32 = ecma_number_to_uint32 (target_offset_num);
|
||||
|
||||
@@ -700,7 +700,7 @@ ecma_builtin_typedarray_prototype_set (ecma_value_t this_arg, /**< this argument
|
||||
if ((int64_t) source_length + target_offset_uint32 > target_info.length)
|
||||
{
|
||||
ecma_deref_object (source_obj_p);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid range of index"));
|
||||
return ecma_raise_range_error (ECMA_ERR_INVALID_RANGE_OF_INDEX);
|
||||
}
|
||||
JERRY_ASSERT (source_length <= UINT32_MAX);
|
||||
uint32_t source_length_uint32 = (uint32_t) source_length;
|
||||
@@ -755,7 +755,7 @@ ecma_builtin_typedarray_prototype_set (ecma_value_t this_arg, /**< this argument
|
||||
{
|
||||
ecma_deref_object (source_obj_p);
|
||||
ecma_free_value (value_to_set);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
ecma_value_t set_element = target_typedarray_setter_cb (target_buffer_p, value_to_set);
|
||||
@@ -1142,7 +1142,7 @@ ecma_builtin_typedarray_prototype_sort_compare_helper (ecma_value_t lhs, /**< le
|
||||
if (ecma_arraybuffer_is_detached (array_buffer_p))
|
||||
{
|
||||
ecma_free_value (number_result);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
// If the coerced value can't be represented as a Number, compare them as equals.
|
||||
@@ -1214,7 +1214,7 @@ ecma_builtin_typedarray_prototype_sort (ecma_value_t this_arg, /**< this argumen
|
||||
|
||||
if (ecma_arraybuffer_is_detached (info_p->array_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);
|
||||
}
|
||||
|
||||
ecma_typedarray_setter_fn_t typedarray_setter_cb = ecma_get_typedarray_setter_fn (info_p->id);
|
||||
@@ -1295,7 +1295,7 @@ ecma_builtin_typedarray_prototype_find_helper (ecma_value_t this_arg, /**< this
|
||||
{
|
||||
ecma_free_value (element_value);
|
||||
ecma_free_value (call_value);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARRAYBUFFER_IS_DETACHED);
|
||||
}
|
||||
|
||||
bool call_result = ecma_op_to_boolean (call_value);
|
||||
@@ -1827,7 +1827,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
|
||||
return ECMA_VALUE_UNDEFINED;
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a TypedArray"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_TYPED_ARRAY);
|
||||
}
|
||||
|
||||
ecma_object_t *typedarray_p = ecma_get_object_from_value (this_arg);
|
||||
@@ -1846,7 +1846,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
|
||||
|
||||
if (builtin_routine_id < ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INDEX_OF && !ecma_op_is_callable (arguments_list_p[0]))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
switch (builtin_routine_id)
|
||||
@@ -1913,7 +1913,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
|
||||
{
|
||||
if (!ecma_is_value_undefined (arguments_list_p[0]) && !ecma_op_is_callable (arguments_list_p[0]))
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
return ecma_builtin_typedarray_prototype_sort (this_arg, &info, arguments_list_p[0]);
|
||||
|
||||
@@ -61,7 +61,7 @@ ecma_builtin_typedarray_from (ecma_value_t this_arg, /**< 'this' argument */
|
||||
|
||||
if (!ecma_is_constructor (this_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a constructor"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_CONSTRUCTOR);
|
||||
}
|
||||
|
||||
ecma_value_t source;
|
||||
@@ -70,7 +70,7 @@ ecma_builtin_typedarray_from (ecma_value_t this_arg, /**< 'this' argument */
|
||||
|
||||
if (arguments_list_len == 0)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("No source argument"));
|
||||
return ecma_raise_type_error (ECMA_ERR_NO_SOURCE_ARGUMENT);
|
||||
}
|
||||
|
||||
source = arguments_list_p[0];
|
||||
@@ -81,7 +81,7 @@ ecma_builtin_typedarray_from (ecma_value_t this_arg, /**< 'this' argument */
|
||||
|
||||
if (!ecma_op_is_callable (map_fn))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("The 'mapfn' argument is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_THE_MAPFN_ARGUMENT_IS_NOT_CALLABLE);
|
||||
}
|
||||
|
||||
if (arguments_list_len > 2)
|
||||
@@ -110,7 +110,7 @@ ecma_builtin_typedarray_of (ecma_value_t this_arg, /**< 'this' argument */
|
||||
{
|
||||
if (!ecma_is_constructor (this_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a constructor"));
|
||||
return ecma_raise_type_error (ECMA_ERR_ARGUMENT_THIS_NOT_CONSTRUCTOR);
|
||||
}
|
||||
|
||||
ecma_object_t *constructor_obj_p = ecma_get_object_from_value (this_arg);
|
||||
@@ -166,7 +166,7 @@ ecma_builtin_typedarray_dispatch_call (const ecma_value_t *arguments_list_p, /**
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("TypedArray intrinstic cannot be directly called"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TYPEDARRAY_INTRINSTIC_DIRECTLY_CALLED);
|
||||
} /* ecma_builtin_typedarray_dispatch_call */
|
||||
|
||||
/**
|
||||
@@ -183,7 +183,7 @@ ecma_builtin_typedarray_dispatch_construct (const ecma_value_t *arguments_list_p
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("TypedArray intrinstic cannot be called by a 'new' expression"));
|
||||
return ecma_raise_type_error (ECMA_ERR_TYPEDARRAY_INTRINSTIC_CALLED_BY_NEW_EXPRESSION);
|
||||
} /* ecma_builtin_typedarray_dispatch_construct */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ ecma_builtin_uint16array_dispatch_call (const ecma_value_t *arguments_list_p, /*
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Uint16Array requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_UINT16_ARRAY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_uint16array_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ ecma_builtin_uint32array_dispatch_call (const ecma_value_t *arguments_list_p, /*
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Uint32Array requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_UINT32_ARRAY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_uint32array_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ ecma_builtin_uint8array_dispatch_call (const ecma_value_t *arguments_list_p, /**
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Uint8Array requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_UINT8_ARRAY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_uint8array_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,7 +53,7 @@ ecma_builtin_uint8clampedarray_dispatch_call (const ecma_value_t *arguments_list
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Uint8ClampedArray requires 'new'"));
|
||||
return ecma_raise_type_error (ECMA_ERR_CONSTRUCTOR_UINT8_CLAMPED_ARRAY_REQUIRES_NEW);
|
||||
} /* ecma_builtin_uint8clampedarray_dispatch_call */
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user