Build a C function name for the FFI implementation (uses friendly naming).

  • On a specific static receiver type recv_mtype
  • In referene to the module from_module (used for type resolving and as a possible prefix)
  • Has a possible suffix to the method name (may be "super", "impl", null, etc.)
  • With a specified length indicating whether it uses the sort name or the long name with the module name as prefix

Property definitions

nitc :: nitni_utilities $ MMethod :: build_cname
	# Build a C function name for the FFI implementation (uses friendly naming).
	# * On a specific static receiver type `recv_mtype`
	# * In referene to the module `from_module` (used for type resolving and as a possible prefix)
	# * Has a possible `suffix` to the method name (may be "__super", "__impl", null, etc.)
	# * With a specified length indicating whether it uses the sort name or the long name with
	#   the module name as prefix
	fun build_cname(recv_mtype: MClassType, from_mmodule: MModule, suffix: nullable String, length: SignatureLength): String
	do
		var cname
		if self.is_init then
			if self.name == "init" or self.name == "new" or self.name == "defaultinit" then
				cname = "new_{recv_mtype.mangled_cname}"
			else
				cname = "new_{recv_mtype.mangled_cname}_{self.short_cname}"
			end
		else
			cname = "{recv_mtype.mangled_cname}_{self.short_cname}"
		end

		if suffix != null then cname = "{cname}{suffix}"

		if length.long then cname = "{from_mmodule.c_name}___{cname}"

		return cname
	end
src/nitni/nitni_utilities.nit:21,2--45,4