proc.c: passed_block
* proc.c (passed_block): extract conversion from passed proc value to rb_block_t pointer. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54909 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c8932036d2
commit
759773bf0e
27
proc.c
27
proc.c
@ -805,6 +805,17 @@ check_argc(long argc)
|
|||||||
#define check_argc(argc) (argc)
|
#define check_argc(argc) (argc)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static rb_block_t *
|
||||||
|
passed_block(VALUE pass_procval)
|
||||||
|
{
|
||||||
|
if (!NIL_P(pass_procval)) {
|
||||||
|
rb_proc_t *pass_proc;
|
||||||
|
GetProcPtr(pass_procval, pass_proc);
|
||||||
|
return &pass_proc->block;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_proc_call(VALUE self, VALUE args)
|
rb_proc_call(VALUE self, VALUE args)
|
||||||
{
|
{
|
||||||
@ -825,12 +836,7 @@ rb_proc_call_with_block(VALUE self, int argc, const VALUE *argv, VALUE pass_proc
|
|||||||
rb_block_t *block = 0;
|
rb_block_t *block = 0;
|
||||||
GetProcPtr(self, proc);
|
GetProcPtr(self, proc);
|
||||||
|
|
||||||
if (!NIL_P(pass_procval)) {
|
block = passed_block(pass_procval);
|
||||||
rb_proc_t *pass_proc;
|
|
||||||
GetProcPtr(pass_procval, pass_proc);
|
|
||||||
block = &pass_proc->block;
|
|
||||||
}
|
|
||||||
|
|
||||||
vret = rb_vm_invoke_proc(GET_THREAD(), proc, argc, argv, block);
|
vret = rb_vm_invoke_proc(GET_THREAD(), proc, argc, argv, block);
|
||||||
RB_GC_GUARD(self);
|
RB_GC_GUARD(self);
|
||||||
RB_GC_GUARD(pass_procval);
|
RB_GC_GUARD(pass_procval);
|
||||||
@ -1977,15 +1983,8 @@ rb_method_call_with_block(int argc, const VALUE *argv, VALUE method, VALUE pass_
|
|||||||
}
|
}
|
||||||
if ((state = EXEC_TAG()) == 0) {
|
if ((state = EXEC_TAG()) == 0) {
|
||||||
rb_thread_t *th = GET_THREAD();
|
rb_thread_t *th = GET_THREAD();
|
||||||
rb_block_t *block = 0;
|
|
||||||
|
|
||||||
if (!NIL_P(pass_procval)) {
|
th->passed_block = passed_block(pass_procval);
|
||||||
rb_proc_t *pass_proc;
|
|
||||||
GetProcPtr(pass_procval, pass_proc);
|
|
||||||
block = &pass_proc->block;
|
|
||||||
}
|
|
||||||
|
|
||||||
th->passed_block = block;
|
|
||||||
VAR_INITIALIZED(data);
|
VAR_INITIALIZED(data);
|
||||||
result = rb_vm_call(th, data->recv, data->me->called_id, argc, argv, method_callable_method_entry(data));
|
result = rb_vm_call(th, data->recv, data->me->called_id, argc, argv, method_callable_method_entry(data));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user