diff options
author | Jeremy Evans <code@jeremyevans.net> | 2019-08-28 16:41:39 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2019-12-03 23:18:28 +0200 |
commit | a029b54ec716812ade37fef1f857c49f821a8cc8 (patch) | |
tree | d754e3d18feed2eb2d6a8f620fdf996caf786c90 /enumerator.c | |
parent | 47c97e1e843159c3c4d57f8c5e22daea57c3ffe1 (diff) |
Make Enumerator::Chain#each treat lambdas as lambda
Previously, lambdas were converted to procs because of how
rb_block_call works. Switch to rb_funcall_with_block, which
handles procs as procs and lambdas as lambdas.
Fixes [Bug #15613]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2720
Diffstat (limited to 'enumerator.c')
-rw-r--r-- | enumerator.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/enumerator.c b/enumerator.c index a5d7106b60..67b9302a62 100644 --- a/enumerator.c +++ b/enumerator.c @@ -3112,12 +3112,6 @@ enum_chain_enum_size(VALUE obj, VALUE args, VALUE eobj) } static VALUE -enum_chain_yield_block(RB_BLOCK_CALL_FUNC_ARGLIST(_, block)) -{ - return rb_funcallv(block, id_call, argc, argv); -} - -static VALUE enum_chain_enum_no_size(VALUE obj, VALUE args, VALUE eobj) { return Qnil; @@ -3148,10 +3142,9 @@ enum_chain_each(int argc, VALUE *argv, VALUE obj) enums = objptr->enums; block = rb_block_proc(); - for (i = 0; i < RARRAY_LEN(enums); i++) { objptr->pos = i; - rb_block_call(RARRAY_AREF(enums, i), id_each, argc, argv, enum_chain_yield_block, block); + rb_funcall_with_block(RARRAY_AREF(enums, i), id_each, argc, argv, block); } return obj; |