1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* insnhelper.ci (vm_invoke_block): should splat args.

[ruby-dev:32392]
* test/ruby/test_yield.rb: add tests for above.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14042 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ko1 2007-11-28 07:31:10 +00:00
parent 49b1513d1e
commit c2aef47c84
3 changed files with 19 additions and 5 deletions

View file

@ -1,3 +1,10 @@
Wed Nov 28 16:29:35 2007 Koichi Sasada <ko1@atdot.net>
* insnhelper.ci (vm_invoke_block): should splat args.
[ruby-dev:32392]
* test/ruby/test_yield.rb: add tests for above.
Wed Nov 28 14:43:14 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb (extract_makefile): use dldflags instead of DLDFLAGS to

View file

@ -798,13 +798,12 @@ vm_invoke_block(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_num_t num, rb_n
}
iseq = block->iseq;
argc = caller_setup_args(th, GET_CFP(), flag, argc, 0, 0);
if (BUILTIN_TYPE(iseq) != T_NODE) {
int opt_pc;
argc = caller_setup_args(th, GET_CFP(), flag, argc, 0, 0);
CHECK_STACK_OVERFLOW(GET_CFP(), iseq->stack_max);
DEC_SP(argc);
opt_pc = vm_yield_setup_args(th, iseq, argc, GET_SP(), 0,
block_proc_is_lambda(block->proc));
@ -820,8 +819,8 @@ vm_invoke_block(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_num_t num, rb_n
return Qundef;
}
else {
val = vm_yield_with_cfunc(th, block, block->self, num, STACK_ADDR_FROM_TOP(num));
POPN(num); /* TODO: should put before C/yield? */
val = vm_yield_with_cfunc(th, block, block->self, argc, STACK_ADDR_FROM_TOP(argc));
POPN(argc); /* TODO: should put before C/yield? */
return val;
}
}

View file

@ -64,6 +64,14 @@ class TestRubyYield < Test::Unit::TestCase
}
end
def test_with_enum
obj = Object
def obj.each
yield(*[])
end
obj.each{|*v| assert_equal([], [], '[ruby-dev:32392]')}
obj.to_enum.each{|*v| assert_equal([], [], '[ruby-dev:32392]')}
end
end
require 'sentence'