From 53aadde3435fe2e99183563052e3a7fa0f9e41f2 Mon Sep 17 00:00:00 2001 From: Francisco Tolmasky Date: Sun, 15 Feb 2009 01:08:44 -0800 Subject: [PATCH] Added class_replaceMethod. Reviewed by me. --- Objective-J/runtime.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Objective-J/runtime.js b/Objective-J/runtime.js index e3abed19c..6649963c6 100644 --- a/Objective-J/runtime.js +++ b/Objective-J/runtime.js @@ -226,6 +226,22 @@ function class_copyMethodList(/*Class*/ aClass) return aClass.method_list.slice(0); } +function class_replaceMethod(/*Class*/ aClass, /*SEL*/ aSelector, /*IMP*/ aMethodImplementation) +{ + if (!aClass || !aSelector) + return NULL; + + var method = aClass.method_dtable[aSelector], + method_imp = NULL; + + if (method) + method_imp = method.method_imp; + + method.method_imp = aMethodImplementation; + + return method_imp; +} + var _class_initialize = function(/*Class*/ aClass) { var meta = GETMETA(aClass);