summaryrefslogtreecommitdiff
path: root/proc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-29 03:11:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-12-29 03:11:17 +0000
commita69f01fa52e3ab47fa700442251f73f47846bb9f (patch)
tree21edfbc648546117d533a5c0eb1aebaab98964ab /proc.c
parentcb08e708227216bd2810a6bda18140467d23cb34 (diff)
proc.c: fix inherited method owner
* proc.c (mnew_from_me): keep iclass as-is, to make inheritance chain consistent. [ruby-core:59358] [Bug #9315] * proc.c (method_owner): return the original defined_class from prepended iclass, instead. * vm_insnhelper.c (vm_search_super_method): revert r44455, no longer defined_class becomes a module. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44458 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/proc.c b/proc.c
index 1b61d71ac1..8519dfdaaa 100644
--- a/proc.c
+++ b/proc.c
@@ -1224,10 +1224,6 @@ 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 &&
@@ -1449,9 +1445,16 @@ static VALUE
method_owner(VALUE obj)
{
struct METHOD *data;
+ VALUE defined_class;
TypedData_Get_Struct(obj, struct METHOD, &method_data_type, data);
- return data->defined_class;
+ defined_class = data->defined_class;
+
+ if (RB_TYPE_P(defined_class, T_ICLASS)) {
+ defined_class = RBASIC_CLASS(defined_class);
+ }
+
+ return defined_class;
}
void