Implement Proxy object [[OwnPropertyKeys]] internal method (#3639)

The algorithm is based on ECMA-262 v6, 9.5.12

JerryScript-DCO-1.0-Signed-off-by: Adam Szilagyi aszilagy@inf.u-szeged.hu
This commit is contained in:
Szilagyi Adam
2020-04-14 16:57:47 +02:00
committed by GitHub
parent 60db840cf4
commit 4342c9ea6f
7 changed files with 413 additions and 19 deletions
+12 -1
View File
@@ -977,7 +977,9 @@ ecma_op_to_length (ecma_value_t value, /**< ecma value */
* NULL otherwise
*/
ecma_collection_t *
ecma_op_create_list_from_array_like (ecma_value_t arr) /**< array value */
ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */
bool prop_names_only) /**< true - accept only property names
false - otherwise */
{
/* 1. */
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (arr));
@@ -1010,6 +1012,15 @@ ecma_op_create_list_from_array_like (ecma_value_t arr) /**< array value */
return NULL;
}
if (prop_names_only
&& !ecma_is_value_prop_name (next))
{
ecma_free_value (next);
ecma_collection_free (list_ptr);
ecma_raise_type_error (ECMA_ERR_MSG ("Property name is neither Symbol nor String."));
return NULL;
}
ecma_collection_push_back (list_ptr, next);
}