aboutsummaryrefslogtreecommitdiffstats
path: root/proc.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 /proc.c
parent167e6b48f1b321d671998728adf5a0db06d24445 (diff)
downloadruby-6c6a25feca8752205d81c5247f85d8ae8fb880d8.tar.gz
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.
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/proc.c b/proc.c
index 67e29643bb..09b310356c 100644
--- a/proc.c
+++ b/proc.c
@@ -1474,16 +1474,9 @@ mnew_missing(VALUE klass, VALUE obj, ID id, VALUE mclass)
{
struct METHOD *data;
VALUE method = TypedData_Make_Struct(mclass, struct METHOD, &method_data_type, data);
- rb_method_entry_t *me;
- const rb_method_definition_t *def;
-
RB_OBJ_WRITE(method, &data->recv, obj);
RB_OBJ_WRITE(method, &data->klass, klass);
-
- def = rb_method_definition_create(VM_METHOD_TYPE_MISSING, id, NULL);
- me = rb_method_entry_create(id, klass, METHOD_VISI_UNDEF, def);
-
- RB_OBJ_WRITE(method, &data->me, me);
+ RB_OBJ_WRITE(method, &data->me, rb_method_entry_for_missing(id, klass));
OBJ_INFECT(method, klass);