summaryrefslogtreecommitdiff
path: root/class.c
diff options
context:
space:
mode:
Diffstat (limited to 'class.c')
-rw-r--r--class.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/class.c b/class.c
index 666548dde3..29fe34a915 100644
--- a/class.c
+++ b/class.c
@@ -178,6 +178,19 @@ rb_define_class_id(id, super)
return klass;
}
+void
+rb_check_inheritable(super)
+ VALUE super;
+{
+ if (TYPE(super) != T_CLASS) {
+ rb_raise(rb_eTypeError, "superclass must be a Class (%s given)",
+ rb_obj_classname(super));
+ }
+ if (RBASIC(super)->flags & FL_SINGLETON) {
+ rb_raise(rb_eTypeError, "can't make subclass of virtual class");
+ }
+}
+
VALUE
rb_class_inherited(super, klass)
VALUE super, klass;