зеркало из https://github.com/github/ruby.git
Emit deprecatation warnings for rb_iterate()
* It is obsolete since 1.9, see https://github.com/ruby/ruby/blob/master/doc/extension.rdoc#label-Control+Structure and [Misc #18025]
This commit is contained in:
Родитель
301d194ee3
Коммит
fd0df9c4fb
|
@ -45,6 +45,7 @@ int rb_keyword_given_p(void);
|
|||
int rb_block_given_p(void);
|
||||
void rb_need_block(void);
|
||||
VALUE rb_iterate(VALUE(*)(VALUE),VALUE,rb_block_call_func_t,VALUE);
|
||||
DEPRECATED_BY(rb_block_call since 1.9, VALUE rb_iterate(VALUE(*)(VALUE),VALUE,rb_block_call_func_t,VALUE));
|
||||
VALUE rb_block_call(VALUE,ID,int,const VALUE*,rb_block_call_func_t,VALUE);
|
||||
VALUE rb_block_call_kw(VALUE,ID,int,const VALUE*,rb_block_call_func_t,VALUE,int);
|
||||
VALUE rb_rescue(VALUE(*)(VALUE),VALUE,VALUE(*)(VALUE,VALUE),VALUE);
|
||||
|
|
16
proc.c
16
proc.c
|
@ -3152,18 +3152,6 @@ method_inspect(VALUE method)
|
|||
return str;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
mproc(VALUE method)
|
||||
{
|
||||
return rb_funcallv(rb_mRubyVMFrozenCore, idProc, 0, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
mlambda(VALUE method)
|
||||
{
|
||||
return rb_funcallv(rb_mRubyVMFrozenCore, idLambda, 0, 0);
|
||||
}
|
||||
|
||||
static VALUE
|
||||
bmcall(RB_BLOCK_CALL_FUNC_ARGLIST(args, method))
|
||||
{
|
||||
|
@ -3175,7 +3163,7 @@ rb_proc_new(
|
|||
rb_block_call_func_t func,
|
||||
VALUE val)
|
||||
{
|
||||
VALUE procval = rb_iterate(mproc, 0, func, val);
|
||||
VALUE procval = rb_block_call(rb_mRubyVMFrozenCore, idProc, 0, 0, func, val);
|
||||
return procval;
|
||||
}
|
||||
|
||||
|
@ -3201,7 +3189,7 @@ method_to_proc(VALUE method)
|
|||
* end
|
||||
* end
|
||||
*/
|
||||
procval = rb_iterate(mlambda, 0, bmcall, method);
|
||||
procval = rb_block_call(rb_mRubyVMFrozenCore, idLambda, 0, 0, bmcall, method);
|
||||
GetProcPtr(procval, proc);
|
||||
proc->is_from_method = 1;
|
||||
return procval;
|
||||
|
|
17
vm_eval.c
17
vm_eval.c
|
@ -1557,15 +1557,22 @@ rb_iterate0(VALUE (* it_proc) (VALUE), VALUE data1,
|
|||
return retval;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_iterate(VALUE (* it_proc)(VALUE), VALUE data1,
|
||||
rb_block_call_func_t bl_proc, VALUE data2)
|
||||
static VALUE
|
||||
rb_iterate_internal(VALUE (* it_proc)(VALUE), VALUE data1,
|
||||
rb_block_call_func_t bl_proc, VALUE data2)
|
||||
{
|
||||
return rb_iterate0(it_proc, data1,
|
||||
bl_proc ? rb_vm_ifunc_proc_new(bl_proc, (void *)data2) : 0,
|
||||
GET_EC());
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_iterate(VALUE (* it_proc)(VALUE), VALUE data1,
|
||||
rb_block_call_func_t bl_proc, VALUE data2)
|
||||
{
|
||||
return rb_iterate_internal(it_proc, data1, bl_proc, data2);
|
||||
}
|
||||
|
||||
struct iter_method_arg {
|
||||
VALUE obj;
|
||||
ID mid;
|
||||
|
@ -1603,7 +1610,7 @@ rb_block_call_kw(VALUE obj, ID mid, int argc, const VALUE * argv,
|
|||
arg.argc = argc;
|
||||
arg.argv = argv;
|
||||
arg.kw_splat = kw_splat;
|
||||
return rb_iterate(iterate_method, (VALUE)&arg, bl_proc, data2);
|
||||
return rb_iterate_internal(iterate_method, (VALUE)&arg, bl_proc, data2);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
@ -1644,7 +1651,7 @@ rb_check_block_call(VALUE obj, ID mid, int argc, const VALUE *argv,
|
|||
arg.argc = argc;
|
||||
arg.argv = argv;
|
||||
arg.kw_splat = 0;
|
||||
return rb_iterate(iterate_check_method, (VALUE)&arg, bl_proc, data2);
|
||||
return rb_iterate_internal(iterate_check_method, (VALUE)&arg, bl_proc, data2);
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
|
Загрузка…
Ссылка в новой задаче