Delete ECMA_OP_TO_NUMBER_TRY_CATCH macro (#4229)
JerryScript-DCO-1.0-Signed-off-by: Virag Orkenyi orkvi@inf.u-szeged.hu
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-dataview-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "jrt.h"
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_BOOLEAN)
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_DATE)
|
||||
|
||||
@@ -622,16 +621,16 @@ ecma_builtin_date_prototype_dispatch_routine (uint16_t builtin_routine_id, /**<
|
||||
|
||||
if (builtin_routine_id == ECMA_DATE_PROTOTYPE_SET_TIME)
|
||||
{
|
||||
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
|
||||
ecma_number_t time_num;
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (arguments_list[0], &time_num)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
/* 1. */
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (time_num, arguments_list[0], ret_value);
|
||||
*prim_value_p = ecma_date_time_clip (time_num);
|
||||
|
||||
ret_value = ecma_make_number_value (time_num);
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (time_num);
|
||||
|
||||
return ret_value;
|
||||
return ecma_make_number_value (time_num);
|
||||
}
|
||||
|
||||
if (builtin_routine_id <= ECMA_DATE_PROTOTYPE_SET_UTC_MILLISECONDS)
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "lit-char-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
#include "lit-magic-strings.h"
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
#include "ecma-builtin-function-prototype.h"
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-lex-env.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "js-parser.h"
|
||||
#include "lit-magic-strings.h"
|
||||
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
#include "lit-char-helpers.h"
|
||||
#include "lit-magic-strings.h"
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_DATE)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "jmem.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "lit-magic-strings.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "ecma-number-arithmetic.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-number-object.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_NUMBER)
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-regexp-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "jcontext.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-regexp-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_REGEXP)
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
#include "ecma-symbol-object.h"
|
||||
#endif /* ENABLED (JERRY_ESNEXT) */
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_STRING)
|
||||
@@ -69,9 +68,9 @@ ecma_builtin_string_object_from_char_code (ecma_value_t this_arg, /**< 'this' ar
|
||||
return ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
|
||||
}
|
||||
|
||||
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
|
||||
ecma_string_t *ret_string_p = NULL;
|
||||
lit_utf8_size_t utf8_buf_size = args_number * LIT_CESU8_MAX_BYTES_IN_CODE_UNIT;
|
||||
ecma_string_t *ret_string_p = NULL;
|
||||
bool isError = false;
|
||||
|
||||
JMEM_DEFINE_LOCAL_ARRAY (utf8_buf_p,
|
||||
utf8_buf_size,
|
||||
@@ -80,10 +79,16 @@ ecma_builtin_string_object_from_char_code (ecma_value_t this_arg, /**< 'this' ar
|
||||
lit_utf8_size_t utf8_buf_used = 0;
|
||||
|
||||
for (uint32_t arg_index = 0;
|
||||
arg_index < args_number && ecma_is_value_empty (ret_value);
|
||||
arg_index < args_number;
|
||||
arg_index++)
|
||||
{
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (arg_num, args[arg_index], ret_value);
|
||||
ecma_number_t arg_num;
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (args[arg_index], &arg_num)))
|
||||
{
|
||||
isError = true;
|
||||
break;
|
||||
}
|
||||
|
||||
uint32_t uint32_char_code = ecma_number_to_uint32 (arg_num);
|
||||
ecma_char_t code_unit = (uint16_t) uint32_char_code;
|
||||
@@ -91,23 +96,16 @@ ecma_builtin_string_object_from_char_code (ecma_value_t this_arg, /**< 'this' ar
|
||||
JERRY_ASSERT (utf8_buf_used <= utf8_buf_size - LIT_UTF8_MAX_BYTES_IN_CODE_UNIT);
|
||||
utf8_buf_used += lit_code_unit_to_utf8 (code_unit, utf8_buf_p + utf8_buf_used);
|
||||
JERRY_ASSERT (utf8_buf_used <= utf8_buf_size);
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (arg_num);
|
||||
}
|
||||
|
||||
if (ecma_is_value_empty (ret_value))
|
||||
if (!isError)
|
||||
{
|
||||
ret_string_p = ecma_new_ecma_string_from_utf8 (utf8_buf_p, utf8_buf_used);
|
||||
}
|
||||
|
||||
JMEM_FINALIZE_LOCAL_ARRAY (utf8_buf_p);
|
||||
|
||||
if (ecma_is_value_empty (ret_value))
|
||||
{
|
||||
ret_value = ecma_make_string_value (ret_string_p);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
return isError ? ECMA_VALUE_ERROR : ecma_make_string_value (ret_string_p);
|
||||
} /* ecma_builtin_string_object_from_char_code */
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-symbol-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_ESNEXT)
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-symbol-object.h"
|
||||
#include "ecma-literal-storage.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jcontext.h"
|
||||
#include "jrt.h"
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-string-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if ENABLED (JERRY_BUILTIN_ERRORS)
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "jrt.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user