From: Jay Freeman (saurik) Date: Sun, 1 Nov 2009 00:26:39 +0000 (+0000) Subject: Fixed exception support from Objective-C back to Cycript. X-Git-Tag: v0.9.432~211 X-Git-Url: https://git.saurik.com/cycript.git/commitdiff_plain/f0d43c71af44d8fc68afcbac718ed9f324c8a2c4?ds=inline Fixed exception support from Objective-C back to Cycript. --- diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 83e4776..66ebc41 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -1241,19 +1241,19 @@ void CYObjectiveC_ExecuteEnd(JSContextRef context, void *handle) { return [(NSAutoreleasePool *) handle release]; } -JSValueRef CYObjectiveC_RuntimeProperty(JSContextRef context, CYUTF8String name) { CYObjectiveTry_(context) { +JSValueRef CYObjectiveC_RuntimeProperty(JSContextRef context, CYUTF8String name) { CYPoolTry { if (name == "nil") return Instance::Make(context, nil); if (Class _class = objc_getClass(name.data)) return CYMakeInstance(context, _class, true); return NULL; -} CYObjectiveCatch } +} CYPoolCatch(NULL) } -static void CYObjectiveC_CallFunction(JSContextRef context, ffi_cif *cif, void (*function)(), uint8_t *value, void **values) { CYObjectiveTry_(context) { +static void CYObjectiveC_CallFunction(JSContextRef context, ffi_cif *cif, void (*function)(), uint8_t *value, void **values) { CYPoolTry { ffi_call(cif, function, value, values); -} CYObjectiveCatch } +} CYPoolCatch() } -static bool CYObjectiveC_PoolFFI(apr_pool_t *pool, JSContextRef context, sig::Type *type, ffi_type *ffi, void *data, JSValueRef value) { CYObjectiveTry_(context) { +static bool CYObjectiveC_PoolFFI(apr_pool_t *pool, JSContextRef context, sig::Type *type, ffi_type *ffi, void *data, JSValueRef value) { CYPoolTry { switch (type->primitive) { case sig::object_P: case sig::typename_P: @@ -1269,9 +1269,9 @@ static bool CYObjectiveC_PoolFFI(apr_pool_t *pool, JSContextRef context, sig::Ty } return true; -} CYObjectiveCatch } +} CYPoolCatch(false) } -static JSValueRef CYObjectiveC_FromFFI(JSContextRef context, sig::Type *type, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) { CYObjectiveTry_(context) { +static JSValueRef CYObjectiveC_FromFFI(JSContextRef context, sig::Type *type, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) { CYPoolTry { switch (type->primitive) { case sig::object_P: if (id object = *reinterpret_cast(data)) { @@ -1294,7 +1294,7 @@ static JSValueRef CYObjectiveC_FromFFI(JSContextRef context, sig::Type *type, ff default: return NULL; } -} CYObjectiveCatch } +} CYPoolCatch(NULL) } static bool CYImplements(id object, Class _class, SEL selector, bool devoid) { if (objc_method *method = class_getInstanceMethod(_class, selector)) {