aboutsummaryrefslogtreecommitdiff
path: root/jerry-main
diff options
context:
space:
mode:
authorZoltan Herczeg <zherczeg.u-szeged@partner.samsung.com>2017-10-18 03:44:48 -0700
committeryichoi <duddlf.choi@samsung.com>2017-10-24 17:33:04 +0900
commit53cd3241790716f19313008ada3c2ae842bf43d9 (patch)
tree72f3c7dac0021ff5b0ab6f4a8e144f43ba9f3b06 /jerry-main
parent742654a3f105497e19067ed9a43d7834a6854930 (diff)
Rework error to use a global slot to store the error value.
This change frees up the error bit in ecma_value_t, which allows to define 4 more value types (e.g. symbols). To keep API compatibility we introduce a box for values with error flag. JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
Diffstat (limited to 'jerry-main')
-rw-r--r--jerry-main/main-unix.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/jerry-main/main-unix.c b/jerry-main/main-unix.c
index 65dd5ff5..e1590d00 100644
--- a/jerry-main/main-unix.c
+++ b/jerry-main/main-unix.c
@@ -133,9 +133,8 @@ jerry_value_is_syntax_error (jerry_value_t error_value) /**< error value */
static void
print_unhandled_exception (jerry_value_t error_value) /**< error value */
{
- assert (jerry_value_has_error_flag (error_value));
+ assert (!jerry_value_has_error_flag (error_value));
- jerry_value_clear_error_flag (&error_value);
jerry_value_t err_str_val = jerry_value_to_string (error_value);
jerry_size_t err_str_size = jerry_get_string_size (err_str_val);
jerry_char_t err_str_buf[256];
@@ -262,6 +261,7 @@ register_js_function (const char *name_p, /**< name of the function */
if (jerry_value_has_error_flag (result_val))
{
jerry_port_log (JERRY_LOG_LEVEL_WARNING, "Warning: failed to register '%s' method.", name_p);
+ jerry_value_clear_error_flag (&result_val);
print_unhandled_exception (result_val);
}
@@ -870,11 +870,13 @@ main (int argc,
if (jerry_value_has_error_flag (ret_val_eval))
{
+ jerry_value_clear_error_flag (&ret_val_eval);
print_unhandled_exception (ret_val_eval);
}
}
else
{
+ jerry_value_clear_error_flag (&ret_val_eval);
print_unhandled_exception (ret_val_eval);
}
@@ -887,6 +889,7 @@ main (int argc,
if (jerry_value_has_error_flag (ret_value))
{
+ jerry_value_clear_error_flag (&ret_value);
print_unhandled_exception (ret_value);
ret_code = JERRY_STANDALONE_EXIT_CODE_FAIL;
@@ -898,6 +901,7 @@ main (int argc,
if (jerry_value_has_error_flag (ret_value))
{
+ jerry_value_clear_error_flag (&ret_value);
print_unhandled_exception (ret_value);
ret_code = JERRY_STANDALONE_EXIT_CODE_FAIL;
}