-
Notifications
You must be signed in to change notification settings - Fork 683
Fix Array.prototype.concat() when 'this' is not an array. #415
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
Fix Array.prototype.concat() when 'this' is not an array. #415
Conversation
@@ -113,24 +113,40 @@ ecma_builtin_array_prototype_object_concat (ecma_value_t this_arg, /**< this arg | |||
ecma_completion_value_t new_array = ecma_op_create_array_object (0, 0, false); | |||
ecma_object_t *new_array_p = ecma_get_object_from_completion_value (new_array); | |||
|
|||
if (ecma_object_get_class_name (obj_p) == LIT_MAGIC_STRING_ARRAY_UL) |
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.
@dbatyai, could you, please, add comments with steps from specification that correspond to the operations?
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.
@ruben-ayrapetyan, added.
c8d2fdb
to
756494b
Compare
get_value, | ||
false); | ||
JERRY_ASSERT (ecma_is_completion_value_normal (put_comp)); | ||
ecma_free_completion_value (put_comp); |
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.
As is_throw
argument of ecma_op_object_put
is false
, exceptions can't be thrown and only possible return values in the case are "simple true" or "simple false".
So, we can replace this with corresponding assertion and remove ecma_free_completion_value
call.
f0500cb
to
a407d31
Compare
@ruben-ayrapetyan, I've updated the patch. |
*/ | ||
ecma_completion_value_t | ||
ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, /**< array */ | ||
uint32_t *length, /**< in-out: array's length */ |
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.
Please, add _p
suffix.
@dbatyai, thank you for update. |
After fixing #415 (comment) the changes would look good to me |
a407d31
to
8d7789f
Compare
Looks good to me |
looks good to me |
8d7789f
to
046833c
Compare
Could you please rebase it to master - I'm getting conflicts at merging. |
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai.u-szeged@partner.samsung.com
046833c
to
9513808
Compare
@egavrin, rebased to master. |
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai.u-szeged@partner.samsung.com