Add delete_property_by_index to the API

JerryScript-DCO-1.0-Signed-off-by: Marko Fabo mfabo@inf.u-szeged.hu
This commit is contained in:
Marko Fabo
2017-07-21 10:25:24 +02:00
committed by yichoi
parent 1526bcc8c3
commit af2868ddb7
4 changed files with 82 additions and 0 deletions
+25
View File
@@ -1474,6 +1474,31 @@ jerry_delete_property (const jerry_value_t obj_val, /**< object value */
return ecma_is_value_true (ret_value);
} /* jerry_delete_property */
/**
* Delete indexed property from the specified object.
*
* @return true - if property was deleted successfully
* false - otherwise
*/
bool
jerry_delete_property_by_index (const jerry_value_t obj_val, /**< object value */
uint32_t index) /**< index to be written */
{
jerry_assert_api_available ();
if (!ecma_is_value_object (obj_val))
{
return false;
}
ecma_string_t str_idx;
ecma_init_ecma_string_from_uint32 (&str_idx, index);
ecma_value_t ret_value = ecma_op_object_delete (ecma_get_object_from_value (obj_val),
&str_idx,
false);
return ecma_is_value_true (ret_value);
} /* jerry_delete_property_by_index */
/**
* Get value of a property to the specified object with the given name.
*