From 4696a5684cbfd4f601c05e02042a310e8bd7f9ba Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 8 Jan 2014 22:37:36 -0800 Subject: [PATCH] Split $objc_msgSend apart, normalizing exceptions. --- ObjectiveC/Library.mm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ObjectiveC/Library.mm b/ObjectiveC/Library.mm index 7c364ad..1e4fece 100644 --- a/ObjectiveC/Library.mm +++ b/ObjectiveC/Library.mm @@ -2284,7 +2284,7 @@ JSValueRef CYSendMessage(CYPool &pool, JSContextRef context, id self, Class _cla return CYCallFunction(pool, context, 2, setup, count, arguments, initialize, &signature, &cif, function); } -static JSValueRef $objc_msgSend(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry { +static JSValueRef $objc_msgSend(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[]) { if (count < 2) throw CYJSError(context, "too few arguments to objc_msgSend"); @@ -2320,6 +2320,10 @@ static JSValueRef $objc_msgSend(JSContextRef context, JSObjectRef object, JSObje _cmd = CYCastSEL(context, arguments[1]); return CYSendMessage(pool, context, self, _class, _cmd, count - 2, arguments + 2, uninitialized); +} + +static JSValueRef $objc_msgSend(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry { + return $objc_msgSend(context, object, _this, count, arguments); } CYCatch(NULL) } static JSValueRef Selector_callAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry { @@ -2327,7 +2331,7 @@ static JSValueRef Selector_callAsFunction(JSContextRef context, JSObjectRef obje setup[0] = _this; setup[1] = object; memcpy(setup + 2, arguments, sizeof(JSValueRef) * count); - return $objc_msgSend(context, NULL, NULL, count + 2, setup, exception); + return $objc_msgSend(context, NULL, NULL, count + 2, setup); } CYCatch(NULL) } static JSValueRef Message_callAsFunction(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry { -- 2.45.2