Fixing ecma_op_abstract_equality_compare.

This commit is contained in:
Ruben Ayrapetyan
2014-10-15 16:56:45 +04:00
parent f4ff85e861
commit b3f45c5c82
+28 -6
View File
@@ -125,10 +125,9 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
{ // 2., 3. { // 2., 3.
ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE); ret_value = ecma_make_simple_completion_value (ECMA_SIMPLE_VALUE_TRUE);
} }
else if (is_x_boolean else if (is_x_number && is_y_string)
|| (is_x_number && is_y_string))
{ {
// 4., 6. // 4.
ECMA_TRY_CATCH (y_num_value, ECMA_TRY_CATCH (y_num_value,
ecma_op_to_number (y), ecma_op_to_number (y),
ret_value); ret_value);
@@ -138,10 +137,9 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
ECMA_FINALIZE (y_num_value); ECMA_FINALIZE (y_num_value);
} }
else if (is_y_boolean else if (is_x_string && is_y_number)
|| (is_x_string && is_y_number))
{ {
// 5., 7. // 5.
ECMA_TRY_CATCH (x_num_value, ECMA_TRY_CATCH (x_num_value,
ecma_op_to_number (x), ecma_op_to_number (x),
ret_value); ret_value);
@@ -151,6 +149,30 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
ECMA_FINALIZE (x_num_value); ECMA_FINALIZE (x_num_value);
} }
else if (is_x_boolean)
{
// 6.
ECMA_TRY_CATCH (x_num_value,
ecma_op_to_number (x),
ret_value);
ret_value = ecma_op_abstract_equality_compare (x_num_value.u.value,
y);
ECMA_FINALIZE (x_num_value);
}
else if (is_y_boolean)
{
// 7.
ECMA_TRY_CATCH (y_num_value,
ecma_op_to_number (y),
ret_value);
ret_value = ecma_op_abstract_equality_compare (x,
y_num_value.u.value);
ECMA_FINALIZE (y_num_value);
}
else if (is_y_object else if (is_y_object
&& (is_x_number || is_x_string)) && (is_x_number || is_x_string))
{ {