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
@@ -1213,7 +1213,7 @@ ecma_builtin_object_dispatch_routine (uint16_t builtin_routine_id, /**< built-in
if (builtin_routine_id == ECMA_OBJECT_ROUTINE_DEFINE_PROPERTY)
{
ecma_string_t *prop_name_p = ecma_op_to_prop_name (arg2);
ecma_string_t *prop_name_p = ecma_op_to_property_key (arg2);
if (prop_name_p == NULL)
{
@@ -1275,7 +1275,7 @@ ecma_builtin_object_dispatch_routine (uint16_t builtin_routine_id, /**< built-in
}
case ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_DESCRIPTOR:
{
ecma_string_t *prop_name_p = ecma_op_to_prop_name (arg2);
ecma_string_t *prop_name_p = ecma_op_to_property_key (arg2);
if (prop_name_p == NULL)
{