summaryrefslogtreecommitdiff
path: root/enum.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-18 08:31:02 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-07-18 08:31:02 (GMT)
commit1f67a3900fbd45482ed36ad3b148b321307c1576 (patch)
tree7d61b1b855149f8a357603065e85761cb7d43202 /enum.c
parent8ffb23c2e1f2f292c8ed85b51ffb85f4811e5a9e (diff)
vm_eval.c: rb_lambda_call
* enum.c (enum_collect): make the block arity same as the given block. [Bug #13391] * internal.h (vm_ifunc): store arity instead of unused id. * proc.c (rb_vm_block_min_max_arity): return ifunc arity. * vm_eval.c (rb_lambda_call): call method with lambda block. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59358 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'enum.c')
-rw-r--r--enum.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/enum.c b/enum.c
index c744665..d9b9943 100644
--- a/enum.c
+++ b/enum.c
@@ -494,11 +494,13 @@ static VALUE
enum_collect(VALUE obj)
{
VALUE ary;
+ int min_argc, max_argc;
RETURN_SIZED_ENUMERATOR(obj, 0, 0, enum_size);
ary = rb_ary_new();
- rb_block_call(obj, id_each, 0, 0, collect_i, ary);
+ min_argc = rb_block_min_max_arity(&max_argc);
+ rb_lambda_call(obj, id_each, 0, 0, collect_i, min_argc, max_argc, ary);
return ary;
}