ruby-changes:46870
From: nobu <ko1@a...>
Date: Thu, 1 Jun 2017 17:02:46 +0900 (JST)
Subject: [ruby-changes:46870] nobu:r58985 (trunk): vm_eval.c: fix rb_check_funcall_default
nobu 2017-06-01 17:02:41 +0900 (Thu, 01 Jun 2017) New Revision: 58985 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58985 Log: 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. Modified files: trunk/vm_eval.c Index: vm_eval.c =================================================================== --- vm_eval.c (revision 58984) +++ vm_eval.c (revision 58985) @@ -404,7 +404,7 @@ check_funcall_missing(rb_thread_t *th, V https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L404 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 https://github.com/ruby/ruby/blob/trunk/vm_eval.c#L448 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); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/