Implement ToPropertyKey operation (#3966)

From ES 6 the ToPropertyKey operation is used to convert elements to a valid property key.
This "new" method uses the ToPrimitive operation which can call the `@@ToPrimitive`
well-known symbol to convert the given element to a key.

JerryScript-DCO-1.0-Signed-off-by: Peter Gal pgal.usz@partner.samsung.com
This commit is contained in:
Péter Gál
2020-07-06 15:17:18 +02:00
committed by GitHub
parent ed9e3eccf9
commit ae5cfae3e7
10 changed files with 174 additions and 30 deletions
+3 -3
View File
@@ -262,7 +262,7 @@ vm_op_delete_prop (ecma_value_t object, /**< base object */
}
JERRY_ASSERT (check_coercible == ECMA_VALUE_EMPTY);
ecma_string_t *name_string_p = ecma_op_to_prop_name (property);
ecma_string_t *name_string_p = ecma_op_to_property_key (property);
if (JERRY_UNLIKELY (name_string_p == NULL))
{
@@ -1398,7 +1398,7 @@ opfunc_form_super_reference (ecma_value_t **vm_stack_top_p, /**< current vm stac
}
ecma_object_t *parent_p = ecma_get_object_from_value (parent);
ecma_string_t *prop_name_p = ecma_op_to_prop_name (prop_name);
ecma_string_t *prop_name_p = ecma_op_to_property_key (prop_name);
if (prop_name_p == NULL)
{
@@ -1448,7 +1448,7 @@ opfunc_assign_super_reference (ecma_value_t **vm_stack_top_p, /**< vm stack top
}
ecma_object_t *base_obj_p = ecma_get_object_from_value (base_obj);
ecma_string_t *prop_name_p = ecma_op_to_prop_name (stack_top_p[-2]);
ecma_string_t *prop_name_p = ecma_op_to_property_key (stack_top_p[-2]);
if (prop_name_p == NULL)
{