Revision
3706
Author
lsansonetti@apple.com
Date
2010-03-05 15:25:24 -0800 (Fri, 05 Mar 2010)

Log Message

fixed the #== optimization for strings

Modified Paths

Diff

Modified: MacRuby/branches/icu/dispatcher.cpp (3705 => 3706)


--- MacRuby/branches/icu/dispatcher.cpp	2010-03-05 12:05:52 UTC (rev 3705)
+++ MacRuby/branches/icu/dispatcher.cpp	2010-03-05 23:25:24 UTC (rev 3706)
@@ -1222,22 +1222,31 @@
 	    return self == other ? Qtrue : Qfalse;
 
 	case T_STRING:
+	    if (self == other) {
+		return Qtrue;
+	    }
+	    if (TYPE(other) != self_type) {
+		return Qfalse;
+	    }
+	    return rb_str_equal(self, other);
+
 	case T_ARRAY:
-	case T_HASH:
 	    if (self == other) {
 		return Qtrue;
 	    }
 	    if (TYPE(other) != self_type) {
 		return Qfalse;
 	    }
-	    if (self_type == T_ARRAY) {
-		return rb_ary_equal(self, other);
+	    return rb_ary_equal(self, other);
+
+	case T_HASH:
+	    if (self == other) {
+		return Qtrue;
 	    }
-	    if (self_type == T_HASH) {
-		return rb_hash_equal(self, other);
+	    if (TYPE(other) != self_type) {
+		return Qfalse;
 	    }
-	    return CFEqual((CFTypeRef)self, (CFTypeRef)other)
-		? Qtrue : Qfalse;
+	    return rb_hash_equal(self, other);
 
 	case T_BIGNUM:
 	    return rb_big_eq(self, other);