From: Jay Freeman (saurik) <saurik@saurik.com>
Date: Fri, 14 Sep 2012 05:47:42 +0000 (-0700)
Subject: Remove redundant implicit NSString length property.
X-Git-Tag: v0.9.460~24
X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/533acb3eaa6982c25ad1cd1e1b5d7a43037469bb

Remove redundant implicit NSString length property.
---

diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm
index 08fbf44..0c7712e 100644
--- a/ObjectiveC/Library.mm
+++ b/ObjectiveC/Library.mm
@@ -1045,9 +1045,6 @@ NSObject *CYCopyNSObject(apr_pool_t *pool, JSContextRef context, JSValueRef valu
 }
 
 - (bool) cy$hasProperty:(NSString *)name {
-    if ([name isEqualToString:@"length"])
-        return true;
-
     size_t index(CYGetIndex(name));
     if (index == _not(size_t) || index >= [self length])
         return [super cy$hasProperty:name];
@@ -1056,15 +1053,6 @@ NSObject *CYCopyNSObject(apr_pool_t *pool, JSContextRef context, JSValueRef valu
 }
 
 - (NSObject *) cy$getProperty:(NSString *)name {
-    if ([name isEqualToString:@"length"]) {
-        NSUInteger count([self length]);
-#ifdef __APPLE__
-        return [NSNumber numberWithUnsignedInteger:count];
-#else
-        return [NSNumber numberWithUnsignedInt:count];
-#endif
-    }
-
     size_t index(CYGetIndex(name));
     if (index == _not(size_t) || index >= [self length])
         return [super cy$getProperty:name];
@@ -1082,11 +1070,6 @@ NSObject *CYCopyNSObject(apr_pool_t *pool, JSContextRef context, JSValueRef valu
     }
 }
 
-// XXX: this might be overly restrictive for NSString; I think I need a half-way between /injecting/ implicit properties and /accepting/ implicit properties
-+ (bool) cy$hasImplicitProperties {
-    return false;
-}
-
 - (JSValueRef) cy$valueOfInContext:(JSContextRef)context { CYObjectiveTry_(context) {
     return CYCastJSValue(context, CYJSString(context, self));
 } CYObjectiveCatch }