summaryrefslogtreecommitdiff
path: root/bootstraptest
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-13 08:34:43 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-13 08:34:43 +0000
commitffd3cbdc759841c984ec35bfecfb9f7ed28d4faa (patch)
tree9977cb9dc1d1c5f986736c558311e9bad2d355a2 /bootstraptest
parentdb31b3dad519f755358f0a96baad5c378e7c7972 (diff)
downloadruby-ffd3cbdc759841c984ec35bfecfb9f7ed28d4faa.tar.gz
* vm_insnhelper.c (vm_caller_setup_args): save and restore
ci->argc and ci->blockptr before and after method invocations because these method dispatches override call_info. * bootstraptest/test_method.rb: add tests for this fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'bootstraptest')
-rw-r--r--bootstraptest/test_method.rb58
1 files changed, 58 insertions, 0 deletions
diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb
index d6b8c0ea24..ed22608aea 100644
--- a/bootstraptest/test_method.rb
+++ b/bootstraptest/test_method.rb
@@ -1204,3 +1204,61 @@ assert_equal 'ok', %q{
'ok'
end
}
+
+assert_equal 'DC', %q{
+ $result = []
+
+ class C
+ def foo *args
+ $result << 'C'
+ end
+ end
+ class D
+ def foo *args
+ $result << 'D'
+ end
+ end
+
+ o1 = $o1 = C.new
+ o2 = $o2 = D.new
+
+ args = Object.new
+ def args.to_a
+ test1 $o2, nil
+ []
+ end
+ def test1 o, args
+ o.foo(*args)
+ end
+ test1 o1, args
+ $result.join
+}
+
+assert_equal 'DC', %q{
+ $result = []
+
+ class C
+ def foo *args
+ $result << 'C'
+ end
+ end
+ class D
+ def foo *args
+ $result << 'D'
+ end
+ end
+
+ o1 = $o1 = C.new
+ o2 = $o2 = D.new
+
+ block = Object.new
+ def block.to_proc
+ test2 $o2, %w(a, b, c), nil
+ Proc.new{}
+ end
+ def test2 o, args, block
+ o.foo(*args, &block)
+ end
+ test2 o1, [], block
+ $result.join
+}