ruby-changes:28989
From: naruse <ko1@a...>
Date: Mon, 3 Jun 2013 03:44:48 +0900 (JST)
Subject: [ruby-changes:28989] naruse:r41041 (trunk): * vm_insnhelper.c (vm_yield_setup_block_args): partially revert r41019.
naruse 2013-06-03 03:44:33 +0900 (Mon, 03 Jun 2013) New Revision: 41041 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=41041 Log: * vm_insnhelper.c (vm_yield_setup_block_args): partially revert r41019. The code is not useless. Modified files: trunk/ChangeLog trunk/test/ruby/test_yield.rb trunk/vm_insnhelper.c Index: ChangeLog =================================================================== --- ChangeLog (revision 41040) +++ ChangeLog (revision 41041) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Mon Jun 3 03:40:29 2013 NARUSE, Yui <naruse@r...> + + * 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@g...> * test/socket/test_sockopt.rb: change test name. follow r41037. Index: vm_insnhelper.c =================================================================== --- vm_insnhelper.c (revision 41040) +++ vm_insnhelper.c (revision 41041) @@ -2211,6 +2211,9 @@ vm_yield_setup_block_args(rb_thread_t *t https://github.com/ruby/ruby/blob/trunk/vm_insnhelper.c#L2211 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) { Index: test/ruby/test_yield.rb =================================================================== --- test/ruby/test_yield.rb (revision 41040) +++ test/ruby/test_yield.rb (revision 41041) @@ -379,4 +379,15 @@ class TestRubyYieldGen < Test::Unit::Tes https://github.com/ruby/ruby/blob/trunk/test/ruby/test_yield.rb#L379 } 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/