From dea36fb2619235d145ebbfe582d2a26a1002566b Mon Sep 17 00:00:00 2001 From: yugui Date: Wed, 17 Dec 2008 06:15:55 +0000 Subject: merges r20748 from trunk into ruby_1_9_1. * vm_insnhelper.c (vm_callee_setup_arg_complex): uses cfp from blockptr instead of the current cfp. [ruby-core:20544] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@20815 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 7 ++++++- bootstraptest/test_block.rb | 18 ++++++++++++++++++ vm_insnhelper.c | 3 ++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 02fdaa61e..72d8f37dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Dec 15 16:26:46 2008 Nobuyoshi Nakada + + * vm_insnhelper.c (vm_callee_setup_arg_complex): uses cfp from + blockptr instead of the current cfp. [ruby-core:20544] + Wed Dec 17 09:50:19 2008 Yuki Sonoda (Yugui) * test/ruby/test_metaclass.rb: removed codes for my debugging. @@ -138,7 +143,7 @@ Sat Dec 13 16:04:48 2008 Yuki Sonoda (Yugui) * encoding.c (default_external): endless recursion during loading a locale encoding on some locale. - fixed by Nobuyuki Nakada. + fixed by Nobuyoshi Nakada. * string.c (sym_inspect): quote if symbol contains non-printable characters. [ruby-dev:37398] diff --git a/bootstraptest/test_block.rb b/bootstraptest/test_block.rb index 2db149063..ce7f00b03 100644 --- a/bootstraptest/test_block.rb +++ b/bootstraptest/test_block.rb @@ -486,6 +486,24 @@ assert_equal 'ok', %q{ C.new.foo("ng") {"ok"} }, '[ruby-talk:266422]' +assert_equal 'ok', %q{ + class C + define_method(:xyz) do |o, k, &block| + block.call(o, k) + end + end + C.new.xyz("o","k") {|o, k| o+k} +}, '[ruby-core:20544]' + +assert_equal 'ok', %q{ + class C + define_method(:xyz) do |*args, &block| + block.call(*args) + end + end + C.new.xyz("o","k") {|*args| args.join("")} +}, '[ruby-core:20544]' + assert_equal 'ok', %q{ STDERR.reopen(STDOUT) class C diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 39b379429..a57c087c6 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -186,7 +186,8 @@ vm_callee_setup_arg_complex(rb_thread_t *th, const rb_iseq_t * iseq, if (blockptr->proc == 0) { rb_proc_t *proc; - blockval = vm_make_proc(th, th->cfp, blockptr, rb_cProc); + blockval = vm_make_proc(th, RUBY_VM_GET_CFP_FROM_BLOCK_PTR(blockptr), + blockptr, rb_cProc); GetProcPtr(blockval, proc); *block = &proc->block; -- cgit