The single mmethodef called in case of monomorphism.

Returns nul if dead or polymorphic.

Property definitions

nitc $ SeparateCompiler :: is_monomorphic
	# The single mmethodef called in case of monomorphism.
	# Returns nul if dead or polymorphic.
	fun is_monomorphic(m: MMethod): nullable MMethodDef
	do
		var rta = runtime_type_analysis
		if rta == null then
			# Without RTA, monomorphic means alone (uniq name)
			if m.mpropdefs.length == 1 then
				return m.mpropdefs.first
			else
				return null
			end
		else
			# With RTA, monomorphic means only live methoddef
			var res: nullable MMethodDef = null
			for md in m.mpropdefs do
				if rta.live_methoddefs.has(md) then
					if res != null then return null
					res = md
				end
			end
			return res
		end
	end
src/compiler/separate_compiler.nit:696,2--719,4