diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-09-25 17:00:25 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2019-09-30 10:26:38 +0900 |
commit | 6c6a25feca8752205d81c5247f85d8ae8fb880d8 (patch) | |
tree | 449e41fc35b50b0d498f646303c49935d05b457b /proc.c | |
parent | 167e6b48f1b321d671998728adf5a0db06d24445 (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 'proc.c')
-rw-r--r-- | proc.c | 9 |
1 files changed, 1 insertions, 8 deletions
@@ -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); |