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

vm_eval.c: resolve refined method entry

* vm_eval.c (rb_method_call_status): resolve refined method entry
  to check if undefined.  [ruby-core:69064] [Bug #11117]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50440 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-05-08 03:11:35 +00:00
parent daed912954
commit bd872a544c
3 changed files with 21 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Fri May 8 12:11:33 2015 Nobuyoshi Nakada <nobu@ruby-lang.org>
* vm_eval.c (rb_method_call_status): resolve refined method entry
to check if undefined. [ruby-core:69064] [Bug #11117]
Thu May 7 22:22:59 2015 Sho Hashimoto <sho-h@ruby-lang.org>
* proc.c: [DOC] fix Binding#local_variable_set example. [ci skip]

View file

@ -1445,6 +1445,16 @@ class TestRefinement < Test::Unit::TestCase
}
end
def test_funcall_inherited
bug11117 = '[ruby-core:69064] [Bug #11117]'
Module.new {refine(Dir) {def to_s; end}}
x = Class.new(Dir).allocate
assert_nothing_raised(NoMethodError, bug11117) {
x.inspect
}
end
private
def eval_using(mod, s)

View file

@ -559,10 +559,14 @@ rb_method_call_status(rb_thread_t *th, const rb_method_entry_t *me, call_type sc
ID oid;
int noex;
if (UNDEFINED_METHOD_ENTRY_P(me) ||
UNDEFINED_REFINED_METHOD_P(me->def)) {
if (UNDEFINED_METHOD_ENTRY_P(me)) {
undefined:
return scope == CALL_VCALL ? NOEX_VCALL : 0;
}
if (me->def->type == VM_METHOD_TYPE_REFINED) {
me = rb_resolve_refined_method(Qnil, me, NULL);
if (UNDEFINED_METHOD_ENTRY_P(me)) goto undefined;
}
klass = me->klass;
oid = me->def->original_id;
noex = me->flag;