- private fun classes_fulldoc(pager: Pager, mclasses: List[MClass]) do
- for mclass in mclasses do
- # title
- pager.add("# {mclass.namespace}\n".bold)
- # comment
- if mbuilder.mclassdef2nclassdef.has_key(mclass.intro) then
- var nclass = mbuilder.mclassdef2nclassdef[mclass.intro]
- if nclass isa AStdClassdef and not nclass.n_doc == null then
- for comment in nclass.n_doc.comment do pager.add(comment.green)
- end
- end
- pager.addn("{mclass.prototype}")
- if not mclass.in_hierarchy(mainmodule).direct_greaters.is_empty then
- var supers = mclass.in_hierarchy(mainmodule).direct_greaters.to_a
- pager.addn(" super ")
- for i in [0..supers.length[ do
- if supers[i] == mclass then continue
- pager.addn("{supers[i].name}{supers[i].signature}")
- if i < mclass.in_hierarchy(mainmodule).direct_greaters.length -1 then pager.addn(", ")
- end
- end
- pager.add("\n")
- # formal types
- if not mclass.parameter_types.is_empty then
- pager.add("## formal types".bold)
- for ft, bound in mclass.parameter_types do
- pager.add("")
- pager.add("\t{ft.to_s.green}: {bound.to_console}")
- end
- pager.add("")
- end
- # get properties
- var cats = new ArrayMap[String, Set[MPropDef]]
- cats["virtual types"] = new HashSet[MPropDef]
- cats["constructors"] = new HashSet[MPropDef]
- cats["introduced methods"] = new HashSet[MPropDef]
- cats["refined methods"] = new HashSet[MPropDef]
-
- for mclassdef in mclass.mclassdefs do
- for mpropdef in mclassdef.mpropdefs do
- if mpropdef isa MAttributeDef then continue
- if mpropdef isa MVirtualTypeDef then cats["virtual types"].add(mpropdef)
- if mpropdef isa MMethodDef then
- if mpropdef.mproperty.is_init then
- cats["constructors"].add(mpropdef)
- else if mpropdef.is_intro then
- cats["introduced methods"].add(mpropdef)
- else
- cats["refined methods"].add(mpropdef)
- end
- end
- end
- end
- # local mproperties
- for cat, list in cats do
- if not list.is_empty then
- #sort list
- var sorted = new Array[MPropDef]
- sorted.add_all(list)
- var sorter = new MPropDefNameSorter
- sorter.sort(sorted)
- pager.add("## {cat}".bold)
- for mpropdef in sorted do
- pager.add("")
- if mbuilder.mpropdef2npropdef.has_key(mpropdef) then
- var nprop = mbuilder.mpropdef2npropdef[mpropdef]
- if not nprop.n_doc == null and not nprop.n_doc.comment.is_empty then
- for comment in nprop.n_doc.comment do pager.add("\t{comment.green}")
- else
- nprop = mbuilder.mpropdef2npropdef[mpropdef.mproperty.intro]
- if not nprop.n_doc == null and not nprop.n_doc.comment.is_empty then
- for comment in nprop.n_doc.comment do pager.add("\t{comment.green}")
- end
- end
- end
- pager.add("\t{mpropdef.to_console}")
- mainmodule.linearize_mpropdefs(mpropdef.mproperty.mpropdefs)
- var previous_defs = new Array[MPropDef]
- for def in mpropdef.mproperty.mpropdefs do
- if def == mpropdef then continue
- if def.is_intro then continue
- if mclass.in_hierarchy(mainmodule) < def.mclassdef.mclass then
- previous_defs.add(def)
- end
- end
- if not mpropdef.is_intro then
- pager.add("\t\t" + "introduced by {mpropdef.mproperty.intro.mclassdef.namespace.bold}".gray)
- end
- if not previous_defs.is_empty then
- for def in previous_defs do pager.add("\t\t" + "inherited from {def.mclassdef.namespace.bold}".gray)
- end
- end
- pager.add("")
- end
- end
- # inherited mproperties
- var inhs = new ArrayMap[MClass, Array[MProperty]]
- var ancestors = mclass.in_hierarchy(mainmodule).greaters.to_a
- mainmodule.linearize_mclasses(ancestors)
- for a in ancestors do
- if a == mclass then continue
- for c in a.mclassdefs do
- for p in c.intro_mproperties do
- if p.intro_mclassdef == c then
- if not inhs.has_key(a) then inhs[a] = new Array[MProperty]
- inhs[a].add(p)
- end
- end
- end
- end
- if not inhs.is_empty then
- pager.add("## inherited properties".bold)
- for a, ps in inhs do
- pager.add("\n\tfrom {a.namespace.bold}: {ps.join(", ")}")
- end
- end
- pager.add_rule