Beispiel #1
0
/* :nodoc: */
VALUE
rb_class_init_copy(VALUE clone, VALUE orig)
{
    if (RCLASS_SUPER(clone) != 0) {
	rb_raise(rb_eTypeError, "already initialized class");
    }
    if (FL_TEST(orig, FL_SINGLETON)) {
	rb_raise(rb_eTypeError, "can't copy singleton class");
    }
    return rb_mod_init_copy(clone, orig);
}
Beispiel #2
0
/* :nodoc: */
VALUE
rb_class_init_copy(VALUE clone, SEL sel, VALUE orig)
{
    if (orig == rb_cBasicObject || orig == rb_cObject) {
	rb_raise(rb_eTypeError, "can't copy the root class");
    }
    if (/* RCLASS_SUPER(clone) ||  FIXME: comment out because Singleton.clone raises a rb_eTypeError */
	(clone == rb_cBasicObject || clone == rb_cObject)) {
	rb_raise(rb_eTypeError, "already initialized class");
    }
    if (RCLASS_SINGLETON(orig)) {
	rb_raise(rb_eTypeError, "can't copy singleton class");
    }
    clone =  rb_mod_init_copy(clone, 0, orig);
    rb_objc_class_sync_version((Class)clone, (Class)orig);
    return clone;
}