Refactor ecma_op_check_object_coercible (#4169)

The method returns bool now instead of an ecma_value_t

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
Szilagyi Adam
2020-08-28 13:12:50 +02:00
committed by GitHub
parent e98f5342f9
commit 9589771f7a
7 changed files with 28 additions and 39 deletions
+4 -6
View File
@@ -255,12 +255,10 @@ vm_op_delete_prop (ecma_value_t object, /**< base object */
}
#endif /* !ENABLED (JERRY_ESNEXT) */
ecma_value_t check_coercible = ecma_op_check_object_coercible (object);
if (ECMA_IS_VALUE_ERROR (check_coercible))
if (!ecma_op_require_object_coercible (object))
{
return check_coercible;
return ECMA_VALUE_ERROR;
}
JERRY_ASSERT (check_coercible == ECMA_VALUE_EMPTY);
ecma_string_t *name_string_p = ecma_op_to_property_key (property);
@@ -270,7 +268,7 @@ vm_op_delete_prop (ecma_value_t object, /**< base object */
}
ecma_value_t obj_value = ecma_op_to_object (object);
/* The ecma_op_check_object_coercible call already checked the op_to_object error cases. */
/* The ecma_op_require_object_coercible call already checked the op_to_object error cases. */
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (obj_value));
JERRY_ASSERT (ecma_is_value_object (obj_value));
ecma_object_t *obj_p = ecma_get_object_from_value (obj_value);
@@ -1394,7 +1392,7 @@ opfunc_form_super_reference (ecma_value_t **vm_stack_top_p, /**< current vm stac
return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot invoke nullable super method."));
}
if (ECMA_IS_VALUE_ERROR (ecma_op_check_object_coercible (parent)))
if (!ecma_op_require_object_coercible (parent))
{
return ECMA_VALUE_ERROR;
}
+2 -3
View File
@@ -2478,10 +2478,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_REQUIRE_OBJECT_COERCIBLE:
{
result = ecma_op_check_object_coercible (stack_top_p[-1]);
if (ECMA_IS_VALUE_ERROR (result))
if (!ecma_op_require_object_coercible (stack_top_p[-1]))
{
result = ECMA_VALUE_ERROR;
goto error;
}
continue;