nitlanguage
/
nit.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6efe665
)
ObjC FFI: use bridged cast to store Objective-C objects in pointers
author
Alexis Laferrière
<alexis.laf@xymus.net>
Thu, 15 Jan 2015 16:06:29 +0000
(11:06 -0500)
committer
Alexis Laferrière
<alexis.laf@xymus.net>
Fri, 16 Jan 2015 04:28:35 +0000
(23:28 -0500)
Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>
src/ffi/objc.nit
patch
|
blob
|
history
diff --git
a/src/ffi/objc.nit
b/src/ffi/objc.nit
index
5c7eeeb
..
a804141
100644
(file)
--- 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