@@ -113,24 +113,47 @@ ecma_builtin_array_prototype_object_concat (ecma_value_t this_arg, /**< this arg
113113 ecma_completion_value_t new_array = ecma_op_create_array_object (0 , 0 , false );
114114 ecma_object_t *new_array_p = ecma_get_object_from_completion_value (new_array);
115115
116+ /* 5.b */
117+ if (ecma_object_get_class_name (obj_p) == LIT_MAGIC_STRING_ARRAY_UL)
118+ {
119+ /* 5.b.iii */
120+ for (uint32_t index = 0 ;
121+ index < len && ecma_is_completion_value_empty (ret_value);
122+ index++, new_array_index++)
123+ {
124+ ecma_string_t *index_string_p = ecma_new_ecma_string_from_uint32 (index);
125+ /* 5.b.iii.3.a */
126+ ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, index_string_p), ret_value);
116127
117- for (uint32_t index = 0 ;
118- index < len && ecma_is_completion_value_empty (ret_value);
119- index++, new_array_index++)
128+ /* Using [[Put]] is equvalent to [[DefineOwnProperty]] in this case, so we use it for simplicity. */
129+ ecma_completion_value_t put_comp = ecma_op_object_put (new_array_p,
130+ index_string_p,
131+ get_value,
132+ false );
133+ JERRY_ASSERT (ecma_is_completion_value_normal (put_comp));
134+ ecma_free_completion_value (put_comp);
135+
136+ ECMA_FINALIZE (get_value);
137+ ecma_deref_ecma_string (index_string_p);
138+ }
139+ }
140+ /* 5.c */
141+ else
120142 {
121- ecma_string_t *index_string_p = ecma_new_ecma_string_from_uint32 (index);
122- ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, index_string_p), ret_value);
143+ ecma_string_t *new_array_index_string_p = ecma_new_ecma_string_from_uint32 (new_array_index);
123144
124- /* Using [[Put]] is equvalent to [[DefineOwnProperty]] in this case, so we use it for simplicity. */
145+ /* 5.c.i */
125146 ecma_completion_value_t put_comp = ecma_op_object_put (new_array_p,
126- index_string_p ,
127- get_value ,
147+ new_array_index_string_p ,
148+ this_arg ,
128149 false );
129- JERRY_ASSERT (ecma_is_completion_value_normal (put_comp));
150+ JERRY_ASSERT (ecma_is_completion_value_normal_true (put_comp));
130151 ecma_free_completion_value (put_comp);
131152
132- ECMA_FINALIZE (get_value);
133- ecma_deref_ecma_string (index_string_p);
153+ ecma_deref_ecma_string (new_array_index_string_p);
154+
155+ /* 5.c.ii */
156+ new_array_index++;
134157 }
135158
136159 for (uint32_t arg_index = 0 ;
0 commit comments