Skip to content

Commit

Permalink
Should not check/call to_str for immediate objects; ref #3515
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Mar 19, 2017
1 parent 527dcd5 commit 0957492
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -1048,15 +1048,17 @@ join_ary(mrb_state *mrb, mrb_value ary, mrb_value sep, mrb_value list)
break;

default:
tmp = mrb_check_string_type(mrb, val);
if (!mrb_nil_p(tmp)) {
val = tmp;
goto str_join;
}
tmp = mrb_check_convert_type(mrb, val, MRB_TT_ARRAY, "Array", "to_ary");
if (!mrb_nil_p(tmp)) {
val = tmp;
goto ary_join;
if (!mrb_immediate_p(val)) {
tmp = mrb_check_string_type(mrb, val);
if (!mrb_nil_p(tmp)) {
val = tmp;
goto str_join;
}
tmp = mrb_check_convert_type(mrb, val, MRB_TT_ARRAY, "Array", "to_ary");
if (!mrb_nil_p(tmp)) {
val = tmp;
goto ary_join;
}
}
val = mrb_obj_as_string(mrb, val);
goto str_join;
Expand Down

0 comments on commit 0957492

Please sign in to comment.