Property definitions

nitc $ CmdParam :: defaultinit
# Retrieve all the mproperties using `mentity` as a type for its parameters
#
# `mentity` must be a MClass or a MClassDef.
class CmdParam
	super CmdEntityList

	redef fun init_results do
		if results != null then return new CmdSuccess

		var res = super
		if not res isa CmdSuccess then return res
		var mentity = self.mentity.as(not null)

		if mentity isa MClassDef then mentity = mentity.mclass
		if not mentity isa MClass then return new ErrorNotClass(mentity)

		var mentities = new HashSet[MEntity]
		for mproperty in model.collect_mproperties(filter) do
			if not mproperty isa MMethod then continue
			var msignature = mproperty.intro.msignature
			if msignature != null then
				for mparam in msignature.mparameters do
					var mtype = mparam.mtype
					if mtype isa MNullableType then mtype = mtype.mtype
					if not mtype isa MClassType then continue
					if mtype.mclass != mentity then continue
					mentities.add mproperty
				end
			end
		end
		results = mentities.to_a
		return res
	end
end
src/doc/commands/commands_usage.nit:21,1--54,3