aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--bootstraptest/test_block.rb18
-rw-r--r--vm_insnhelper.c3
3 files changed, 25 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 933fccb0cd..a281b1edd1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Dec 15 16:26:46 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_callee_setup_arg_complex): uses cfp from
+ blockptr instead of the current cfp. [ruby-core:20544]
+
Mon Dec 15 14:56:59 2008 Yuki Sonoda (Yugui) <yugui@yugui.jp>
* test/ruby/test_metaclass.rb: new test case for metaclass hierarchy.
diff --git a/bootstraptest/test_block.rb b/bootstraptest/test_block.rb
index 2db149063e..ce7f00b033 100644
--- a/bootstraptest/test_block.rb
+++ b/bootstraptest/test_block.rb
@@ -487,6 +487,24 @@ assert_equal 'ok', %q{
}, '[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
define_method(:foo) do |&block|
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index b3815b692c..5c3348f3b2 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;