summaryrefslogtreecommitdiff
path: root/vm_insnhelper.c
diff options
context:
space:
mode:
author卜部昌平 <shyouhei@ruby-lang.org>2019-09-25 17:00:25 +0900
committer卜部昌平 <shyouhei@ruby-lang.org>2019-09-30 10:26:38 +0900
commit6c6a25feca8752205d81c5247f85d8ae8fb880d8 (patch)
tree449e41fc35b50b0d498f646303c49935d05b457b /vm_insnhelper.c
parent167e6b48f1b321d671998728adf5a0db06d24445 (diff)
refactor add rb_method_entry_from_template
Tired of rb_method_entry_create(..., rb_method_definition_create( ..., &(rb_method_foo_t) {...})) maneuver. Provide a function that does the thing to reduce copy&paste.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2486
Diffstat (limited to 'vm_insnhelper.c')
-rw-r--r--vm_insnhelper.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index f144d1157c..adad1df6dd 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2587,16 +2587,8 @@ aliased_callable_method_entry0(const rb_method_entry_t *me)
VALUE defined_class = find_defined_class_by_owner(me->defined_class, orig_me->owner);
VM_ASSERT(RB_TYPE_P(orig_me->owner, T_MODULE));
cme = rb_method_entry_complement_defined_class(orig_me, me->called_id, defined_class);
- rb_method_entry_t *ret =
- rb_method_entry_create(
- me->called_id,
- me->owner,
- me->defined_class,
- rb_method_definition_create(
- VM_METHOD_TYPE_ALIAS,
- me->def->original_id,
- cme));
- METHOD_ENTRY_FLAGS_COPY(ret, (const void*)me);
+ const rb_method_entry_t *ret =
+ rb_method_entry_from_template((const rb_method_entry_t*)me, cme);
rb_method_entry_spoof(ret);
return ret;
}