Skip to content

Commit ed08518

Browse files
committed
Code simplification
Move the enclosed condition forward and combine the two if statements. JerryScript-DCO-1.0-Signed-off-by: László Langó llango.u-szeged@partner.samsung.com
1 parent ed2a360 commit ed08518

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

jerry-core/ecma/operations/ecma-array-object.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -418,16 +418,14 @@ ecma_op_array_object_define_own_property (ecma_object_t *obj_p, /**< the array o
418418
}
419419

420420
// e.
421-
if (index >= old_len_uint32)
421+
if (index < UINT32_MAX
422+
&& index >= old_len_uint32)
422423
{
423424
ecma_property_value_t *len_prop_value_p = ECMA_PROPERTY_VALUE_PTR (len_prop_p);
424425

425426
// i., ii.
426-
if (index < UINT32_MAX)
427-
{
428-
/* Setting the length property is always successful. */
429-
ecma_value_assign_uint32 (&len_prop_value_p->value, index + 1);
430-
}
427+
/* Setting the length property is always successful. */
428+
ecma_value_assign_uint32 (&len_prop_value_p->value, index + 1);
431429
}
432430

433431
// f.

0 commit comments

Comments
 (0)