-
Notifications
You must be signed in to change notification settings - Fork 677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement String.prototype.lastIndexOf() #483
Implement String.prototype.lastIndexOf() #483
Conversation
The helper function is prepared to handle indexOf() as well, it will be adjusted in a separate step. |
{ | ||
/* match as long as possible */ | ||
ecma_length_t match_len = 0; | ||
lit_utf8_iterator_pos_t stored_original_pos = lit_utf8_iterator_get_pos (&original_it); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we save the iterator itself? Seeking is not a cheap operation.
790d120
to
7f758fe
Compare
extern ecma_completion_value_t ecma_builtin_helper_string_prototype_object_index_of (ecma_value_t this_arg, | ||
ecma_value_t arg1, | ||
ecma_value_t arg2, | ||
bool firstIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect indentation
7f758fe
to
a1e0185
Compare
@galpeter, thanks for the comments, the patch is rebased and updated. |
if (match_len == search_len) | ||
{ | ||
*ret_num_p = ecma_uint32_to_number (index); | ||
found = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the found
at all? Can't we just break out?
JerryScript-DCO-1.0-Signed-off-by: Laszlo Vidacs [email protected]
a1e0185
to
11a6a50
Compare
lgtm |
looks good, but please open an issue that where the followup work is described |
Issue #515 is opened for follow-up work. |
|
Landed in 554305d |
JerryScript-DCO-1.0-Signed-off-by: Laszlo Vidacs [email protected]