From: Alexis Laferrière Date: Thu, 15 Jan 2015 16:06:29 +0000 (-0500) Subject: ObjC FFI: use bridged cast to store Objective-C objects in pointers X-Git-Tag: v0.7.1~25^2~2 X-Git-Url: http://nitlanguage.org ObjC FFI: use bridged cast to store Objective-C objects in pointers Signed-off-by: Alexis Laferrière --- diff --git a/src/ffi/objc.nit b/src/ffi/objc.nit index 5c7eeeb..a804141 100644 --- a/src/ffi/objc.nit +++ b/src/ffi/objc.nit @@ -211,6 +211,13 @@ end private class FromObjCCallContext super ObjCCallContext + redef fun cast_to(mtype, name) + do + if mtype isa MClassType and mtype.mclass.ftype isa ForeignObjCType then + return "(__bridge void*)({name})" + else return name + end + redef fun cast_from(mtype, name) do if mtype isa MClassType and mtype.mclass.ftype isa ForeignObjCType then