[macruby-changes] [2775] MacRuby/trunk/object.c

source_changes at macosforge.org source_changes at macosforge.org
Fri Oct 9 16:39:36 PDT 2009


Revision: 2775
          http://trac.macosforge.org/projects/ruby/changeset/2775
Author:   lsansonetti at apple.com
Date:     2009-10-09 16:39:35 -0700 (Fri, 09 Oct 2009)
Log Message:
-----------
never return the return value of #initialize (fixes #370)

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

Modified: MacRuby/trunk/object.c
===================================================================
--- MacRuby/trunk/object.c	2009-10-09 20:39:16 UTC (rev 2774)
+++ MacRuby/trunk/object.c	2009-10-09 23:39:35 UTC (rev 2775)
@@ -1868,13 +1868,11 @@
 static inline VALUE
 rb_class_new_instance0(int argc, VALUE *argv, VALUE klass)
 {
-    VALUE obj, init_obj, p;
-
     if (klass == rb_cNSMutableArray) {
 	klass = rb_cRubyArray;
     }
 
-    obj = rb_obj_alloc0(klass);
+    VALUE obj = rb_obj_alloc0(klass);
 
     /* Because we cannot override +[NSObject initialize] */
     if (klass == rb_cClass) {
@@ -1885,24 +1883,14 @@
 
     rb_vm_block_t *block = rb_vm_current_block();
     if (argc == 0) {
-	init_obj = rb_vm_call_with_cache2(initializeCache, block, obj,
-		CLASS_OF(obj), selInitialize, argc, argv);
+	rb_vm_call_with_cache2(initializeCache, block, obj, CLASS_OF(obj),
+		selInitialize, argc, argv);
     }
     else {
-	init_obj = rb_vm_call_with_cache2(initialize2Cache, block, obj,
-		CLASS_OF(obj), selInitialize2, argc, argv);
+	rb_vm_call_with_cache2(initialize2Cache, block, obj, CLASS_OF(obj),
+		selInitialize2, argc, argv);
     }
 
-    if (init_obj != Qnil) {
-	p = CLASS_OF(init_obj);
-	while (p != 0) {
-	    if (p == klass) {
-		return init_obj;
-	    }
-	    p = RCLASS_SUPER(p);
-	}
-    }
-
     return obj;
 }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091009/908e4b80/attachment.html>


More information about the macruby-changes mailing list