Property definitions

nitc $ ObjCLanguage :: defaultinit
# The Objective-C langugage visitor
class ObjCLanguage
	super FFILanguage

	redef fun identify_language(n) do return n.is_objc

	redef fun compile_module_block(block, ecc, mmodule)
	do
		if mmodule.objc_file == null then mmodule.objc_file = new ObjCCompilationUnit

		if block.is_objc_header then
			mmodule.objc_file.header_custom.add block.location.as_line_pragma
			mmodule.objc_file.header_custom.add block.code

			mmodule.has_public_objc_header = true
		else if block.is_objc_body then
			mmodule.objc_file.body_custom.add block.location.as_line_pragma
			mmodule.objc_file.body_custom.add block.code
		end
	end

	redef fun compile_extern_method(block, m, ecc, mmodule)
	do
		if mmodule.objc_file == null then mmodule.objc_file = new ObjCCompilationUnit

		var mpropdef = m.mpropdef
		var recv_mtype = mpropdef.mclassdef.bound_mtype
		var csignature = mpropdef.mproperty.build_csignature(
			recv_mtype, mmodule, "___impl", long_signature, from_objc_call_context)

		var fc = new CFunction(csignature)
		fc.decls.add block.location.as_line_pragma
		fc.exprs.add block.code
		mmodule.objc_file.add_exported_function fc
	end

	redef fun compile_extern_class(block, m, ecc, mmodule) do end

	redef fun get_ftype(block, m) do return new ForeignObjCType(block.code)

	redef fun compile_to_files(mmodule, compdir)
	do
		var objc_file = mmodule.objc_file
		assert objc_file != null

		# Import public Objective-C header of imported modules
		var dep = mmodule.objc_imported_headers
		for mod in dep do
			objc_file.header_custom.add "#include \"{mod.c_name}._ffi_m.h\"\n"
		end

		# write .m and _m.h file
		mmodule.objc_file.header_c_types.add """
	#include "{{{mmodule.c_name}}}._ffi.h"
"""

		var file = objc_file.write_to_files(mmodule, compdir)

		# add compilation to makefile
		mmodule.ffi_files.add file
	end

	redef fun compile_callback(callback, mmodule, mainmodule, ecc)
	do
		callback.compile_callback_to_objc(mmodule, mainmodule)
	end
end
src/ffi/objc.nit:58,1--124,3