#define CYCatch_(value, name) \
catch (const CYException &error) { \
*exception = error.CastJSValue(context, name); \
+ _assert(*exception != NULL); \
return value; \
} catch (...) { \
*exception = CYCastJSValue(context, "catch(...)"); \
+ _assert(*exception != NULL); \
return value; \
}
#define CYCatch(value) \
CYCatch_(value, "Error")
+#define CYCatchObject() \
+ CYCatch(JSObjectMake(context, NULL, NULL))
#define _assert_(mode, test, code, format, ...) do \
if (!(test)) \
static JSObjectRef CArray_new(JSContextRef context, JSObjectRef object, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
_assert(false);
-} CYCatch(NULL) }
+} CYCatchObject() }
static JSObjectRef CString_new(JSContextRef context, JSObjectRef object, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
_assert(false);
-} CYCatch(NULL) }
+} CYCatchObject() }
static JSObjectRef Pointer_new(JSContextRef context, JSObjectRef object, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
_assert(false);
-} CYCatch(NULL) }
+} CYCatchObject() }
static JSObjectRef Type_new(JSContextRef context, JSObjectRef object, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
CYPool pool;
} else {
throw CYJSError(context, "incorrect number of arguments to Type constructor");
}
-} CYCatch(NULL) }
+} CYCatchObject() }
static JSValueRef Type_callAsFunction_$With(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], sig::Callable &type, JSValueRef *exception) { CYTry {
Type_privateData *internal(reinterpret_cast<Type_privateData *>(JSObjectGetPrivate(_this)));
type->PoolFFI(value->pool_, context, ffi, value->value_, arguments[0]);
return pointer;
-} CYCatch(NULL) }
+} CYCatchObject() }
// XXX: I don't even think the user should be allowed to do this
static JSObjectRef Functor_new(JSContextRef context, JSObjectRef object, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
sig::Parse(pool, &signature, encoding, &Structor_);
// XXX: this can try to return null, and I guess then it just fails
return CYCastJSObject(context, CYMakeFunctor(context, arguments[0], false, signature));
-} CYCatch(NULL) }
+} CYCatchObject() }
static JSValueRef CArray_callAsFunction_toPointer(JSContextRef context, JSObjectRef object, JSObjectRef _this, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
CArray *internal(reinterpret_cast<CArray *>(JSObjectGetPrivate(_this)));
}
CYThrow("invalid constructor call");
-} CYCatch(NULL) }
+} CYCatchObject() }
static bool JavaStaticInterior_hasProperty(JSContextRef context, JSObjectRef object, JSStringRef property) {
auto internal(CYPrivate<CYJavaStaticInterior>::Get(context, object));
values(CYCastJSValue(context, CYJSString(pool.strcat(name, "()", NULL))));
}));
} return array;
-} CYCatch(NULL) }
+} CYCatchObject() }
static JSObjectRef Constructor_callAsConstructor(JSContextRef context, JSObjectRef object, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
auto internal(CYPrivate<Constructor>::Get(context, object));
JSObjectRef value(CYMakeInstance(context, [internal->value_ alloc], Instance::Uninitialized));
return value;
-} CYCatch(NULL) }
+} CYCatchObject() }
static const char *CYBlockEncoding(NSBlock *self) {
BlockLiteral *literal(reinterpret_cast<BlockLiteral *>(self));
id self(CYCastNSObject(&pool, context, arguments[0]));
Class _class(CYCastClass(pool, context, arguments[1]));
return CYPrivate<cy::Super>::Make(context, self, _class);
-} CYCatch(NULL) }
+} CYCatchObject() }
static JSObjectRef Selector_new(JSContextRef context, JSObjectRef object, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
if (count != 1)
CYPool pool;
const char *name(CYPoolCString(pool, context, arguments[0]));
return CYPrivate<Selector_privateData>::Make(context, sel_registerName(name));
-} CYCatch(NULL) }
+} CYCatchObject() }
static JSObjectRef Instance_new(JSContextRef context, JSObjectRef object, size_t count, const JSValueRef arguments[], JSValueRef *exception) { CYTry {
if (count != 1)
throw CYJSError(context, "incorrect number of arguments to Instance constructor");
return CYMakeInstance(context, CYCastPointer<id>(context, arguments[0]));
-} CYCatch(NULL) }
+} CYCatchObject() }
static JSValueRef Selector_getProperty_$cyt(JSContextRef context, JSObjectRef object, JSStringRef property, JSValueRef *exception) { CYTry {
return CYMakeType(context, sig::Selector());