Do not destruct rest arguments for __send__

Formerly, `__send__(*args)` modified `args` with `Array#shift`.
This bug affects optcarrot.

This changeset avoids the array destruction by using
`args = args[1, len-1]`.
This commit is contained in:
Yusuke Endoh
2020-05-24 01:25:03 +09:00
parent 47ea60814b
commit 6f4c585bd7
4 changed files with 15 additions and 1 deletions
+7
View File
@@ -808,6 +808,13 @@ ary_subseq(mrb_state *mrb, struct RArray *a, mrb_int beg, mrb_int len)
return mrb_obj_value(b);
}
mrb_value
mrb_ary_subseq(mrb_state *mrb, mrb_value ary, mrb_int beg, mrb_int len)
{
struct RArray *a = mrb_ary_ptr(ary);
return ary_subseq(mrb, a, beg, len);
}
static mrb_int
aget_index(mrb_state *mrb, mrb_value index)
{