refactored duplicated method copying implementation

This commit is contained in:
Daniel Stolzenberg
2010-10-26 14:11:47 +02:00
parent 9e1c07b195
commit c1e42a2f3e
+5 -15
View File
@@ -254,8 +254,11 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld,
kvoClass._replacedKeys = _replacedKeys;
//copy in the methods from our model subclass
var methodList = _CPKVOModelSubclass.method_list,
count = methodList.length,
var methodList = _CPKVOModelSubclass.method_list;
if ([_targetObject isKindOfClass:[CPDictionary class]])
methodList = methodList.concat(_CPKVOModelDictionarySubclass.method_list);
var count = methodList.length,
i = 0;
for (; i < count; i++)
@@ -264,19 +267,6 @@ var kvoNewAndOld = CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld,
class_addMethod(kvoClass, method_getName(method), method_getImplementation(method), "");
}
if ([_targetObject isKindOfClass:[CPDictionary class]])
{
var methodList = _CPKVOModelDictionarySubclass.method_list,
count = methodList.length,
i = 0;
for (; i < count; i++)
{
var method = methodList[i];
class_addMethod(kvoClass, method_getName(method), method_getImplementation(method), "");
}
}
_targetObject.isa = kvoClass;
}