diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-13 15:18:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-12-13 15:18:12 +0000 |
commit | b7c2f5bc932251744af7a1b3e2a31052589bf0dc (patch) | |
tree | fed8815e4858674a09c6af87cac06bb7a1abaa34 /proc.c | |
parent | 537f327653dc314e67fb32996f585f51eaaaea75 (diff) |
proc.c: fix inherited owner
* proc.c (mnew_from_me): achieve the original defined_class from
prepended iclass, to fix inherited owner.
* proc.c (method_owner): return the defined class, but not the
class which the method object is created from.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44179 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -1168,6 +1168,10 @@ mnew_from_me(rb_method_entry_t *me, VALUE defined_class, VALUE klass, goto again; } + if (RB_TYPE_P(defined_class, T_ICLASS)) { + defined_class = RBASIC_CLASS(defined_class); + } + klass = defined_class; while (rclass != klass && @@ -1175,10 +1179,6 @@ mnew_from_me(rb_method_entry_t *me, VALUE defined_class, VALUE klass, rclass = RCLASS_SUPER(rclass); } - if (RB_TYPE_P(klass, T_ICLASS)) { - klass = RBASIC(klass)->klass; - } - gen_method: method = TypedData_Make_Struct(mclass, struct METHOD, &method_data_type, data); @@ -1395,7 +1395,7 @@ method_owner(VALUE obj) struct METHOD *data; TypedData_Get_Struct(obj, struct METHOD, &method_data_type, data); - return data->rclass; + return data->defined_class; } void |