Add constant error messages (#4640)
added two new file ecma-errors.h and ecma-erros.c it contains the most used errors messages. JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
This commit is contained in:
@@ -0,0 +1,180 @@
|
||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-errors.h"
|
||||
|
||||
#if JERRY_ERROR_MESSAGES
|
||||
|
||||
/**
|
||||
* Error message, if an argument is has an error flag
|
||||
*/
|
||||
const char * const ecma_error_value_msg_p = "Argument cannot be marked as error";
|
||||
|
||||
/**
|
||||
* Error message, if an argument has a wrong type
|
||||
*/
|
||||
const char * const ecma_error_wrong_args_msg_p = "This type of argument is not allowed";
|
||||
|
||||
#if !JERRY_PARSER
|
||||
/**
|
||||
* Error message, if parsing is disabled
|
||||
*/
|
||||
const char * const ecma_error_parser_not_supported_p = "Source code parsing is disabled";
|
||||
#endif /* !JERRY_PARSER */
|
||||
|
||||
#if !JERRY_BUILTIN_JSON
|
||||
/**
|
||||
* Error message, if JSON support is disabled
|
||||
*/
|
||||
const char * const ecma_error_json_not_supported_p = "JSON support is disabled";
|
||||
#endif /* !JERRY_BUILTIN_JSON */
|
||||
|
||||
#if !JERRY_ESNEXT
|
||||
/**
|
||||
* Error message, if Symbol support is disabled
|
||||
*/
|
||||
const char * const ecma_error_symbol_not_supported_p = "Symbol support is disabled";
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
|
||||
#if !JERRY_BUILTIN_PROMISE
|
||||
/**
|
||||
* Error message, if Promise support is disabled
|
||||
*/
|
||||
const char * const ecma_error_promise_not_supported_p = "Promise support is disabled";
|
||||
#endif /* !JERRY_BUILTIN_PROMISE */
|
||||
|
||||
#if !JERRY_BUILTIN_TYPEDARRAY
|
||||
/**
|
||||
* Error message, if TypedArray support is disabled
|
||||
*/
|
||||
const char * const ecma_error_typed_array_not_supported_p = "TypedArray support is disabled";
|
||||
#endif /* !JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
#if !JERRY_BUILTIN_DATAVIEW
|
||||
/**
|
||||
* Error message, if DataView support is disabled
|
||||
*/
|
||||
const char * const ecma_error_data_view_not_supported_p = "DataView support is disabled";
|
||||
#endif /* !JERRY_BUILTIN_DATAVIEW */
|
||||
|
||||
#if !JERRY_BUILTIN_BIGINT
|
||||
/**
|
||||
* Error message, if BigInt support is disabled
|
||||
*/
|
||||
const char * const ecma_error_bigint_not_supported_p = "BigInt support is disabled";
|
||||
#endif /* !JERRY_BUILTIN_BIGINT */
|
||||
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
/**
|
||||
* Error message, if argument is not a module
|
||||
*/
|
||||
const char * const ecma_error_not_module_p = "Argument is not a module";
|
||||
#else /* !JERRY_MODULE_SYSTEM */
|
||||
/**
|
||||
* Error message, if Module support is disabled
|
||||
*/
|
||||
const char * const ecma_error_module_not_supported_p = "Module support is disabled";
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
|
||||
/**
|
||||
* Error message, if callback function is not callable
|
||||
*/
|
||||
const char * const ecma_error_callback_is_not_callable = "Callback function is not callable";
|
||||
|
||||
/**
|
||||
* Error message, if arrayBuffer is detached
|
||||
*/
|
||||
const char * const ecma_error_arraybuffer_is_detached = "ArrayBuffer has been detached";
|
||||
|
||||
/**
|
||||
* Error message, cannot convert undefined or null to object
|
||||
*/
|
||||
const char * const ecma_error_cannot_convert_to_object = "Cannot convert undefined or null to object";
|
||||
|
||||
/**
|
||||
* Error message, prototype property of a class is non-configurable
|
||||
*/
|
||||
const char * const ecma_error_class_is_non_configurable = "Prototype property of a class is non-configurable";
|
||||
|
||||
/**
|
||||
* Error message, argument is not an object
|
||||
*/
|
||||
const char * const ecma_error_argument_is_not_an_object = "Argument is not an object";
|
||||
|
||||
/**
|
||||
* Error message, target is not a constructor
|
||||
*/
|
||||
const char * const ecma_error_target_is_not_a_constructor = "Target is not a constructor";
|
||||
|
||||
/**
|
||||
* Error message, argument is not an regexp
|
||||
*/
|
||||
const char * const ecma_error_argument_is_not_an_regexp = "Argument 'this' is not a RegExp object";
|
||||
|
||||
/**
|
||||
* Error message, invalid array length
|
||||
*/
|
||||
const char * const ecma_error_invalid_array_length = "Invalid Array length";
|
||||
|
||||
/**
|
||||
* Error message, local variable is redeclared
|
||||
*/
|
||||
const char * const ecma_error_local_variable_is_redeclared = "Local variable is redeclared";
|
||||
|
||||
/**
|
||||
* Error message, expected a function
|
||||
*/
|
||||
const char * const ecma_error_expected_a_function = "Expected a function";
|
||||
|
||||
/**
|
||||
* Error message, class constructor invoked without new keyword
|
||||
*/
|
||||
const char * const ecma_error_class_constructor_new = "Class constructor cannot be invoked without 'new'";
|
||||
|
||||
#endif /* JERRY_ERROR_MESSAGES */
|
||||
|
||||
#if JERRY_SNAPSHOT_SAVE || JERRY_SNAPSHOT_EXEC
|
||||
|
||||
/**
|
||||
* Error message, maximum snapshot size reached
|
||||
*/
|
||||
const char * const ecma_error_maximum_snapshot_size = "Maximum snapshot size reached";
|
||||
|
||||
/**
|
||||
* Error message, regular expressions literals are not supported
|
||||
*/
|
||||
const char * const ecma_error_regular_expression_not_supported = "Regular expression literals are not supported";
|
||||
|
||||
/**
|
||||
* Error message, snapshot buffer too small
|
||||
*/
|
||||
const char * const ecma_error_snapshot_buffer_small = "Snapshot buffer too small";
|
||||
|
||||
/**
|
||||
* Error message, Unsupported generate snapshot flags specified
|
||||
*/
|
||||
const char * const ecma_error_snapshot_flag_not_supported = "Unsupported generate snapshot flags specified";
|
||||
|
||||
/**
|
||||
* Error message, Cannot allocate memory for literals
|
||||
*/
|
||||
const char * const ecma_error_cannot_allocate_memory_literals = "Cannot allocate memory for literals";
|
||||
|
||||
/**
|
||||
* Error message, Unsupported feature: tagged template literals
|
||||
*/
|
||||
const char * const ecma_error_tagged_template_literals = "Unsupported feature: tagged template literals";
|
||||
|
||||
#endif /* JERRY_SNAPSHOT_SAVE || JERRY_SNAPSHOT_EXEC */
|
||||
@@ -0,0 +1,77 @@
|
||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifndef ECMA_ERRORS_H
|
||||
#define ECMA_ERRORS_H
|
||||
|
||||
extern const char * const ecma_error_value_msg_p;
|
||||
extern const char * const ecma_error_wrong_args_msg_p;
|
||||
|
||||
#if !JERRY_PARSER
|
||||
extern const char * const ecma_error_parser_not_supported_p;
|
||||
#endif /* !JERRY_PARSER */
|
||||
|
||||
#if !JERRY_BUILTIN_JSON
|
||||
extern const char * const ecma_error_json_not_supported_p;
|
||||
#endif /* !JERRY_BUILTIN_JSON */
|
||||
|
||||
#if !JERRY_ESNEXT
|
||||
extern const char * const ecma_error_symbol_not_supported_p;
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
|
||||
#if !JERRY_BUILTIN_PROMISE
|
||||
extern const char * const ecma_error_promise_not_supported_p;
|
||||
#endif /* !JERRY_BUILTIN_PROMISE */
|
||||
|
||||
#if !JERRY_BUILTIN_TYPEDARRAY
|
||||
extern const char * const ecma_error_typed_array_not_supported_p;
|
||||
#endif /* !JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
#if !JERRY_BUILTIN_DATAVIEW
|
||||
extern const char * const ecma_error_data_view_not_supported_p;
|
||||
#endif /* !JERRY_BUILTIN_DATAVIEW */
|
||||
|
||||
#if !JERRY_BUILTIN_BIGINT
|
||||
extern const char * const ecma_error_bigint_not_supported_p;
|
||||
#endif /* !JERRY_BUILTIN_BIGINT */
|
||||
|
||||
#if JERRY_MODULE_SYSTEM
|
||||
extern const char * const ecma_error_not_module_p;
|
||||
#else /* !JERRY_MODULE_SYSTEM */
|
||||
extern const char * const ecma_error_module_not_supported_p;
|
||||
#endif /* JERRY_MODULE_SYSTEM */
|
||||
|
||||
extern const char * const ecma_error_callback_is_not_callable;
|
||||
extern const char * const ecma_error_arraybuffer_is_detached;
|
||||
extern const char * const ecma_error_cannot_convert_to_object;
|
||||
extern const char * const ecma_error_class_is_non_configurable;
|
||||
extern const char * const ecma_error_argument_is_not_an_object;
|
||||
extern const char * const ecma_error_target_is_not_a_constructor;
|
||||
extern const char * const ecma_error_argument_is_not_an_regexp;
|
||||
extern const char * const ecma_error_invalid_array_length;
|
||||
extern const char * const ecma_error_local_variable_is_redeclared;
|
||||
extern const char * const ecma_error_expected_a_function;
|
||||
extern const char * const ecma_error_class_constructor_new;
|
||||
|
||||
/* snapshot errors */
|
||||
extern const char * const ecma_error_maximum_snapshot_size;
|
||||
extern const char * const ecma_error_regular_expression_not_supported;
|
||||
extern const char * const ecma_error_snapshot_buffer_small;
|
||||
extern const char * const ecma_error_snapshot_flag_not_supported;
|
||||
extern const char * const ecma_error_cannot_allocate_memory_literals;
|
||||
extern const char * const ecma_error_tagged_template_literals;
|
||||
#endif /* !ECMA_ERRORS_H */
|
||||
@@ -16,6 +16,7 @@
|
||||
#ifndef ECMA_GLOBALS_H
|
||||
#define ECMA_GLOBALS_H
|
||||
|
||||
#include "ecma-errors.h"
|
||||
#include "config.h"
|
||||
#include "jrt.h"
|
||||
#include "lit-magic-strings.h"
|
||||
|
||||
@@ -87,7 +87,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 ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
/* b. */
|
||||
|
||||
@@ -437,7 +437,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 ("Invalid Array length"));
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
}
|
||||
|
||||
if (arguments_number == 0)
|
||||
@@ -1505,7 +1505,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 ("Invalid Array length"));
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
}
|
||||
|
||||
if (args_number == 0)
|
||||
@@ -1849,7 +1849,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 ("Callback function is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_callback_is_not_callable));
|
||||
}
|
||||
|
||||
/* We already checked that arg1 is callable */
|
||||
@@ -1932,7 +1932,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 ("Callback function is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_callback_is_not_callable));
|
||||
}
|
||||
|
||||
/* 6. */
|
||||
@@ -2026,7 +2026,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 ("Callback function is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_callback_is_not_callable));
|
||||
}
|
||||
|
||||
/* 6. */
|
||||
@@ -2134,7 +2134,7 @@ 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 ("Callback function is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_callback_is_not_callable));
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
@@ -2352,7 +2352,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 ("Callback function is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_callback_is_not_callable));
|
||||
}
|
||||
|
||||
/* We already checked that predicate is callable, so it will always be an object. */
|
||||
@@ -2836,7 +2836,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 ("Callback function is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_callback_is_not_callable));
|
||||
}
|
||||
|
||||
/* 4. */
|
||||
|
||||
@@ -96,7 +96,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 ("Callback function is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_callback_is_not_callable));
|
||||
}
|
||||
|
||||
/* 3.b */
|
||||
@@ -135,7 +135,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 ("Cannot convert undefined or null to object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_cannot_convert_to_object));
|
||||
}
|
||||
|
||||
/* 6.c */
|
||||
@@ -298,7 +298,7 @@ iterator_cleanup:
|
||||
|
||||
if (ecma_is_value_undefined (array) || ecma_is_value_null (array))
|
||||
{
|
||||
ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert undefined or null to object"));
|
||||
ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_cannot_convert_to_object));
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
@@ -493,7 +493,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 ("Invalid array length"));
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
}
|
||||
|
||||
return ecma_make_object_value (ecma_op_new_array_object (num_uint32));
|
||||
|
||||
@@ -65,7 +65,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 ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
uint32_t len = ecma_arraybuffer_get_length (object_p);
|
||||
|
||||
@@ -108,7 +108,7 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi
|
||||
/* 4. */
|
||||
if (ecma_arraybuffer_is_detached (object_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
|
||||
@@ -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 ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_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 ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
return ecma_make_uint32_value (obj_p->byte_offset);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,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 ("Argument is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (arg2);
|
||||
|
||||
@@ -369,7 +369,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 ("Invalid array length"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
}
|
||||
#else /* !JERRY_ESNEXT */
|
||||
/* 5.b.ii */
|
||||
|
||||
@@ -176,7 +176,7 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-
|
||||
|
||||
if (ecma_arraybuffer_is_detached (ecma_typedarray_get_arraybuffer (ecma_get_object_from_value (this_arg))))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
return ecma_typedarray_iterators_helper (this_arg, ECMA_ITERATOR_VALUES);
|
||||
|
||||
@@ -956,7 +956,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 ("Argument is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
}
|
||||
|
||||
ecma_object_t *obj_p = NULL;
|
||||
@@ -1415,7 +1415,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 ("Argument is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
}
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
|
||||
@@ -1424,7 +1424,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 ("Argument is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
|
||||
|
||||
@@ -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 ("Argument is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
}
|
||||
|
||||
/* 2. */
|
||||
@@ -159,7 +159,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 ("Argument is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
}
|
||||
|
||||
ecma_object_t *target_p = ecma_get_object_from_value (arguments_list[0]);
|
||||
@@ -183,7 +183,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 ("Target is not a constructor"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_target_is_not_a_constructor));
|
||||
}
|
||||
|
||||
ecma_object_t *target_p = ecma_get_object_from_value (arguments_list[0]);
|
||||
@@ -196,7 +196,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 ("Target is not a constructor"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_target_is_not_a_constructor));
|
||||
}
|
||||
|
||||
new_target_p = ecma_get_object_from_value (arguments_list[2]);
|
||||
@@ -226,7 +226,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 ("Argument is not an object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
}
|
||||
|
||||
switch (builtin_routine_id)
|
||||
|
||||
@@ -278,7 +278,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 ("Argument 'this' is not a RegExp object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_regexp));
|
||||
}
|
||||
#endif /* !JERRY_ESNEXT */
|
||||
|
||||
@@ -745,7 +745,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 ("Argument 'this' is not a RegExp object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_regexp));
|
||||
}
|
||||
|
||||
ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
@@ -765,7 +765,7 @@ ecma_builtin_regexp_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 RegExp object"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_regexp));
|
||||
}
|
||||
|
||||
ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p;
|
||||
|
||||
@@ -511,7 +511,7 @@ ecma_op_typedarray_set_with_typedarray (ecma_value_t this_arg, /**< this argumen
|
||||
ecma_object_t *arraybuffer_p = ecma_typedarray_get_arraybuffer (target_typedarray_p);
|
||||
if (ecma_arraybuffer_is_detached (arraybuffer_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
ecma_typedarray_info_t target_info = ecma_typedarray_get_info (target_typedarray_p);
|
||||
@@ -520,7 +520,7 @@ ecma_op_typedarray_set_with_typedarray (ecma_value_t this_arg, /**< this argumen
|
||||
ecma_object_t *src_arraybuffer_p = ecma_typedarray_get_arraybuffer (src_typedarray_p);
|
||||
if (ecma_arraybuffer_is_detached (src_arraybuffer_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
ecma_typedarray_info_t src_info = ecma_typedarray_get_info (src_typedarray_p);
|
||||
@@ -614,7 +614,7 @@ ecma_builtin_typedarray_prototype_set (ecma_value_t this_arg, /**< this argument
|
||||
ecma_object_t *arraybuffer_p = ecma_typedarray_get_arraybuffer (typedarray_p);
|
||||
if (ecma_arraybuffer_is_detached (arraybuffer_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);
|
||||
@@ -1723,13 +1723,13 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
|
||||
if (ecma_arraybuffer_is_detached (info.array_buffer_p)
|
||||
&& builtin_routine_id != ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SUBARRAY)
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
}
|
||||
|
||||
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 ("Callback function is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_callback_is_not_callable));
|
||||
}
|
||||
|
||||
switch (builtin_routine_id)
|
||||
@@ -1796,7 +1796,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 ("Callback function is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_callback_is_not_callable));
|
||||
}
|
||||
|
||||
return ecma_builtin_typedarray_prototype_sort (this_arg, &info, arguments_list_p[0]);
|
||||
|
||||
@@ -173,7 +173,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 ("Invalid Array length"));
|
||||
ecma_raise_range_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
return NULL;
|
||||
}
|
||||
#endif /* JERRY_ESNEXT */
|
||||
@@ -996,7 +996,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 ("Invalid Array length"));
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
|
||||
}
|
||||
|
||||
/* Only the writable and data properties can be modified. */
|
||||
|
||||
@@ -756,7 +756,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 ("Callback function is not callable"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_callback_is_not_callable));
|
||||
}
|
||||
|
||||
JERRY_ASSERT (ecma_is_value_object (predicate));
|
||||
|
||||
@@ -818,7 +818,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
&& !ecma_is_value_undefined (get_prop_value))
|
||||
{
|
||||
ecma_free_value (get_prop_value);
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function));
|
||||
goto free_desc;
|
||||
}
|
||||
|
||||
@@ -856,7 +856,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
|
||||
&& !ecma_is_value_undefined (set_prop_value))
|
||||
{
|
||||
ecma_free_value (set_prop_value);
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function"));
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function));
|
||||
goto free_desc;
|
||||
}
|
||||
|
||||
@@ -1098,7 +1098,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 ("Argument is not an object"));
|
||||
ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_object));
|
||||
return NULL;
|
||||
}
|
||||
ecma_object_t *obj_p = ecma_get_object_from_value (arr);
|
||||
|
||||
@@ -80,7 +80,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 ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
@@ -132,7 +132,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 ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
/* 9. */
|
||||
@@ -300,7 +300,7 @@ ecma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'vi
|
||||
if (ecma_arraybuffer_is_detached (buffer_p))
|
||||
{
|
||||
ecma_free_value (value_to_set);
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
/* GetViewValue 7., SetViewValue 9. */
|
||||
|
||||
@@ -815,7 +815,7 @@ ecma_typedarray_create_object_with_buffer (ecma_object_t *arraybuffer_p, /**< th
|
||||
{
|
||||
if (ecma_arraybuffer_is_detached (arraybuffer_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
uint32_t expected_length = (ecma_arraybuffer_get_length (arraybuffer_p) >> element_size_shift);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user