summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog15
-rw-r--r--proc.c13
-rw-r--r--vm_insnhelper.c5
3 files changed, 16 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index 5510a11278..e7c9930de7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,15 +1,16 @@
+Sun Dec 29 12:11:11 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * 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.
+
Sun Dec 29 08:47:24 2013 Lucas Allan Amorim <lucas.allan@gmail.com>
* test/ruby/test_sprintf.rb (test_hash): Added tests for sprintf
with a hash as parameter. [Fixes GH-491]
-Sun Dec 29 08:21:09 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
-
- * vm_insnhelper.c (vm_search_super_method): direct superclass of a
- module is found when super called in a Method object generated a
- method defined in a module, call method_missing in that case.
- [ruby-core:59358] [Bug #9315]
-
Sun Dec 29 07:27:51 2013 Benoit Daloze <eregontp@gmail.com>
* compar.c (cmp_eq_recursive): Fix the return value, the value for
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
diff --git a/vm_insnhelper.c b/vm_insnhelper.c
index 8694f524f6..c8cbaa07bf 100644
--- a/vm_insnhelper.c
+++ b/vm_insnhelper.c
@@ -2024,11 +2024,6 @@ vm_search_super_method(rb_thread_t *th, rb_control_frame_t *reg_cfp, rb_call_inf
" by define_method() is not supported."
" Specify all arguments explicitly.");
}
- if (!ci->klass) {
- ci->aux.missing_reason = NOEX_SUPER;
- CI_SET_FASTPATH(ci, vm_call_method_missing, 1);
- return;
- }
/* TODO: use inline cache */
ci->me = rb_method_entry(ci->klass, ci->mid, &ci->defined_class);