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

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
This commit is contained in:
nobu 2017-06-01 08:02:41 +00:00
parent 7c9af2d254
commit c4e2e584e0

View file

@ -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);