summaryrefslogtreecommitdiff
path: root/vm_eval.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-30 10:08:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-01-30 10:08:23 +0000
commit72969cd348ac6f00bbe71ad63120db0114b35367 (patch)
treed4f7ef5476957e10c14141cfcb3897d468eb8316 /vm_eval.c
parentcba57022b0685690b29bae9f8d9e8c264ab76fe0 (diff)
* vm_eval.c (vm_call0): should pass block to enumerators. patched
by Kazuki Tsujimoto. [ruby-dev:44961][Bug #5731] * vm_eval.c (method_missing), vm_insnhelper.c (vm_call_method): ditto. patched by satoshi shiba. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_eval.c')
-rw-r--r--vm_eval.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/vm_eval.c b/vm_eval.c
index 0ee81797ec..b1d3915563 100644
--- a/vm_eval.c
+++ b/vm_eval.c
@@ -118,6 +118,7 @@ vm_call0(rb_thread_t* th, VALUE recv, VALUE id, int argc, const VALUE *argv,
RB_GC_GUARD(new_args);
rb_ary_unshift(new_args, ID2SYM(id));
+ th->passed_block = blockptr;
return rb_funcall2(recv, idMethodMissing,
argc+1, RARRAY_PTR(new_args));
}
@@ -563,6 +564,7 @@ method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status)
{
VALUE *nargv, result, argv_ary = 0;
rb_thread_t *th = GET_THREAD();
+ const rb_block_t *blockptr = th->passed_block;
th->method_missing_reason = call_status;
th->passed_block = 0;
@@ -589,6 +591,7 @@ method_missing(VALUE obj, ID id, int argc, const VALUE *argv, int call_status)
if (rb_method_basic_definition_p(CLASS_OF(obj) , idMethodMissing)) {
raise_method_missing(th, argc+1, nargv, obj, call_status | NOEX_MISSING);
}
+ th->passed_block = blockptr;
result = rb_funcall2(obj, idMethodMissing, argc + 1, nargv);
if (argv_ary) rb_ary_clear(argv_ary);
return result;