1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* vm.c (invoke_block): fix to specify self.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-01-16 08:43:18 +00:00
parent c22416a87f
commit 63315f6305
2 changed files with 8 additions and 4 deletions

View file

@ -1,3 +1,7 @@
Tue Jan 16 17:39:44 2007 Koichi Sasada <ko1@atdot.net>
* vm.c (invoke_block): fix to specify self.
Tue Jan 16 12:12:27 2007 Koichi Sasada <ko1@atdot.net> Tue Jan 16 12:12:27 2007 Koichi Sasada <ko1@atdot.net>
* env.h: removed * env.h: removed

8
vm.c
View file

@ -663,7 +663,7 @@ th_yield_setup_args(yarv_iseq_t *iseq, int argc, VALUE *argv)
} }
static VALUE static VALUE
invoke_block(yarv_thread_t *th, yarv_block_t *block, int argc, VALUE *argv, int magic) invoke_block(yarv_thread_t *th, yarv_block_t *block, VALUE self, int argc, VALUE *argv, int magic)
{ {
VALUE val; VALUE val;
if (BUILTIN_TYPE(block->iseq) != T_NODE) { if (BUILTIN_TYPE(block->iseq) != T_NODE) {
@ -679,7 +679,7 @@ invoke_block(yarv_thread_t *th, yarv_block_t *block, int argc, VALUE *argv, int
th->cfp->sp += argc; th->cfp->sp += argc;
push_frame(th, iseq, magic, push_frame(th, iseq, magic,
block->self, GC_GUARDED_PTR(block->dfp), self, GC_GUARDED_PTR(block->dfp),
iseq->iseq_encoded, th->cfp->sp, block->lfp, iseq->iseq_encoded, th->cfp->sp, block->lfp,
iseq->local_size - argc); iseq->local_size - argc);
val = th_eval_body(th); val = th_eval_body(th);
@ -704,7 +704,7 @@ th_invoke_yield(yarv_thread_t *th, int argc, VALUE *argv)
th_localjump_error("no block given", Qnil, 0); th_localjump_error("no block given", Qnil, 0);
} }
return invoke_block(th, block, argc, argv, FRAME_MAGIC_BLOCK); return invoke_block(th, block, block->self, argc, argv, FRAME_MAGIC_BLOCK);
} }
VALUE VALUE
@ -723,7 +723,7 @@ th_invoke_proc(yarv_thread_t *th, yarv_proc_t *proc,
lfp_set_special_cref(proc->block.lfp, proc->special_cref_stack); lfp_set_special_cref(proc->block.lfp, proc->special_cref_stack);
th->safe_level = proc->safe_level; th->safe_level = proc->safe_level;
val = invoke_block(th, &proc->block, argc, argv, val = invoke_block(th, &proc->block, self, argc, argv,
proc->is_lambda ? FRAME_MAGIC_LAMBDA : FRAME_MAGIC_PROC); proc->is_lambda ? FRAME_MAGIC_LAMBDA : FRAME_MAGIC_PROC);
} }
else { else {