nitc :: CmdNew :: defaultinit
# Retrieve all the mproperties that initialize `mentity`
#
# `mentity` must be a MClass or a MClassDef.
class CmdNew
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 MClassDef then mentity = mentity.mclass
if not mentity isa MClass then return new ErrorNotClass(mentity)
var mentities = new HashSet[MEntity]
for mpropdef in model.collect_mpropdefs(filter) do
var visitor = new TypeInitVisitor(mentity)
var npropdef = modelbuilder.mpropdef2node(mpropdef)
if npropdef == null then continue
visitor.enter_visit(npropdef)
if visitor.called then
mentities.add mpropdef
end
end
results = mentities.to_a
return res
end
end
src/doc/commands/commands_usage.nit:90,1--124,3