summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-11 17:22:39 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-03-11 17:22:39 +0000
commit0543b90d0f6a87e3a87f747c584c0d6737f221d4 (patch)
tree0573f559fed0f5af3b29e787a28baaecf15a3cd6 /vm_method.c
parent490691c6e0f3ca7451775d2f1453df9ba3cf7391 (diff)
merge revision(s) 57362: [Backport #13096]
vm_method.c: resolve refined method to undef * vm_method.c (rb_undef): resolve the method entry which refines a prepended method entry. [ruby-core:78944] [Bug #13096] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/vm_method.c b/vm_method.c
index 8aea9b54cc..f4ff7989f2 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -1171,7 +1171,7 @@ rb_attr(VALUE klass, ID id, int read, int write, int ex)
void
rb_undef(VALUE klass, ID id)
{
- rb_method_entry_t *me;
+ const rb_method_entry_t *me;
if (NIL_P(klass)) {
rb_raise(rb_eTypeError, "no class to undef method");
@@ -1182,6 +1182,9 @@ rb_undef(VALUE klass, ID id)
}
me = search_method(klass, id, 0);
+ if (me && me->def->type == VM_METHOD_TYPE_REFINED) {
+ me = rb_resolve_refined_method(Qnil, me);
+ }
if (UNDEFINED_METHOD_ENTRY_P(me) ||
UNDEFINED_REFINED_METHOD_P(me->def)) {