summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-10 20:18:39 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-10 20:18:39 +0000
commit5915dc245e5efac34d676ad29ebd38d6b46f16cf (patch)
tree96a07496fbd0e748f38fd6d178fa5ffda1bd373e /object.c
parent399bb7e73953bc7fbeb74e2712d931f44d7553b8 (diff)
* class.c (rb_make_metaclass): [new]
* class.c (rb_define_class_id): use rb_make_metaclass(), don't call Class#inherited hook. * class.c (rb_class_inherited): [new] * class.c (rb_define_class): call Class#inherited hook here. * class.c (rb_define_class_under): ditto after class path is set. * class.c (rb_singleton_class): use rb_make_metaclass(). * eval.c (rb_eval): same as rb_define_class_under(). * intern.h: prototypes of rb_make_metaclass() and rb_class_inherited(). * object.c (rb_class_s_new): use rb_make_metaclass() and rb_class_inherited(). * object.c (Init_Object): use rb_make_metaclass(). * struct.c (make_struct): use rb_class_inherited(). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'object.c')
-rw-r--r--object.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/object.c b/object.c
index ea3eec7..87f241f 100644
--- a/object.c
+++ b/object.c
@@ -624,11 +624,9 @@ rb_class_s_new(argc, argv)
super = rb_cObject;
}
klass = rb_class_new(super);
- /* make metaclass */
- RBASIC(klass)->klass = rb_singleton_class_new(RBASIC(super)->klass);
- rb_singleton_class_attached(RBASIC(klass)->klass, klass);
+ rb_make_metaclass(klass, RBASIC(super)->klass);
rb_obj_call_init(klass, argc, argv);
- rb_funcall(super, rb_intern("inherited"), 1, klass);
+ rb_class_inherited(super, klass);
return klass;
}
@@ -1129,12 +1127,9 @@ Init_Object()
rb_cModule = boot_defclass("Module", rb_cObject);
rb_cClass = boot_defclass("Class", rb_cModule);
- metaclass = RBASIC(rb_cObject)->klass = rb_singleton_class_new(rb_cClass);
- rb_singleton_class_attached(metaclass, rb_cObject);
- metaclass = RBASIC(rb_cModule)->klass = rb_singleton_class_new(metaclass);
- rb_singleton_class_attached(metaclass, rb_cModule);
- metaclass = RBASIC(rb_cClass)->klass = rb_singleton_class_new(metaclass);
- rb_singleton_class_attached(metaclass, rb_cClass);
+ metaclass = rb_make_metaclass(rb_cObject, rb_cClass);
+ metaclass = rb_make_metaclass(rb_cModule, metaclass);
+ metaclass = rb_make_metaclass(rb_cClass, metaclass);
rb_mKernel = rb_define_module("Kernel");
rb_include_module(rb_cObject, rb_mKernel);