diff options
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r-- | vm_insnhelper.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c index c8cbaa07bf..edf4e46652 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -2004,7 +2004,8 @@ vm_search_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_inf current_defined_class = RCLASS_REFINED_CLASS(current_defined_class); } - if (!FL_TEST(current_defined_class, RMODULE_INCLUDED_INTO_REFINEMENT) && + if (BUILTIN_TYPE(current_defined_class) != T_MODULE && + !FL_TEST(current_defined_class, RMODULE_INCLUDED_INTO_REFINEMENT) && !rb_obj_is_kind_of(ci->recv, current_defined_class)) { VALUE m = RB_TYPE_P(current_defined_class, T_ICLASS) ? RBASIC(current_defined_class)->klass : current_defined_class; @@ -2024,6 +2025,12 @@ vm_search_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_inf " by define_method() is not supported." " Specify all arguments explicitly."); } + if (!ci->klass) { + /* bound instance method of module */ + ci->aux.missing_reason = NOEX_SUPER; + CI_SET_FASTPATH(ci, vm_call_method_missing, 1); + return; + } /* TODO: use inline cache */ ci->me = rb_method_entry(ci->klass, ci->mid, &ci->defined_class); |