[macruby-changes] [5070] MacRuby/trunk/class.c

source_changes at macosforge.org source_changes at macosforge.org
Wed Dec 22 05:26:52 PST 2010


Revision: 5070
          http://trac.macosforge.org/projects/ruby/changeset/5070
Author:   watson1978 at gmail.com
Date:     2010-12-22 05:26:48 -0800 (Wed, 22 Dec 2010)
Log Message:
-----------
Fixed a bug of #1059. does not accept what send #initialize_copy to BasicObject and Object.

Modified Paths:
--------------
    MacRuby/trunk/class.c

Modified: MacRuby/trunk/class.c
===================================================================
--- MacRuby/trunk/class.c	2010-12-22 04:49:24 UTC (rev 5069)
+++ MacRuby/trunk/class.c	2010-12-22 13:26:48 UTC (rev 5070)
@@ -304,6 +304,13 @@
 VALUE
 rb_class_init_copy(VALUE clone, SEL sel, VALUE orig)
 {
+    if (orig == rb_cBasicObject || orig == rb_cObject) {
+	rb_raise(rb_eTypeError, "can't copy the root class");
+    }
+    if (/* RCLASS_SUPER(clone) ||  FIXME: comment out because Singleton.clone raises a rb_eTypeError */
+	(clone == rb_cBasicObject || clone == rb_cObject)) {
+	rb_raise(rb_eTypeError, "already initialized class");
+    }
     if (RCLASS_SINGLETON(orig)) {
 	rb_raise(rb_eTypeError, "can't copy singleton class");
     }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101222/6065878a/attachment.html>


More information about the macruby-changes mailing list