summaryrefslogtreecommitdiff
path: root/vm_method.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-15 15:24:05 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-15 15:24:05 +0000
commit67f5f1be206c7ecb19aeb4cb1167dcedfb3466bd (patch)
treea58a203998f29867fc31696d482a42222ffbf92a /vm_method.c
parentd5cf6c1128d04beb84ac960ec5855f2fb64f3d27 (diff)
merge revision(s) r45367,r45387,r45388,r45389: [Backport #9475]
* vm_method.c (rb_method_entry_get_without_cache): get rid of infinite recursion at aliases in a subclass and a superclass. return actually defined class for other than singleton class. [ruby-core:60431] [Bug #9475] * vm_method.c (rb_method_entry_get_without_cache): me->klass is 0 for a method aliased in a module. [ruby-core:61636] [Bug #9663] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_1@45955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'vm_method.c')
-rw-r--r--vm_method.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/vm_method.c b/vm_method.c
index ecded4aa2f..a5fe4ba0a3 100644
--- a/vm_method.c
+++ b/vm_method.c
@@ -566,8 +566,15 @@ rb_method_entry_get_without_cache(VALUE klass, ID id,
VALUE defined_class;
rb_method_entry_t *me = search_method(klass, id, &defined_class);
- if (me && RB_TYPE_P(me->klass, T_ICLASS))
- defined_class = me->klass;
+ if (me && me->klass) {
+ switch (BUILTIN_TYPE(me->klass)) {
+ case T_CLASS:
+ if (RBASIC(klass)->flags & FL_SINGLETON) break;
+ /* fall through */
+ case T_ICLASS:
+ defined_class = me->klass;
+ }
+ }
if (ruby_running) {
struct cache_entry *ent;