mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@1621 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c068201c50
commit
f35971afdf
11 changed files with 71 additions and 24 deletions
18
class.c
18
class.c
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue