mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* eval.c (is_defined): inheritance line adjustment as like as
rb_call_super(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4735 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
90a88ab9a0
commit
3354489d06
2 changed files with 51 additions and 34 deletions
|
@ -1,3 +1,8 @@
|
|||
Fri Oct 10 07:50:54 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* eval.c (is_defined): inheritance line adjustment as like as
|
||||
rb_call_super().
|
||||
|
||||
Fri Oct 10 01:19:00 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
|
||||
|
||||
* ext/openssl/ossl_x509name.c (ossl_x509name_initialize): add
|
||||
|
|
34
eval.c
34
eval.c
|
@ -1988,6 +1988,18 @@ arg_defined(self, node, buf, type)
|
|||
return type;
|
||||
}
|
||||
|
||||
static VALUE
|
||||
search_iclass(self, klass)
|
||||
VALUE self, klass;
|
||||
{
|
||||
VALUE k = CLASS_OF(self);
|
||||
|
||||
while (k && !(BUILTIN_TYPE(k) == T_ICLASS && RBASIC(k)->klass == klass)) {
|
||||
k = RCLASS(k)->super;
|
||||
}
|
||||
return k;
|
||||
}
|
||||
|
||||
static char*
|
||||
is_defined(self, node, buf)
|
||||
VALUE self;
|
||||
|
@ -2004,8 +2016,12 @@ is_defined(self, node, buf)
|
|||
case NODE_ZSUPER:
|
||||
if (ruby_frame->orig_func == 0) return 0;
|
||||
else if (ruby_frame->last_class == 0) return 0;
|
||||
else if (rb_method_boundp(RCLASS(ruby_frame->last_class)->super,
|
||||
ruby_frame->orig_func, 0)) {
|
||||
val = ruby_frame->last_class;
|
||||
if (BUILTIN_TYPE(val) == T_MODULE) {
|
||||
val = search_iclass(self, val);
|
||||
if (!val) return 0;
|
||||
}
|
||||
if (rb_method_boundp(RCLASS(val)->super, ruby_frame->orig_func, 0)) {
|
||||
if (nd_type(node) == NODE_SUPER) {
|
||||
return arg_defined(self, node->nd_args, buf, "super");
|
||||
}
|
||||
|
@ -5254,14 +5270,11 @@ rb_call_super(argc, argv)
|
|||
self = ruby_frame->self;
|
||||
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(klass),
|
||||
rb_class2name(CLASS_OF(self)));
|
||||
}
|
||||
k = search_iclass(self, klass);
|
||||
if (!k) {
|
||||
rb_raise(rb_eTypeError, "%s is not included in %s",
|
||||
rb_class2name(klass),
|
||||
rb_class2name(CLASS_OF(self)));
|
||||
}
|
||||
if (RCLASS(k)->super == 0) {
|
||||
rb_name_error(ruby_frame->last_func,
|
||||
|
@ -5388,7 +5401,6 @@ compile(src, file, line)
|
|||
node = rb_compile_string(file, src, line);
|
||||
rb_thread_critical = critical;
|
||||
|
||||
|
||||
if (ruby_nerrs == 0) return node;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue