summaryrefslogtreecommitdiffhomepage
path: root/src/array.c
diff options
context:
space:
mode:
authorYusuke Endoh <[email protected]>2020-05-24 01:25:03 +0900
committerYusuke Endoh <[email protected]>2020-05-24 01:25:03 +0900
commit6f4c585bd73fc43fb9e34a70d74b5a50852600ea (patch)
tree588252a0fdbd163af58a85b85b43804fd17a1935 /src/array.c
parent47ea60814b61d6f52a71b4799b4143f59191ff82 (diff)
downloadmruby-6f4c585bd73fc43fb9e34a70d74b5a50852600ea.tar.gz
mruby-6f4c585bd73fc43fb9e34a70d74b5a50852600ea.zip
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]`.
Diffstat (limited to 'src/array.c')
-rw-r--r--src/array.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/array.c b/src/array.c
index 6e73bcd8e..ad0d5b8db 100644
--- a/src/array.c
+++ b/src/array.c
@@ -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)
{