diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-09 08:48:34 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-12-09 08:48:34 +0000 |
commit | 29756c5e94c6f273c6b1a1103d9c0b12570566ea (patch) | |
tree | bf3a399a7074285a5137d279286f0a5f604467c3 /vm_method.c | |
parent | 1cf13e078593c31aec06e4749287aceab989baf6 (diff) |
* vm_insnhelper.c (vm_call_opt_send): Kernel#send should not use
refinements.
* proc.c (mnew): Kernel#method, Kernel#public_method,
Module#instance_method, and Module#public_instance_method should
not use refinements.
* vm_method.c (rb_method_boundp): Kernel#respond_to? should not use
refinements.
* test/ruby/test_refinement.rb: related test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r-- | vm_method.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c index 2db6000691..d33681ac3f 100644 --- a/vm_method.c +++ b/vm_method.c @@ -629,6 +629,21 @@ rb_method_entry_with_refinements(VALUE klass, ID id, return me; } +rb_method_entry_t * +rb_method_entry_without_refinements(VALUE klass, ID id, + VALUE *defined_class_ptr) +{ + VALUE defined_class; + rb_method_entry_t *me = rb_method_entry(klass, id, &defined_class); + + if (me && me->def->type == VM_METHOD_TYPE_REFINED) { + me = me->def->body.orig_me; + } + if (defined_class_ptr) + *defined_class_ptr = defined_class; + return me; +} + static void remove_method(VALUE klass, ID mid) { @@ -753,7 +768,7 @@ int rb_method_boundp(VALUE klass, ID id, int ex) { rb_method_entry_t *me = - rb_method_entry_with_refinements(klass, id, 0); + rb_method_entry_without_refinements(klass, id, 0); if (me != 0) { if ((ex & ~NOEX_RESPONDS) && |