summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--eval.c3
-rw-r--r--test/ruby/test_super.rb21
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