From b20ecf49d4d81474bf9352c0f14963cefea660c7 Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 26 Jun 2013 08:11:48 +0000 Subject: merge revision(s) 41343,41360,41386: [Backport #8531] test/ruby/test_symbol.rb: tests for [Bug #8531] * include/ruby/ruby.h, vm_eval.c (rb_funcall_with_block): new function to invoke a method with a block passed as an argument. * string.c (sym_call): use the above function to avoid a block sharing. [ruby-dev:47438] [Bug #8531] * vm_insnhelper.c (vm_yield_with_cfunc): don't set block in the frame. * test/ruby/test_symbol.rb (TestSymbol#test_block_given_to_proc): run related tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@41653 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_eval.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'vm_eval.c') diff --git a/vm_eval.c b/vm_eval.c index 0c740285be..2291001a2e 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -694,6 +694,23 @@ rb_funcall_passing_block(VALUE recv, ID mid, int argc, const VALUE *argv) return rb_call(recv, mid, argc, argv, CALL_PUBLIC); } +VALUE +rb_funcall_with_block(VALUE recv, ID mid, int argc, const VALUE *argv, VALUE pass_procval) +{ + if (!NIL_P(pass_procval)) { + rb_thread_t *th = GET_THREAD(); + rb_block_t *block = 0; + + rb_proc_t *pass_proc; + GetProcPtr(pass_procval, pass_proc); + block = &pass_proc->block; + + th->passed_block = block; + } + + return rb_call(recv, mid, argc, argv, CALL_PUBLIC); +} + static VALUE send_internal(int argc, const VALUE *argv, VALUE recv, call_type scope) { -- cgit v1.2.3