From ea840434d0f2b6127e0b7ee303605f87366e9e94 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 11 Nov 2009 04:31:43 +0000 Subject: [PATCH] I don't understand what the hell is wrong with Apple's compiler, but it does not consider an exception to exit a function. --- ObjectiveC/Library.mm | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 88c7426..1f2aea2 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -99,9 +99,10 @@ #define CYSadTry { \ @try -#define CYSadCatch \ +#define CYSadCatch(value) \ @catch (NSException *error ) { \ throw CYJSError(context, CYCastJSValue(context, error)); \ + return value; \ } \ } @@ -1322,11 +1323,11 @@ static SEL CYCastSEL(JSContextRef context, JSValueRef value) { void *CYObjectiveC_ExecuteStart(JSContextRef context) { CYSadTry { return (void *) [[NSAutoreleasePool alloc] init]; -} CYSadCatch } +} CYSadCatch(NULL) } void CYObjectiveC_ExecuteEnd(JSContextRef context, void *handle) { CYSadTry { return [(NSAutoreleasePool *) handle release]; -} CYSadCatch } +} CYSadCatch() } JSValueRef CYObjectiveC_RuntimeProperty(JSContextRef context, CYUTF8String name) { CYPoolTry { if (name == "nil") @@ -1338,7 +1339,7 @@ JSValueRef CYObjectiveC_RuntimeProperty(JSContextRef context, CYUTF8String name) static void CYObjectiveC_CallFunction(JSContextRef context, ffi_cif *cif, void (*function)(), uint8_t *value, void **values) { CYSadTry { ffi_call(cif, function, value, values); -} CYSadCatch } +} CYSadCatch() } static bool CYObjectiveC_PoolFFI(apr_pool_t *pool, JSContextRef context, sig::Type *type, ffi_type *ffi, void *data, JSValueRef value) { CYSadTry { switch (type->primitive) { @@ -1356,7 +1357,7 @@ static bool CYObjectiveC_PoolFFI(apr_pool_t *pool, JSContextRef context, sig::Ty } return true; -} CYSadCatch } +} CYSadCatch(false) } static JSValueRef CYObjectiveC_FromFFI(JSContextRef context, sig::Type *type, ffi_type *ffi, void *data, bool initialize, JSObjectRef owner) { CYPoolTry { switch (type->primitive) { -- 2.47.2