Generate a super call from a method definition

Property definitions

nitc $ AbstractCompilerVisitor :: supercall
	# Generate a super call from a method definition
	fun supercall(m: MMethodDef, recvtype: MClassType, args: Array[RuntimeVariable]): nullable RuntimeVariable is abstract
src/compiler/abstract_compiler.nit:1479,2--1480,119

nitc $ SeparateCompilerVisitor :: supercall
	redef fun supercall(m: MMethodDef, recvtype: MClassType, arguments: Array[RuntimeVariable]): nullable RuntimeVariable
	do
		if arguments.first.mcasttype.is_c_primitive then
			# In order to shortcut the primitive, we need to find the most specific method
			# However, because of performance (no flattening), we always work on the realmainmodule
			var main = self.compiler.mainmodule
			self.compiler.mainmodule = self.compiler.realmainmodule
			var res = self.monomorphic_super_send(m, recvtype, arguments)
			self.compiler.mainmodule = main
			return res
		end
		return table_send(m.mproperty, arguments, m)
	end
src/compiler/separate_compiler.nit:1658,2--1670,4

nitc $ GlobalCompilerVisitor :: supercall
	redef fun supercall(m: MMethodDef, recvtype: MClassType, args: Array[RuntimeVariable]): nullable RuntimeVariable
	do
		var types = self.collect_types(args.first)

		var res: nullable RuntimeVariable
		var ret = m.mproperty.intro.msignature.return_mtype
		if ret == null then
			res = null
		else
			ret = self.resolve_for(ret, args.first)
			res = self.new_var(ret)
		end

		self.add("/* super {m} on {args.first.inspect} */")
		if args.first.mtype.is_c_primitive then
			var mclasstype = args.first.mtype.as(MClassType)
			if not self.compiler.runtime_type_analysis.live_types.has(mclasstype) then
				self.add("/* skip, no method {m} */")
				return res
			end
			var propdef = m.lookup_next_definition(self.compiler.mainmodule, mclasstype)
			var res2 = self.call(propdef, mclasstype, args)
			if res != null then self.assign(res, res2.as(not null))
			return res
		end

		if types.is_empty then
			self.add("\{")
			self.add("/*BUG: no live types for {args.first.inspect} . {m}*/")
			self.bugtype(args.first)
			self.add("\}")
			return res
		end

		self.add("switch({args.first}->classid) \{")
		var last = types.last
		for t in types do
			var propdef = m.lookup_next_definition(self.compiler.mainmodule, t)
			if not self.compiler.hardening and t == last then
				self.add("default: /* test {t} */")
			else
				self.add("case {self.compiler.classid(t)}: /* test {t} */")
			end
			var res2 = self.call(propdef, t, args)
			if res != null then self.assign(res, res2.as(not null))
			self.add "break;"
		end
		if self.compiler.hardening then
			self.add("default: /* bug */")
			self.bugtype(args.first)
		end
		self.add("\}")
		return res
	end
src/compiler/global_compiler.nit:638,2--691,4