rb_method_entry_t * rb_method_entry_with_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) { NODE *cref = rb_vm_cref(); VALUE refinements = cref ? cref->nd_refinements : Qnil; me = rb_resolve_refined_method(refinements, me, &defined_class); } if (defined_class_ptr) *defined_class_ptr = defined_class; 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 = rb_resolve_refined_method(Qnil, me, &defined_class); } if (defined_class_ptr) *defined_class_ptr = defined_class; if (UNDEFINED_METHOD_ENTRY_P(me)) { return 0; } else { return me; } }
static rb_method_entry_t * get_original_method_entry(VALUE refinements, const rb_method_entry_t *me, VALUE *defined_class_ptr) { VALUE super; if (me->def->body.orig_me) { return me->def->body.orig_me; } else if (!(super = RCLASS_SUPER(me->klass))) { return 0; } else { rb_method_entry_t *tmp_me; tmp_me = rb_method_entry(super, me->called_id, defined_class_ptr); return rb_resolve_refined_method(refinements, tmp_me, defined_class_ptr); } }
static int method_entry_i(st_data_t key, st_data_t value, st_data_t data) { const rb_method_entry_t *me = (const rb_method_entry_t *)value; st_table *list = (st_table *)data; long type; if (me && me->def->type == VM_METHOD_TYPE_REFINED) { me = rb_resolve_refined_method(Qnil, me, NULL); if (!me) return ST_CONTINUE; } if (!st_lookup(list, key, 0)) { if (UNDEFINED_METHOD_ENTRY_P(me)) { type = -1; /* none */ } else { type = VISI(me->flag); } st_add_direct(list, key, type); } return ST_CONTINUE; }