class.c: err if superclass is 0

* class.c (rb_define_class, rb_define_class_id_under): raise
  ArgumentError if super is 0, deprecated behavior which has been
  warned long time.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-03-07 04:33:00 +00:00
Родитель 8e1a0856ed
Коммит 9bb8f28f3d
2 изменённых файлов: 9 добавлений и 3 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Mon Mar 7 13:32:58 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* class.c (rb_define_class, rb_define_class_id_under): raise
ArgumentError if super is 0, deprecated behavior which has been
warned long time.
Mon Mar 7 13:28:30 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* internal.h: move function declarations for class internals from

Просмотреть файл

@ -660,7 +660,7 @@ rb_define_class(const char *name, VALUE super)
return klass;
}
if (!super) {
rb_warn("no super class for `%s', Object assumed", name);
rb_raise(rb_eArgError, "no super class for `%s'", name);
}
klass = rb_define_class_id(id, super);
rb_vm_add_root_module(id, klass);
@ -732,8 +732,8 @@ rb_define_class_id_under(VALUE outer, ID id, VALUE super)
return klass;
}
if (!super) {
rb_warn("no super class for `%"PRIsVALUE"::%"PRIsVALUE"', Object assumed",
rb_class_path(outer), rb_id2str(id));
rb_raise(rb_eArgError, "no super class for `%"PRIsVALUE"::%"PRIsVALUE"'",
rb_class_path(outer), rb_id2str(id));
}
klass = rb_define_class_id(id, super);
rb_set_class_path_string(klass, outer, rb_id2str(id));