[前][次][番号順一覧][スレッド一覧]

ruby-changes:41941

From: nobu <ko1@a...>
Date: Mon, 7 Mar 2016 13:33:05 +0900 (JST)
Subject: [ruby-changes:41941] nobu:r54015 (trunk): class.c: err if superclass is 0

nobu	2016-03-07 13:33:00 +0900 (Mon, 07 Mar 2016)

  New Revision: 54015

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54015

  Log:
    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.

  Modified files:
    trunk/ChangeLog
    trunk/class.c
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 54014)
+++ ChangeLog	(revision 54015)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Mar  7 13:32:58 2016  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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@r...>
 
 	* internal.h: move function declarations for class internals from
Index: class.c
===================================================================
--- class.c	(revision 54014)
+++ class.c	(revision 54015)
@@ -660,7 +660,7 @@ rb_define_class(const char *name, VALUE https://github.com/ruby/ruby/blob/trunk/class.c#L660
 	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 https://github.com/ruby/ruby/blob/trunk/class.c#L732
 	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));

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]