* eval.c (rb_call_super): should search superclass method based on

orig_func, not last_func.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2003-06-03 13:57:06 +00:00
parent 7db609e8bd
commit 45c7ea552d
2 changed files with 13 additions and 10 deletions

View File

@ -1,3 +1,8 @@
Tue Jun 3 22:20:49 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_call_super): should search superclass method based on
orig_func, not last_func.
Tue Jun 3 09:59:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org> Tue Jun 3 09:59:27 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* eval.c (rb_call_super): inheritance line adjustment moved from * eval.c (rb_call_super): inheritance line adjustment moved from

18
eval.c
View File

@ -5178,24 +5178,22 @@ rb_call_super(argc, argv)
} }
self = ruby_frame->self; self = ruby_frame->self;
klass = CLASS_OF(self); klass = ruby_frame->last_class;
k = ruby_frame->last_class; if (BUILTIN_TYPE(klass) == T_MODULE) {
if (BUILTIN_TYPE(k) == T_MODULE) { k = CLASS_OF(self);
while (!(BUILTIN_TYPE(klass) == T_ICLASS && RBASIC(klass)->klass == k)) { while (!(BUILTIN_TYPE(k) == T_ICLASS && RBASIC(k)->klass == klass)) {
klass = RCLASS(klass)->super; k = RCLASS(k)->super;
if (!klass) { if (!k) {
rb_raise(rb_eTypeError, "%s is not included in %s", rb_raise(rb_eTypeError, "%s is not included in %s",
rb_class2name(k), rb_class2name(klass),
rb_class2name(CLASS_OF(self))); rb_class2name(CLASS_OF(self)));
} }
} }
}
else {
klass = k; klass = k;
} }
PUSH_ITER(ruby_iter->iter?ITER_PRE:ITER_NOT); PUSH_ITER(ruby_iter->iter?ITER_PRE:ITER_NOT);
result = rb_call(RCLASS(klass)->super, self, ruby_frame->last_func, argc, argv, 3); result = rb_call(RCLASS(klass)->super, self, ruby_frame->orig_func, argc, argv, 3);
POP_ITER(); POP_ITER();
return result; return result;