Revision
4188
Author
lsansonetti@apple.com
Date
2010-06-01 20:07:08 -0700 (Tue, 01 Jun 2010)

Log Message

revert r4185 because it breaks spec:macruby somehow (to investigate...)

Modified Paths

Diff

Modified: MacRuby/trunk/dispatcher.cpp (4187 => 4188)


--- MacRuby/trunk/dispatcher.cpp	2010-06-02 03:00:50 UTC (rev 4187)
+++ MacRuby/trunk/dispatcher.cpp	2010-06-02 03:07:08 UTC (rev 4188)
@@ -444,18 +444,15 @@
 	return (*stub)(imp, rcv, sel, argc, argv);
     }
     @catch (id exc) {
-	bool created = false;
-	VALUE rbexc = rb_oc2rb_exception(exc, &created);
+	VALUE rbexc = rb_oc2rb_exception(exc);
 #if __LP64__
 	if (rb_vm_current_exception() == Qnil) {
-	    rb_vm_set_current_exception(rbexc);
-	    throw;
+	    rb_vm_set_current_exception(rbexc);	
 	}
-#endif
-	if (created) {
-	    rb_exc_raise(rbexc);
-	}
 	throw;
+#else
+	rb_exc_raise(rbexc);
+#endif
     }
     abort(); // never reached
 }

Modified: MacRuby/trunk/objc.h (4187 => 4188)


--- MacRuby/trunk/objc.h	2010-06-02 03:00:50 UTC (rev 4187)
+++ MacRuby/trunk/objc.h	2010-06-02 03:07:08 UTC (rev 4188)
@@ -56,7 +56,7 @@
 	size_t name_len);
 
 id rb_rb2oc_exception(VALUE exc);
-VALUE rb_oc2rb_exception(id exc, bool *created);
+VALUE rb_oc2rb_exception(id exc);
 
 size_t rb_objc_type_size(const char *type);
 

Modified: MacRuby/trunk/objc.m (4187 => 4188)


--- MacRuby/trunk/objc.m	2010-06-02 03:00:50 UTC (rev 4187)
+++ MacRuby/trunk/objc.m	2010-06-02 03:07:08 UTC (rev 4188)
@@ -621,32 +621,26 @@
 {
     NSString *name = [NSString stringWithUTF8String:rb_obj_classname(exc)];
     NSString *reason = (NSString *)rb_format_exception_message(exc);
+#if 0
+    // This is technically not required, and it seems that some exceptions
+    // don't like to be treated like NSDictionary values...
     NSDictionary *dict = [NSDictionary dictionaryWithObject:(id)exc
 	forKey:@"RubyException"];
+#else
+    NSDictionary *dict = nil;
+#endif
     return [NSException exceptionWithName:name reason:reason userInfo:dict];
 }
 
 VALUE
-rb_oc2rb_exception(id exc, bool *created)
+rb_oc2rb_exception(id exc)
 {
-    VALUE e;
-    id rubyExc;
-
-    rubyExc = [[exc userInfo] objectForKey:@"RubyException"];
-    if (rubyExc == nil) {
-	*created = true;
-
-	char buf[1000];
-	snprintf(buf, sizeof buf, "%s: %s", [[exc name] UTF8String],
-		[[exc reason] UTF8String]);
-	e = rb_exc_new2(rb_eRuntimeError, buf);
-	// Set the backtrace for Obj-C exceptions
-	rb_iv_set(e, "bt", rb_vm_backtrace(0));
-    }
-    else {
-	*created = false;
-	e = (VALUE)rubyExc;
-    }
+    char buf[1000];
+    snprintf(buf, sizeof buf, "%s: %s", [[exc name] UTF8String],
+	    [[exc reason] UTF8String]);
+    VALUE e = rb_exc_new2(rb_eRuntimeError, buf);
+    // Set the backtrace for Obj-C exceptions
+    rb_iv_set(e, "bt", rb_vm_backtrace(0));
     return e;
 }