summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/vm_method.c b/vm_method.c
index e4ba0e9865..8bd2b2ce56 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -868,7 +868,9 @@ rb_undef(VALUE klass, ID id)
me = search_method(klass, id, 0);
- if (UNDEFINED_METHOD_ENTRY_P(me)) {
+ if (UNDEFINED_METHOD_ENTRY_P(me) ||
+ (me->def->type == VM_METHOD_TYPE_REFINED &&
+ UNDEFINED_METHOD_ENTRY_P(me->def->body.orig_me))) {
const char *s0 = " class";
VALUE c = klass;
@@ -1118,9 +1120,9 @@ rb_method_entry_eq(const rb_method_entry_t *m1, const rb_method_entry_t *m2)
static int
rb_method_definition_eq(const rb_method_definition_t *d1, const rb_method_definition_t *d2)
{
- if (d1 && d1->type == VM_METHOD_TYPE_REFINED)
+ if (d1 && d1->type == VM_METHOD_TYPE_REFINED && d1->body.orig_me)
d1 = d1->body.orig_me->def;
- if (d2 && d2->type == VM_METHOD_TYPE_REFINED)
+ if (d2 && d2->type == VM_METHOD_TYPE_REFINED && d2->body.orig_me)
d2 = d2->body.orig_me->def;
if (d1 == d2) return 1;
if (!d1 || !d2) return 0;