diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-07-07 06:34:40 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-07-07 06:34:40 +0000 |
commit | 0afe6cb08f97a2fdbfb945f8b5685a5fe79fa184 (patch) | |
tree | 904efa1381756811688e4d0bbd29c04a43891f84 /insnhelper.ci | |
parent | 7756f1df188b8a8ef7182d66d0a2f94df27fabe9 (diff) | |
download | ruby-0afe6cb08f97a2fdbfb945f8b5685a5fe79fa184.tar.gz |
* insnhelper.ci (vm_yield_setup_args), vm.c, insns.def:
fix to pass nil as block parameter to yielded block.
[ruby-dev:31147]
* bootstraptest/test_block.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12718 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'insnhelper.ci')
-rw-r--r-- | insnhelper.ci | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/insnhelper.ci b/insnhelper.ci index f3665be14f..385a31eda9 100644 --- a/insnhelper.ci +++ b/insnhelper.ci @@ -605,7 +605,7 @@ vm_yield_with_cfunc(rb_thread_t *th, rb_block_t *block, static inline int vm_yield_setup_args(rb_thread_t *th, rb_iseq_t *iseq, - int argc, VALUE *argv, int lambda) + int argc, VALUE *argv, rb_block_t *blockptr, int lambda) { if (0) { /* for debug */ printf(" argc: %d\n", argc); @@ -620,20 +620,8 @@ vm_yield_setup_args(rb_thread_t *th, rb_iseq_t *iseq, if (lambda) { /* call as method */ - if (iseq->arg_block != -1) { - volatile VALUE procval = Qnil; - - if (rb_block_given_p()) { - rb_block_t *blockptr; - rb_proc_t *proc; - procval = rb_block_proc(); - GetProcPtr(procval, proc); - blockptr = &proc->block; return vm_callee_setup_arg(th, iseq, argc, argv, &blockptr); } - } - return vm_callee_setup_arg(th, iseq, argc, argv, 0); - } else { int i; const int m = iseq->argc; @@ -721,13 +709,13 @@ vm_yield_setup_args(rb_thread_t *th, rb_iseq_t *iseq, /* {|&b|} */ if (iseq->arg_block != -1) { - VALUE proc = Qnil; + VALUE procval = Qnil; - if (rb_block_given_p()) { - proc = rb_block_proc(); + if (blockptr) { + procval = blockptr->proc; } - argv[iseq->arg_block] = proc; + argv[iseq->arg_block] = procval; th->mark_stack_len = iseq->arg_block + 1; } |