Fix processing of elision in array literal.
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov a.shitov@samsung.com
This commit is contained in:
@@ -82,6 +82,7 @@ typedef enum
|
||||
ECMA_SIMPLE_VALUE_ARRAY_REDIRECT, /**< implementation defined value for an array's elements that exist,
|
||||
but are stored directly in the array's property list
|
||||
(used for array elements with non-default attribute values) */
|
||||
ECMA_SIMPLE_VALUE_ARRAY_HOLE, /**< array hole, used for initialization of an array literal */
|
||||
ECMA_SIMPLE_VALUE__COUNT /** count of simple ecma-values */
|
||||
} ecma_simple_value_t;
|
||||
|
||||
|
||||
@@ -155,6 +155,19 @@ ecma_is_value_true (ecma_value_t value) /**< ecma-value */
|
||||
&& ecma_get_value_value_field (value) == ECMA_SIMPLE_VALUE_TRUE);
|
||||
} /* ecma_is_value_true */
|
||||
|
||||
/**
|
||||
* Check if the value is array hole.
|
||||
*
|
||||
* @return true - if the value contains ecma-array-hole simple value,
|
||||
* false - otherwise.
|
||||
*/
|
||||
bool __attr_pure___ __attr_always_inline___
|
||||
ecma_is_value_array_hole (ecma_value_t value) /**< ecma-value */
|
||||
{
|
||||
return (ecma_get_value_type_field (value) == ECMA_TYPE_SIMPLE
|
||||
&& ecma_get_value_value_field (value) == ECMA_SIMPLE_VALUE_ARRAY_HOLE);
|
||||
} /* ecma_is_value_array_hole */
|
||||
|
||||
/**
|
||||
* Check if the value is ecma-number.
|
||||
*
|
||||
|
||||
@@ -58,6 +58,7 @@ extern bool ecma_is_value_undefined (ecma_value_t value);
|
||||
extern bool ecma_is_value_null (ecma_value_t value);
|
||||
extern bool ecma_is_value_boolean (ecma_value_t value);
|
||||
extern bool ecma_is_value_true (ecma_value_t value);
|
||||
extern bool ecma_is_value_array_hole (ecma_value_t value);
|
||||
|
||||
extern bool ecma_is_value_number (ecma_value_t value);
|
||||
extern bool ecma_is_value_string (ecma_value_t value);
|
||||
|
||||
@@ -131,6 +131,11 @@ ecma_op_create_array_object (const ecma_value_t *arguments_list_p, /**< list of
|
||||
index < array_items_count;
|
||||
index++)
|
||||
{
|
||||
if (ecma_is_value_array_hole (array_items_p[index]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
ecma_string_t* item_name_string_p = ecma_new_ecma_string_from_uint32 (index);
|
||||
|
||||
ecma_property_descriptor_t item_prop_desc = ecma_make_empty_property_descriptor ();
|
||||
|
||||
Reference in New Issue
Block a user