summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-02 18:44:33 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-02 18:44:33 +0000
commit284d7463924b313f12da8de5184af3407c3612ac (patch)
tree84e55024358897290c86dbadece8253a128fc49e
parent233f7d09e3b5a46917023da7b152b5062036e25a (diff)
* vm_insnhelper.c (vm_yield_setup_block_args): partially revert r41019.
The code is not useless. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41041 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--test/ruby/test_yield.rb11
-rw-r--r--vm_insnhelper.c3
3 files changed, 19 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 9eb8e61cec..089e4e01bd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jun 3 03:40:29 2013 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * vm_insnhelper.c (vm_yield_setup_block_args): partially revert r41019.
+ The code is not useless.
+
Mon Jun 3 01:25:25 2013 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
* test/socket/test_sockopt.rb: change test name. follow r41037.
diff --git a/test/ruby/test_yield.rb b/test/ruby/test_yield.rb
index 3337aea078..143ee55a9f 100644
--- a/test/ruby/test_yield.rb
+++ b/test/ruby/test_yield.rb
@@ -379,4 +379,15 @@ class TestRubyYieldGen < Test::Unit::TestCase
}
end
+ def test_block_with_mock
+ y = Object.new
+ def y.s(a)
+ yield(a)
+ end
+ m = Object.new
+ def m.method_missing(*a)
+ super
+ end
+ assert_equal [m, nil], y.s(m){|a,b|[a,b]}
+ end
end
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 5a3a14d5ac..86f2d07cd8 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2211,6 +2211,9 @@ vm_yield_setup_block_args(rb_thread_t *th, const rb_iseq_t * iseq,
MEMCPY(argv, RARRAY_PTR(ary), VALUE, argc);
}
+ else {
+ argv[0] = arg0; /* rb_check_array_type(arg0) may change argv */
+ }
/* keyword argument */
if (iseq->arg_keyword != -1) {