From f0f3821be7507a96e613e6d8e7e675eada78a892 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sun, 22 Dec 2013 14:33:11 +0000 Subject: merge revision(s) 44175,44179: [Backport #9236] * proc.c (method_owner): return the class where alias is defined, not the class original method is defined. * vm_method.c (rb_method_entry_make, rb_alias): store the originally defined class in me. [Bug #7993] [Bug #7842] [Bug #9236] * vm_method.c (rb_method_entry_get_without_cache): cache included module but not iclass. * 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/branches/ruby_2_0_0@44345 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- proc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'proc.c') diff --git a/proc.c b/proc.c index 41908d5b94..38b5157f16 100644 --- a/proc.c +++ b/proc.c @@ -991,6 +991,10 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope) goto again; } + if (RB_TYPE_P(defined_class, T_ICLASS)) { + defined_class = RBASIC(defined_class)->klass; + } + klass = defined_class; while (rclass != klass && @@ -998,10 +1002,6 @@ mnew(VALUE klass, VALUE obj, ID id, VALUE mclass, int scope) 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); @@ -1174,7 +1174,7 @@ method_owner(VALUE obj) struct METHOD *data; TypedData_Get_Struct(obj, struct METHOD, &method_data_type, data); - return data->me->klass; + return data->defined_class; } void -- cgit v1.2.3