Fix evaluation order for binary operators (#4114)

Furthermore fix toBoolean for BigInts as well.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2020-08-07 14:32:46 +02:00
committed by GitHub
parent cb14682983
commit f4f9cde3e7
22 changed files with 211 additions and 180 deletions
+10 -1
View File
@@ -37,6 +37,15 @@ typedef enum
ECMA_PREFERRED_TYPE_STRING /**< String */
} ecma_preferred_type_hint_t;
/**
* Option bits for ecma_op_to_numeric.
*/
typedef enum
{
ECMA_TO_NUMERIC_NO_OPTS = 0, /**< no options (same as toNumber operation) */
ECMA_TO_NUMERIC_ALLOW_BIGINT = (1 << 0), /**< allow BigInt values */
} ecma_to_numeric_options_t;
ecma_value_t ecma_op_check_object_coercible (ecma_value_t value);
bool ecma_op_same_value (ecma_value_t x, ecma_value_t y);
#if ENABLED (JERRY_BUILTIN_MAP)
@@ -45,7 +54,7 @@ bool ecma_op_same_value_zero (ecma_value_t x, ecma_value_t y);
ecma_value_t ecma_op_to_primitive (ecma_value_t value, ecma_preferred_type_hint_t preferred_type);
bool ecma_op_to_boolean (ecma_value_t value);
ecma_value_t ecma_op_to_number (ecma_value_t value);
ecma_value_t ecma_get_number (ecma_value_t value, ecma_number_t *number_p);
ecma_value_t ecma_op_to_numeric (ecma_value_t value, ecma_number_t *number_p, ecma_to_numeric_options_t options);
ecma_string_t *ecma_op_to_string (ecma_value_t value);
ecma_string_t *ecma_op_to_property_key (ecma_value_t value);
ecma_value_t ecma_op_to_object (ecma_value_t value);