From c4e2e584e03c28eced3e6e8f4dcb713a2ce92a65 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 1 Jun 2017 08:02:41 +0000 Subject: [PATCH] vm_eval.c: fix rb_check_funcall_default * vm_eval.c (check_funcall_missing): revert r58984. should call method_missing if respond_to_missing is not redefined. * vm_eval.c (rb_check_funcall_default): return the default value if respond_to_missing and method_missing are not defined. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58985 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- vm_eval.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/vm_eval.c b/vm_eval.c index 1879a8a811..9ef9f17549 100644 --- a/vm_eval.c +++ b/vm_eval.c @@ -404,7 +404,7 @@ check_funcall_missing(rb_thread_t *th, VALUE klass, VALUE recv, ID mid, int argc ret = basic_obj_respond_to_missing(th, klass, recv, ID2SYM(mid), PRIV); - if (!RTEST(ret) || ret == Qundef) return def; + if (!RTEST(ret)) return def; args.respond = respond > 0; args.respond_to_missing = (ret != Qundef); ret = def; @@ -448,8 +448,10 @@ rb_check_funcall_default(VALUE recv, ID mid, int argc, const VALUE *argv, VALUE me = rb_search_method_entry(recv, mid); if (!check_funcall_callable(th, me)) { - return check_funcall_missing(th, klass, recv, mid, argc, argv, - respond, def); + VALUE ret = check_funcall_missing(th, klass, recv, mid, argc, argv, + respond, def); + if (ret == Qundef) ret = def; + return ret; } stack_check(th); return vm_call0(th, recv, mid, argc, argv, me);