How to cast a returned C variable named name of type mtype

Property definitions

nitc $ CallContext :: cast_from
	# How to cast a returned C variable named `name` of type `mtype`
	fun cast_from(mtype: MType, name: String): String do return name
src/nitni/nitni_utilities.nit:136,2--137,65

nitc $ ToJavaCallContext :: cast_from
	redef fun cast_from(mtype, name)
	do
		if mtype.java_is_nit_object then
			return "({mtype.cname})nit_ffi_with_java_nit_object_data(nit_ffi_jni_env, {name})"
		else
			return "({mtype.cname})({name})"
		end
	end
src/ffi/java.nit:456,2--463,4

nitc $ FromJavaCallContext :: cast_from
	redef fun cast_from(mtype, name)
	do
		if mtype.java_is_nit_object then
			return "nit_ffi_with_java_new_nit_object(nit_ffi_jni_env, {name})"
		else
			return "({mtype.jni_type})({name})"
		end
	end
src/ffi/java.nit:481,2--488,4

nitc $ FromCppCallContext :: cast_from
	redef fun cast_from(mtype, name)
	do
		if mtype isa MClassType and mtype.mclass.ftype isa ForeignCppType then
			return "static_cast<{name_mtype(mtype)}>({name})"
		else return name
	end
src/ffi/cpp.nit:246,2--251,4

nitc $ FromObjCCallContext :: cast_from
	redef fun cast_from(mtype, name)
	do
		if mtype isa MClassType and mtype.mclass.ftype isa ForeignObjCType then
			return "(__bridge {name_mtype(mtype)})({name})"
		else return name
	end
src/ffi/objc.nit:250,2--255,4