From: Jay Freeman (saurik) Date: Tue, 11 Sep 2012 16:43:28 +0000 (-0700) Subject: Document a potential change to FunctionInstance. X-Git-Tag: v0.9.459~26 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/f5d7110cd00f0884abe200716a0958cc0af04783?ds=sidebyside Document a potential change to FunctionInstance. --- diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 4d51f29..b4e33c3 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -1871,6 +1871,11 @@ static JSValueRef Instance_callAsFunction(JSContextRef context, JSObjectRef obje if (![self isKindOfClass:NSBlock_]) CYThrow("non-NSBlock object is not a function"); + // XXX: replace above logic with the following assertion + //_assert([self isKindOfClass:NSBlock_]); + // to do this, make it so FunctionInstance_ is the class of blocks + // to do /that/, generalize the various "is exactly Instance_" checks + // then, move Instance_callAsFunction to only be on FunctionInstance struct BlockDescriptor1 { unsigned long int reserved; @@ -2566,15 +2571,15 @@ void CYObjectiveC_Initialize() { /*XXX*/ JSContextRef context(NULL); CYPoolTry { definition.className = "ArrayInstance"; ArrayInstance_ = JSClassCreate(&definition); - definition.className = "FunctionInstance"; - FunctionInstance_ = JSClassCreate(&definition); - definition.className = "ObjectInstance"; ObjectInstance_ = JSClassCreate(&definition); definition.className = "StringInstance"; StringInstance_ = JSClassCreate(&definition); + definition.className = "FunctionInstance"; + FunctionInstance_ = JSClassCreate(&definition); + definition = kJSClassDefinitionEmpty; definition.className = "Internal"; definition.staticFunctions = Internal_staticFunctions;