diff options
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -2760,6 +2760,8 @@ method_to_proc(VALUE method) return procval; } +extern VALUE rb_find_defined_class_by_owner(VALUE current_class, VALUE target_owner); + /* * call-seq: * meth.super_method -> method @@ -2779,8 +2781,15 @@ method_super_method(VALUE method) TypedData_Get_Struct(method, struct METHOD, &method_data_type, data); iclass = data->iclass; if (!iclass) return Qnil; - super_class = RCLASS_SUPER(RCLASS_ORIGIN(iclass)); - mid = data->me->called_id; + if (data->me->def->type == VM_METHOD_TYPE_ALIAS) { + super_class = RCLASS_SUPER(rb_find_defined_class_by_owner(data->me->defined_class, + data->me->def->body.alias.original_me->owner)); + mid = data->me->def->body.alias.original_me->def->original_id; + } + else { + super_class = RCLASS_SUPER(RCLASS_ORIGIN(iclass)); + mid = data->me->def->original_id; + } if (!super_class) return Qnil; me = (rb_method_entry_t *)rb_callable_method_entry_without_refinements(super_class, mid, &iclass); if (!me) return Qnil; |