nitc :: CmdCall :: defaultinit
# Retrieve all the mproperties that call `mentity`
#
# `mentity` must be a MProperty or a MPropDef.
class CmdCall
super CmdEntityList
autoinit(model, modelbuilder, filter, mentity, mentity_name, limit, page, count, max)
# ModelBuilder used to retrieve AST nodes
var modelbuilder: ModelBuilder
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 MPropDef then mentity = mentity.mproperty
if not mentity isa MProperty then return new ErrorNotProperty(mentity)
var mentities = new HashSet[MEntity]
for mpropdef in model.collect_mpropdefs(filter) do
if mpropdef.mproperty == mentity then continue
var visitor = new MPropertyCallVisitor
var npropdef = modelbuilder.mpropdef2node(mpropdef)
if npropdef == null then continue
visitor.enter_visit(npropdef)
if visitor.calls.has(mentity) then
mentities.add mpropdef
end
end
results = mentities.to_a
return res
end
end
src/doc/commands/commands_usage.nit:126,1--161,3