@@ -1862,10 +1862,11 @@ ecma_builtin_array_prototype_object_index_of (ecma_value_t this_arg, /**< this a
18621862 */
18631863static ecma_completion_value_t
18641864ecma_builtin_array_prototype_object_last_index_of (ecma_value_t this_arg, /* *< this argument */
1865- ecma_value_t arg1 , /* *< searchElement */
1866- ecma_value_t arg2 ) /* *< fromIndex */
1865+ const ecma_value_t args[] , /* *< arguments list */
1866+ ecma_length_t args_number ) /* *< number of arguments */
18671867{
18681868 ecma_completion_value_t ret_value = ecma_make_empty_completion_value ();
1869+ ecma_value_t search_element = (args_number > 0 ) ? args[0 ] : ecma_make_simple_value (ECMA_SIMPLE_VALUE_UNDEFINED);
18691870
18701871 /* 1. */
18711872 ECMA_TRY_CATCH (obj_this,
@@ -1898,9 +1899,9 @@ ecma_builtin_array_prototype_object_last_index_of (ecma_value_t this_arg, /**< t
18981899 uint32_t from_idx = len - 1 ;
18991900
19001901 /* 5. */
1901- if (! ecma_is_value_undefined (arg2) )
1902+ if (args_number > 1 )
19021903 {
1903- ECMA_OP_TO_NUMBER_TRY_CATCH (arg_from_idx, arg2 , ret_value);
1904+ ECMA_OP_TO_NUMBER_TRY_CATCH (arg_from_idx, args[ 1 ] , ret_value);
19041905
19051906 if (!ecma_number_is_nan (arg_from_idx))
19061907 {
@@ -1972,7 +1973,7 @@ ecma_builtin_array_prototype_object_last_index_of (ecma_value_t this_arg, /**< t
19721973 ECMA_TRY_CATCH (get_value, ecma_op_object_get (obj_p, idx_str_p), ret_value);
19731974
19741975 /* 8.b.ii */
1975- if (ecma_op_strict_equality_compare (arg1 , get_value))
1976+ if (ecma_op_strict_equality_compare (search_element , get_value))
19761977 {
19771978 *num_p = ecma_uint32_to_number (from_idx);
19781979 }
0 commit comments