mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
parent
b6804d62f8
commit
b8e72bd2e9
Notes:
git
2022-03-18 03:57:08 +09:00
1 changed files with 7 additions and 6 deletions
13
object.c
13
object.c
|
@ -2034,18 +2034,19 @@ rb_class_new_instance(int argc, const VALUE *argv, VALUE klass)
|
|||
VALUE
|
||||
rb_class_superclass(VALUE klass)
|
||||
{
|
||||
RUBY_ASSERT(RB_TYPE_P(klass, T_CLASS));
|
||||
|
||||
VALUE super = RCLASS_SUPER(klass);
|
||||
|
||||
if (!super) {
|
||||
if (klass == rb_cBasicObject) return Qnil;
|
||||
rb_raise(rb_eTypeError, "uninitialized class");
|
||||
} else {
|
||||
super = RCLASS_SUPERCLASSES(klass)[RCLASS_SUPERCLASS_DEPTH(klass) - 1];
|
||||
RUBY_ASSERT(RB_TYPE_P(klass, T_CLASS));
|
||||
return super;
|
||||
}
|
||||
while (RB_TYPE_P(super, T_ICLASS)) {
|
||||
super = RCLASS_SUPER(super);
|
||||
}
|
||||
if (!super) {
|
||||
return Qnil;
|
||||
}
|
||||
return super;
|
||||
}
|
||||
|
||||
VALUE
|
||||
|
|
Loading…
Add table
Reference in a new issue