mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* include/ruby/intern.h: Restore rb_enumeratorize as it was before r37497
and introduce rb_enumeratorize_with_size instead. [#7302] * enumerator.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bc63449331
commit
a68cc24a9e
3 changed files with 22 additions and 5 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
Thu Nov 8 04:45:21 2012 Marc-Andre Lafortune <ruby-core@marc-andre.ca>
|
||||||
|
|
||||||
|
* include/ruby/intern.h: Restore rb_enumeratorize as it was before
|
||||||
|
r37497 and introduce rb_enumeratorize_with_size instead. [#7302]
|
||||||
|
|
||||||
|
* enumerator.c: ditto.
|
||||||
|
|
||||||
Wed Nov 7 15:22:37 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
Wed Nov 7 15:22:37 2012 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* numeric.c (ruby_float_step): fix r37514: it yielded with NaN
|
* numeric.c (ruby_float_step): fix r37514: it yielded with NaN
|
||||||
|
@ -16,7 +23,7 @@ Wed Nov 7 12:49:39 2012 Shugo Maeda <shugo@ruby-lang.org>
|
||||||
|
|
||||||
* eval.c (rb_mod_refine): set RMODULE_IS_REFINEMENT to a created
|
* eval.c (rb_mod_refine): set RMODULE_IS_REFINEMENT to a created
|
||||||
refinement module, and don't override method_added.
|
refinement module, and don't override method_added.
|
||||||
|
|
||||||
* vm_method.c (rb_method_entry_make): check redefinition of
|
* vm_method.c (rb_method_entry_make): check redefinition of
|
||||||
optimized methods when a method is added to a refinement module.
|
optimized methods when a method is added to a refinement module.
|
||||||
[ruby-core:48970] [Bug #7290]
|
[ruby-core:48970] [Bug #7290]
|
||||||
|
|
13
enumerator.c
13
enumerator.c
|
@ -224,7 +224,7 @@ obj_to_enum(int argc, VALUE *argv, VALUE obj)
|
||||||
--argc;
|
--argc;
|
||||||
meth = *argv++;
|
meth = *argv++;
|
||||||
}
|
}
|
||||||
enumerator = rb_enumeratorize(obj, meth, argc, argv, 0);
|
enumerator = rb_enumeratorize_with_size(obj, meth, argc, argv, 0);
|
||||||
if (rb_block_given_p()) {
|
if (rb_block_given_p()) {
|
||||||
enumerator_ptr(enumerator)->size = rb_block_proc();
|
enumerator_ptr(enumerator)->size = rb_block_proc();
|
||||||
}
|
}
|
||||||
|
@ -426,8 +426,17 @@ enumerator_init_copy(VALUE obj, VALUE orig)
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* For backwards compatibility; use rb_enumeratorize_with_size
|
||||||
|
*/
|
||||||
VALUE
|
VALUE
|
||||||
rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv, VALUE (*size_fn)(ANYARGS))
|
rb_enumeratorize(VALUE obj, VALUE meth, int argc, VALUE *argv)
|
||||||
|
{
|
||||||
|
return rb_enumeratorize_with_size(obj, meth, argc, argv, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
VALUE
|
||||||
|
rb_enumeratorize_with_size(VALUE obj, VALUE meth, int argc, VALUE *argv, VALUE (*size_fn)(ANYARGS))
|
||||||
{
|
{
|
||||||
return enumerator_init(enumerator_allocate(rb_cEnumerator), obj, meth, argc, argv, size_fn, Qnil);
|
return enumerator_init(enumerator_allocate(rb_cEnumerator), obj, meth, argc, argv, size_fn, Qnil);
|
||||||
}
|
}
|
||||||
|
|
|
@ -201,10 +201,11 @@ VALUE rb_fiber_alive_p(VALUE);
|
||||||
/* enum.c */
|
/* enum.c */
|
||||||
VALUE rb_enum_values_pack(int, VALUE*);
|
VALUE rb_enum_values_pack(int, VALUE*);
|
||||||
/* enumerator.c */
|
/* enumerator.c */
|
||||||
VALUE rb_enumeratorize(VALUE, VALUE, int, VALUE *, VALUE (*)(ANYARGS));
|
VALUE rb_enumeratorize(VALUE, VALUE, int, VALUE *);
|
||||||
|
VALUE rb_enumeratorize_with_size(VALUE, VALUE, int, VALUE *, VALUE (*)(ANYARGS));
|
||||||
#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) do { \
|
#define RETURN_SIZED_ENUMERATOR(obj, argc, argv, size_fn) do { \
|
||||||
if (!rb_block_given_p()) \
|
if (!rb_block_given_p()) \
|
||||||
return rb_enumeratorize((obj), ID2SYM(rb_frame_this_func()),\
|
return rb_enumeratorize_with_size((obj), ID2SYM(rb_frame_this_func()),\
|
||||||
(argc), (argv), (size_fn)); \
|
(argc), (argv), (size_fn)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define RETURN_ENUMERATOR(obj, argc, argv) RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)
|
#define RETURN_ENUMERATOR(obj, argc, argv) RETURN_SIZED_ENUMERATOR(obj, argc, argv, 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue