* 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
Родитель 7db609e8bd
Коммит 45c7ea552d
2 изменённых файлов: 13 добавлений и 10 удалений

Просмотреть файл

@ -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>
* eval.c (rb_call_super): inheritance line adjustment moved from

18
eval.c
Просмотреть файл

@ -5178,24 +5178,22 @@ rb_call_super(argc, argv)
}
self = ruby_frame->self;
klass = CLASS_OF(self);
k = ruby_frame->last_class;
if (BUILTIN_TYPE(k) == T_MODULE) {
while (!(BUILTIN_TYPE(klass) == T_ICLASS && RBASIC(klass)->klass == k)) {
klass = RCLASS(klass)->super;
if (!klass) {
klass = ruby_frame->last_class;
if (BUILTIN_TYPE(klass) == T_MODULE) {
k = CLASS_OF(self);
while (!(BUILTIN_TYPE(k) == T_ICLASS && RBASIC(k)->klass == klass)) {
k = RCLASS(k)->super;
if (!k) {
rb_raise(rb_eTypeError, "%s is not included in %s",
rb_class2name(k),
rb_class2name(klass),
rb_class2name(CLASS_OF(self)));
}
}
}
else {
klass = k;
}
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();
return result;