Revision
3078
Author
neeracher@apple.com
Date
2009-12-06 17:47:17 -0800 (Sun, 06 Dec 2009)

Log Message

Fix KVC bugs

Modified Paths

Removed Paths

Diff

Deleted: MacRuby/trunk/spec/macruby/tags/macruby/core/kvc_tags.txt (3077 => 3078)


--- MacRuby/trunk/spec/macruby/tags/macruby/core/kvc_tags.txt	2009-12-06 23:58:16 UTC (rev 3077)
+++ MacRuby/trunk/spec/macruby/tags/macruby/core/kvc_tags.txt	2009-12-07 01:47:17 UTC (rev 3078)
@@ -1,6 +0,0 @@
-fails:An ordered collection being accessed through NSKeyValueCoding can be manipulated through index accessors
-fails:An ordered collection being accessed through NSKeyValueCoding can be manipulated through index accessors (w/ replace)
-fails:An ordered collection being accessed through NSKeyValueCoding can be manipulated through index set accessors
-fails:An ordered collection being accessed through NSKeyValueCoding can be manipulated through index set accessors (w/ replace)
-fails:An unordered collection being accessed through NSKeyValueCoding can be manipulated through object accessors
-fails:An unordered collection being accessed through NSKeyValueCoding can be manipulated through set accessors

Modified: MacRuby/trunk/vm.cpp (3077 => 3078)


--- MacRuby/trunk/vm.cpp	2009-12-06 23:58:16 UTC (rev 3077)
+++ MacRuby/trunk/vm.cpp	2009-12-07 01:47:17 UTC (rev 3078)
@@ -1624,7 +1624,7 @@
     // ^#{begin}(.+)#{end}$ -> token
     const size_t begin_len = strlen(begin);
     const size_t end_len = strlen(end);
-    unsigned int token_beg = 0, token_end = 0;
+    unsigned int token_beg = 0, token_end = selsize;
     if (begin_len > 0) {
 	if (strncmp(selname, begin, begin_len) != 0 || selsize <= begin_len) {
 	    return false;
@@ -1646,11 +1646,14 @@
     memcpy(token, &selname[token_beg], token_len);
     token[token_len] = '\0';
 
+#if 1
     // token must start with a capital character.
+    return isupper(token[0]);
+#else
+    // token must start with a capital character.
     if (!isupper(token[0])) {
 	return false;
     }
-
     // Decapitalize the token and look if it's a valid KVO attribute.
     token[0] = tolower(token[0]);
     if (strchr(token, ':') != NULL) {
@@ -1658,6 +1661,7 @@
     }
     SEL sel = sel_registerName(token);
     return class_getInstanceMethod(klass, sel) != NULL;
+#endif
 }
 
 static inline void