Fix for minimizer not recognizing a var.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2008-11-13 00:40:40 -08:00
1 parent 7d8b02dd96
commit 1a8093c314
1 file changed
+12 -12
+12 -12
View File
@@ -448,11 +448,22 @@ var _CPKVOInfoMake = function _CPKVOInfoMake(anObserver, theOptions, aContext, a
};
}
var _kvoKeyForSetter = function _kvoKeyForSetter(selector)
{
if (selector.split(":").length > 2 || !([selector hasPrefix:@"set"] || [selector hasPrefix:@"_set"]))
return nil;
var keyIndex = selector.indexOf("set") + "set".length,
colonIndex = selector.indexOf(":");
return selector.charAt(keyIndex).toLowerCase() + selector.substring(keyIndex+1, colonIndex);
}
var _kvoMethodForMethod = function _kvoMethodForMethod(theObject, theMethod)
{
var methodName = theMethod.name,
methodImplementation = theMethod.method_imp,
setterKey = kvoKeyForSetter(methodName);
setterKey = _kvoKeyForSetter(methodName);
if (setterKey && objj_msgSend(theObject, @selector(automaticallyNotifiesObserversForKey:), setterKey))
{
@@ -469,17 +480,6 @@ var _kvoMethodForMethod = function _kvoMethodForMethod(theObject, theMethod)
return nil;
}
var kvoKeyForSetter = function kvoKeyForSetter(selector)
{
if (selector.split(":").length > 2 || !([selector hasPrefix:@"set"] || [selector hasPrefix:@"_set"]))
return nil;
var keyIndex = selector.indexOf("set") + "set".length,
colonIndex = selector.indexOf(":");
return selector.charAt(keyIndex).toLowerCase() + selector.substring(keyIndex+1, colonIndex);
}
@implementation CPArray (KeyValueObserving)
- (void)addObserver:(id)anObserver toObjectsAtIndexes:(CPIndexSet)indexes forKeyPath:(CPString)aKeyPath options:(unsigned)options context:(id)context