save _replacedKeys on the class in stead of the object instance

reviewed: Ross
This commit is contained in:
Klaas Pieter Annema
2010-07-26 22:48:39 -07:00
committed by Ross Boucher
parent 51f780b5f5
commit ff8e5ae42e
+5 -1
View File
@@ -213,7 +213,6 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew|CPKeyValueObservingOptionOld,
_targetObject = aTarget;
_nativeClass = [aTarget class];
_replacedKeys = [CPSet set];
_observersForKey = {};
_changesForKey = {};
_observersForKeyLength = 0;
@@ -230,6 +229,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew|CPKeyValueObservingOptionOld,
if (existingKVOClass)
{
_targetObject.isa = existingKVOClass;
_replacedKeys = existingKVOClass._replacedKeys;
return;
}
@@ -237,6 +237,9 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew|CPKeyValueObservingOptionOld,
objj_registerClassPair(kvoClass);
_replacedKeys = [CPSet set];
kvoClass._replacedKeys = _replacedKeys;
//copy in the methods from our model subclass
var methodList = _CPKVOModelSubclass.method_list,
count = methodList.length,
@@ -293,6 +296,7 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew|CPKeyValueObservingOptionOld,
var theMethod = class_getInstanceMethod(_nativeClass, theSelector);
class_addMethod(_targetObject.isa, theSelector, theReplacementMethod(aKey, theMethod), "");
[_replacedKeys addObject:aKey];
}
}