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:
@@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-builtins.h"
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jrt.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
@@ -388,8 +387,19 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
|
||||
/* 3. */
|
||||
|
||||
/* a. */
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (nx, px, ret_value);
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (ny, py, ret_value);
|
||||
|
||||
ecma_number_t nx;
|
||||
ecma_number_t ny;
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (px, &nx)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (py, &ny)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
/* b. */
|
||||
if (ecma_number_is_nan (nx)
|
||||
@@ -461,9 +471,6 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
|
||||
|
||||
ret_value = ecma_make_boolean_value (is_x_less_than_y);
|
||||
}
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (ny);
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (nx);
|
||||
#if ENABLED (JERRY_BUILTIN_BIGINT)
|
||||
}
|
||||
else
|
||||
@@ -505,7 +512,11 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
|
||||
}
|
||||
else
|
||||
{
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (ny, py, ret_value);
|
||||
ecma_number_t ny;
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (py,&ny)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
if (ecma_number_is_nan (ny))
|
||||
{
|
||||
@@ -515,8 +526,6 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
|
||||
{
|
||||
compare_result = ecma_bigint_compare_to_number (px, ny);
|
||||
}
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (ny);
|
||||
}
|
||||
|
||||
if (ret_value == ECMA_VALUE_EMPTY)
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "ecma-objects-arguments.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
#include "ecma-symbol-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jcontext.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
|
||||
#include "ecma-reference.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-objects-arguments.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
|
||||
#include "jrt.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-objects-general.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#if ENABLED (JERRY_BUILTIN_TYPEDARRAY)
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-regexp-object.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "jcontext.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
#include "lit-char-helpers.h"
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/* 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.
|
||||
*/
|
||||
|
||||
#ifndef ECMA_TRY_CATCH_MACRO_H
|
||||
#define ECMA_TRY_CATCH_MACRO_H
|
||||
|
||||
#include "ecma-helpers.h"
|
||||
|
||||
/**
|
||||
* The macro defines try-block that tries to perform ToNumber operation on given value
|
||||
* and checks for exceptions that might be thrown during the operation.
|
||||
*
|
||||
* If no exception was thrown, then code after the try-block is executed.
|
||||
* Otherwise, throw-completion value is just copied to return_value.
|
||||
*
|
||||
* Note:
|
||||
* Each ECMA_OP_TO_NUMBER_TRY_CATCH should have it's own corresponding ECMA_OP_TO_NUMBER_FINALIZE
|
||||
* statement with same argument as corresponding ECMA_OP_TO_NUMBER_TRY_CATCH's first argument.
|
||||
*/
|
||||
#define ECMA_OP_TO_NUMBER_TRY_CATCH(num_var, value, return_value) \
|
||||
JERRY_ASSERT (return_value == ECMA_VALUE_EMPTY); \
|
||||
ecma_number_t num_var; \
|
||||
return_value = ecma_op_to_number (value, &num_var); \
|
||||
\
|
||||
if (JERRY_LIKELY (ecma_is_value_empty (return_value))) \
|
||||
{
|
||||
|
||||
/**
|
||||
* The macro marks end of code block that is defined by corresponding ECMA_OP_TO_NUMBER_TRY_CATCH.
|
||||
*
|
||||
* Note:
|
||||
* Each ECMA_OP_TO_NUMBER_TRY_CATCH should be followed by ECMA_OP_TO_NUMBER_FINALIZE
|
||||
* with same argument as corresponding ECMA_OP_TO_NUMBER_TRY_CATCH's first argument.
|
||||
*/
|
||||
#define ECMA_OP_TO_NUMBER_FINALIZE(num_var) }
|
||||
|
||||
#endif /* !ECMA_TRY_CATCH_MACRO_H */
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "ecma-bigint.h"
|
||||
#include "ecma-big-uint.h"
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-try-catch-macro.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-exceptions.h"
|
||||
@@ -1345,8 +1344,12 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("length argument is undefined"));
|
||||
}
|
||||
|
||||
ECMA_OP_TO_NUMBER_TRY_CATCH (num, arguments_list_p[0], ret);
|
||||
ecma_number_t num;
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (arguments_list_p[0], &num)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
uint32_t length = ecma_number_to_uint32 (num);
|
||||
|
||||
if (num != ((ecma_number_t) length))
|
||||
@@ -1361,8 +1364,6 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
element_size_shift,
|
||||
typedarray_id);
|
||||
}
|
||||
|
||||
ECMA_OP_TO_NUMBER_FINALIZE (num);
|
||||
}
|
||||
else if (ecma_is_value_object (arguments_list_p[0]))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user