Revision
3494
Author
neeracher@apple.com
Date
2010-02-11 14:58:01 -0800 (Thu, 11 Feb 2010)

Log Message

make sure -copy can be sent to instances of hidden NSString subclasses (immutable equivalent to r3477)

Modified Paths

Diff

Modified: MacRuby/trunk/string.c (3493 => 3494)


--- MacRuby/trunk/string.c	2010-02-11 22:32:23 UTC (rev 3493)
+++ MacRuby/trunk/string.c	2010-02-11 22:58:01 UTC (rev 3494)
@@ -5261,6 +5261,16 @@
 }
 
 static void *
+imp_rb_str_copy(void *rcv, SEL sel)
+{
+    void *dup;
+    PREPARE_RCV(rcv);
+    dup = (void *)objc_msgSend(rcv, selCopy);
+    RESTORE_RCV(rcv);
+    return dup;
+}
+
+static void *
 imp_rb_str_mutableCopy(void *rcv, SEL sel)
 {
     void *dup;
@@ -5285,6 +5295,7 @@
     rb_objc_install_method2(klass, "_fastestEncodingInCFStringEncoding",
 	(IMP)imp_rb_str_fastestEncodingInCFStringEncoding);
     rb_objc_install_method2(klass, "isEqual:", (IMP)imp_rb_str_isEqual);
+    rb_objc_install_method2(klass, "copy", (IMP)imp_rb_str_copy);
     rb_objc_install_method2(klass, "mutableCopy", (IMP)imp_rb_str_mutableCopy);
 
     const bool mutable = class_getSuperclass(klass)