summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-25 08:37:27 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-25 08:37:27 +0000
commit7bba6adc56b20606101131069ef8f1f96ff71fa2 (patch)
tree646d41e4bd0aa551fbd7b57df76cd316756307c9 /vm_method.c
parentf4d71ad509c929444c43f37befc0f14571cec797 (diff)
* vm_method.c (rb_method_entry_create): need to call
method_definition_reset() if def is given. Actually, `me' is a new object, so we don't need to call it. It is just to make sure. * vm_method.c (method_definition_reset): remove duplicated insertion. * vm_method.c (rb_method_entry_clone): assgine dst->def here, not in method_definition_reset(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51027 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/vm_method.c b/vm_method.c
index 5a40e370d8..43b5d2aafc 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -283,9 +283,9 @@ method_definition_set(rb_method_entry_t *me, rb_method_definition_t *def, void *
}
static void
-method_definition_reset(const rb_method_entry_t *me, rb_method_definition_t *def)
+method_definition_reset(const rb_method_entry_t *me)
{
- *(rb_method_definition_t **)&me->def = def;
+ rb_method_definition_t *def = me->def;
switch(def->type) {
case VM_METHOD_TYPE_ISEQ:
@@ -338,6 +338,7 @@ rb_method_entry_create(ID called_id, VALUE klass, rb_method_visibility_t visi, c
{
rb_method_entry_t *me = (rb_method_entry_t *)rb_imemo_new(imemo_ment, (VALUE)def, (VALUE)called_id, (VALUE)klass, 0);
METHOD_ENTRY_FLAGS_SET(me, visi, ruby_running ? FALSE : TRUE, rb_safe_level());
+ if (def != NULL) method_definition_reset(me);
return me;
}
@@ -353,7 +354,8 @@ rb_method_entry_clone(const rb_method_entry_t *src_me)
void
rb_method_entry_copy(rb_method_entry_t *dst, const rb_method_entry_t *src)
{
- method_definition_reset(dst, method_definition_addref(src->def));
+ *(rb_method_definition_t **)&dst->def = method_definition_addref(src->def);
+ method_definition_reset(dst);
dst->called_id = src->called_id;
RB_OBJ_WRITE((VALUE)dst, &dst->klass, src->klass);
}