diff options
author | Jeremy Evans <[email protected]> | 2021-03-05 12:25:51 -0800 |
---|---|---|
committer | Jeremy Evans <[email protected]> | 2021-03-06 13:56:16 -0800 |
commit | e1d16a9e560a615e122e457325bcfb7c47228ed6 () | |
tree | 1e93b0256e763f3eedcea7a03309bd12f5007005 /enumerator.c | |
parent | bf40fe9fed19a5e22081b133661c0629988f1618 (diff) |
Make Enumerator#{+,chain} create lazy chain if any included enumerator is lazy
Implements [Feature #17347]
Notes: Merged: https://.com/ruby/ruby/pull/3811
-rw-r--r-- | enumerator.c | 21 |
1 files changed, 16 insertions, 5 deletions
@@ -3137,6 +3137,20 @@ enum_chain_initialize(VALUE obj, VALUE enums) return obj; } /* :nodoc: */ static VALUE enum_chain_init_copy(VALUE obj, VALUE orig) @@ -3306,8 +3320,7 @@ enum_chain(int argc, VALUE *argv, VALUE obj) { VALUE enums = rb_ary_new_from_values(1, &obj); rb_ary_cat(enums, argv, argc); - - return enum_chain_initialize(enum_chain_allocate(rb_cEnumChain), enums); } /* @@ -3323,9 +3336,7 @@ enum_chain(int argc, VALUE *argv, VALUE obj) static VALUE enumerator_plus(VALUE obj, VALUE eobj) { - VALUE enums = rb_ary_new_from_args(2, obj, eobj); - - return enum_chain_initialize(enum_chain_allocate(rb_cEnumChain), enums); } /* |