From 4c97668455e6be4bd3c44d62eaff41b7376248a4 Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 1 Feb 2010 07:40:45 +0000 Subject: [PATCH] * eval.c (proc_invoke): reverted r25975. [ruby-dev:39931] [ruby-dev:40059] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- eval.c | 3 +-- test/ruby/test_super.rb | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/eval.c b/eval.c index 19b753bbc6..1c099bdd1e 100644 --- a/eval.c +++ b/eval.c @@ -8958,8 +8958,7 @@ proc_invoke(proc, args, self, klass) _block = *data; _block.block_obj = bvar; if (self != Qundef) _block.frame.self = self; - _block.frame.last_class = klass; - if (!klass) _block.frame.last_func = 0; + if (klass) _block.frame.last_class = klass; _block.frame.argc = RARRAY(tmp)->len; _block.frame.flags = ruby_frame->flags; if (_block.frame.argc && DMETHOD_P()) { diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index 51819667ee..d1795d2a34 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -149,4 +149,25 @@ class TestSuper < Test::Unit::TestCase c = C.new assert_equal([c, "#{c.to_s}::m"], c.m, bug2419) end + + module Bug2537 + class Parent + def run(a) + a + end + end + + class Child < Parent + def run(*a) + proc {super(*a)}.call + end + end + end + + def test_super_in_block_call + bug2537 = '[ruby-dev:39931]' + assert_nothing_raised(bug2537) do + assert_equal(bug2537, Bug2537::Child.new.run(bug2537), bug2537) + end + end end