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:
Csaba Repasi
2021-11-25 14:06:40 +01:00
committed by GitHub
parent fc4168f2b4
commit 271d9b2463
111 changed files with 1947 additions and 925 deletions
+17 -72
View File
@@ -13,82 +13,27 @@
* limitations under the License.
*/
#include "config.h"
#ifndef ECMA_ERRORS_H
#define ECMA_ERRORS_H
#include "lit-globals.h"
typedef enum
{
ECMA_ERR_EMPTY,
/** @cond doxygen_suppress */
#if JERRY_ERROR_MESSAGES
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;
extern const char* const ecma_error_promise_not_supported_p;
#endif /* !JERRY_ESNEXT */
#if !JERRY_BUILTIN_TYPEDARRAY
extern const char* const ecma_error_typed_array_not_supported_p;
#endif /* !JERRY_BUILTIN_TYPEDARRAY */
#if !JERRY_BUILTIN_SHAREDARRAYBUFFER
extern const char* const ecma_error_shared_arraybuffer_not_supported_p;
#endif /* !JERRY_BUILTIN_SHAREDARRAYBUFFER */
#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_BUILTIN_CONTAINER
extern const char* const ecma_error_container_not_supported_p;
#endif /* !JERRY_BUILTIN_CONTAINER */
#if JERRY_MODULE_SYSTEM
extern const char* const ecma_error_not_module_p;
extern const char* const ecma_error_unknown_export_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 int ecma_error_argument_is_not_an_object_length;
extern const char* const ecma_error_argument_is_not_a_proxy;
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;
#if JERRY_ESNEXT
extern const char* const ecma_error_class_constructor_new;
extern const char* const ecma_error_let_const_not_initialized;
#endif /* JERRY_ESNEXT */
#define ECMA_ERROR_DEF(id, ascii_zt_string) id,
#else /* !JERRY_ERROR_MESSAGES */
#define ECMA_ERROR_DEF(id, ascii_zt_string) id = ECMA_ERR_EMPTY,
#endif /* JERRY_ERROR_MESSAGES */
#include "ecma-error-messages.inc.h"
#undef ECMA_ERROR_DEF
/** @endcond */
ECMA_IS_VALID_CONSTRUCTOR /* used as return value when checking constructor */
} ecma_error_msg_t;
const lit_utf8_byte_t* ecma_get_error_utf8 (uint32_t id);
lit_utf8_size_t ecma_get_error_size (uint32_t id);
/* 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 */