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:
parent
daed912954
commit
bd872a544c
3 changed files with 21 additions and 2 deletions
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue