Remove shadowed declarations, undefined identifiers, and specify argument types where it is required. (#1601)

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
Robert Sipka
2017-02-22 10:34:44 +01:00
committed by GitHub
parent 5ef305dfee
commit 39dc4a6273
26 changed files with 75 additions and 82 deletions
@@ -783,10 +783,10 @@ ecma_builtin_array_prototype_object_shift (ecma_value_t this_arg) /**< this argu
if (ecma_is_value_empty (ret_value))
{
len--;
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (len);
ecma_string_t *len_str_p = ecma_new_ecma_string_from_uint32 (len);
/* 8. */
ECMA_TRY_CATCH (del_value, ecma_op_object_delete (obj_p, index_str_p, true), ret_value);
ECMA_TRY_CATCH (del_value, ecma_op_object_delete (obj_p, len_str_p, true), ret_value);
/* 9. */
ECMA_TRY_CATCH (set_length_value,
@@ -797,7 +797,7 @@ ecma_builtin_array_prototype_object_shift (ecma_value_t this_arg) /**< this argu
ECMA_FINALIZE (set_length_value);
ECMA_FINALIZE (del_value);
ecma_deref_ecma_string (index_str_p);
ecma_deref_ecma_string (len_str_p);
}
ECMA_FINALIZE (first_value);
@@ -1426,11 +1426,9 @@ ecma_builtin_array_prototype_object_splice (ecma_value_t this_arg, /**< this arg
}
/* 8-9. */
uint32_t k;
uint32_t k = 0;
for (uint32_t del_item_idx, k = 0;
k < delete_count && ecma_is_value_empty (ret_value);
k++)
for (uint32_t del_item_idx; k < delete_count && ecma_is_value_empty (ret_value); k++)
{
/* 9.a */
del_item_idx = k + start;
@@ -319,11 +319,11 @@ ecma_builtin_date_parse (ecma_value_t this_arg, /**< this argument */
else if (date_str_curr_p < date_str_end_p
&& (*date_str_curr_p == '+' || *date_str_curr_p == '-'))
{
ecma_length_t remaining_length;
remaining_length = lit_utf8_string_length (date_str_curr_p,
(lit_utf8_size_t) (date_str_end_p - date_str_curr_p)) - 1;
ecma_length_t remaining_date_length;
remaining_date_length = lit_utf8_string_length (date_str_curr_p,
(lit_utf8_size_t) (date_str_end_p - date_str_curr_p)) - 1;
if (remaining_length == 5)
if (remaining_date_length == 5)
{
bool is_negative = false;
@@ -934,11 +934,10 @@ ecma_builtin_json_stringify (ecma_value_t this_arg, /**< 'this' argument */
array_length,
ret_value);
uint32_t array_length = ecma_number_to_uint32 (array_length_num);
uint32_t index = 0;
/* 4.b.ii */
while ((index < array_length) && ecma_is_value_empty (ret_value))
while ((index < ecma_number_to_uint32 (array_length_num)) && ecma_is_value_empty (ret_value))
{
ecma_string_t *index_str_p = ecma_new_ecma_string_from_uint32 (index);
@@ -1060,23 +1059,24 @@ ecma_builtin_json_stringify (ecma_value_t this_arg, /**< 'this' argument */
/* 6.a */
int32_t num_of_spaces = ecma_number_to_int32 (array_length_num);
int32_t space = (num_of_spaces > 10) ? 10 : num_of_spaces;
num_of_spaces = (num_of_spaces > 10) ? 10 : num_of_spaces;
/* 6.b */
if (space < 1)
if (num_of_spaces < 1)
{
context.gap_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
}
else
{
JMEM_DEFINE_LOCAL_ARRAY (space_buff, space, char);
JMEM_DEFINE_LOCAL_ARRAY (space_buff, num_of_spaces, char);
for (int32_t i = 0; i < space; i++)
for (int32_t i = 0; i < num_of_spaces; i++)
{
space_buff[i] = LIT_CHAR_SP;
}
context.gap_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff, (lit_utf8_size_t) space);
context.gap_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff,
(lit_utf8_size_t) num_of_spaces);
JMEM_FINALIZE_LOCAL_ARRAY (space_buff);
}
@@ -1738,11 +1738,9 @@ ecma_builtin_json_array (ecma_object_t *obj_p, /**< the array object*/
array_length,
ret_value);
uint32_t array_length = ecma_number_to_uint32 (array_length_num);
/* 7. - 8. */
for (uint32_t index = 0;
index < array_length && ecma_is_value_empty (ret_value);
index < ecma_number_to_uint32 (array_length_num) && ecma_is_value_empty (ret_value);
index++)
{
@@ -998,7 +998,6 @@ ecma_builtin_string_prototype_object_replace_get_string (ecma_builtin_replace_se
}
ecma_string_t *index_string_p = ecma_new_ecma_string_from_uint32 (index);
ecma_object_t *match_object_p = ecma_get_object_from_value (match_value);
ECMA_TRY_CATCH (submatch_value,
ecma_op_object_get (match_object_p, index_string_p),
@@ -1863,18 +1862,18 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_arg, /**< this arg
ecma_string_t *idx_str_p = ecma_new_ecma_string_from_uint32 (i);
ecma_string_t *new_array_idx_str_p = ecma_new_ecma_string_from_uint32 (new_array_length);
ecma_value_t match_comp_value = ecma_op_object_get (match_array_obj_p, idx_str_p);
match_comp_value = ecma_op_object_get (match_array_obj_p, idx_str_p);
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (match_comp_value));
/* 13.c.iii.7.b */
ecma_value_t put_comp = ecma_builtin_helper_def_prop (new_array_p,
new_array_idx_str_p,
match_comp_value,
true,
true,
true,
false);
put_comp = ecma_builtin_helper_def_prop (new_array_p,
new_array_idx_str_p,
match_comp_value,
true,
true,
true,
false);
JERRY_ASSERT (ecma_is_value_true (put_comp));