diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-07-18 05:56:05 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2001-07-18 05:56:05 +0000 |
commit | a9b5f189201a3a4c7302aa1857e597bb065aae3e (patch) | |
tree | 7b2ec9bc16cac781813584423a00482fc94869aa /class.c | |
parent | a9c98cfc5c648cfbfcc47da2e27d29c3b47a4504 (diff) | |
download | ruby-a9b5f189201a3a4c7302aa1857e597bb065aae3e.tar.gz ruby-a9b5f189201a3a4c7302aa1857e597bb065aae3e.tar.xz ruby-a9b5f189201a3a4c7302aa1857e597bb065aae3e.zip |
* regex.c (NUM_FAILURE_ITEMS): was confusing NUM_REG_ITEMS and
NUM_NONREG_ITEMS, which have happened to be same value.
* class.c (rb_class_new): subclass check moved to this function.
* class.c (rb_class_boot): check less version of rb_class_new().
* eval.c (proc_invoke): should preserve iter status for embedded
frame in the block.
* file.c (rb_file_s_expand_path): may overrun buffer on stack.
* string.c (rb_str_insert): forgot to call rb_str_modify().
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'class.c')
-rw-r--r-- | class.c | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -19,7 +19,7 @@ extern st_table *rb_class_tbl; VALUE -rb_class_new(super) +rb_class_boot(super) VALUE super; { NEWOBJ(klass, struct RClass); @@ -33,6 +33,20 @@ rb_class_new(super) return (VALUE)klass; } +VALUE +rb_class_new(super) + VALUE super; +{ + Check_Type(super, T_CLASS); + if (super == rb_cClass) { + rb_raise(rb_eTypeError, "can't make subclass of Class"); + } + if (FL_TEST(super, FL_SINGLETON)) { + rb_raise(rb_eTypeError, "can't make subclass of virtual class"); + } + return rb_class_boot(super); +} + static int clone_method(mid, body, tbl) ID mid; @@ -78,7 +92,7 @@ VALUE rb_singleton_class_new(super) VALUE super; { - VALUE klass = rb_class_new(super); + VALUE klass = rb_class_boot(super); FL_SET(klass, FL_SINGLETON); return klass; |