diff options
Diffstat (limited to 'enumerator.c')
-rw-r--r-- | enumerator.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/enumerator.c b/enumerator.c index 9223979445..081f93babc 100644 --- a/enumerator.c +++ b/enumerator.c @@ -1625,7 +1625,8 @@ lazy_take_func(VALUE val, VALUE args, int argc, VALUE *argv) } static VALUE -lazy_take_size(VALUE lazy) { +lazy_take_size(VALUE lazy) +{ long len = NUM2LONG(RARRAY_PTR(rb_ivar_get(lazy, id_arguments))[0]); VALUE receiver = lazy_receiver_size(lazy); if (NIL_P(receiver) || (FIXNUM_P(receiver) && FIX2LONG(receiver) < len)) @@ -1674,7 +1675,8 @@ lazy_take_while(VALUE obj) } static VALUE -lazy_drop_size(VALUE lazy) { +lazy_drop_size(VALUE lazy) +{ long len = NUM2LONG(RARRAY_PTR(rb_ivar_get(lazy, id_arguments))[0]); VALUE receiver = lazy_receiver_size(lazy); if (NIL_P(receiver)) @@ -1741,7 +1743,8 @@ lazy_drop_while(VALUE obj) } static VALUE -lazy_cycle_size(VALUE lazy) { +lazy_cycle_size(VALUE lazy) +{ return enum_cycle_size(rb_ivar_get(lazy, id_receiver), rb_ivar_get(lazy, id_arguments)); } |