diff options
author | Paul Phillips <paulp@improving.org> | 2011-03-29 18:41:08 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-03-29 18:41:08 +0000 |
commit | 1caac54694602ad5ae48c3cbb8394b7263b132e4 (patch) | |
tree | 0bc088a7c6c971bc1c0b58fd8ffdcee9cfe77054 /src/compiler | |
parent | 71d2aba0428541d4109ec3c34b479fe69ebb2205 (diff) | |
download | scala-1caac54694602ad5ae48c3cbb8394b7263b132e4.tar.gz scala-1caac54694602ad5ae48c3cbb8394b7263b132e4.tar.bz2 scala-1caac54694602ad5ae48c3cbb8394b7263b132e4.zip |
A bunch of scaladoc cleanups.
the wrong places, tags saying the wrong thing. I sorted types and values
so deprecated ones are at the end. I think they should be hidden by
default, but this is a big improvement. Leaving #3914 open so they can
be made invisible. No review.
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/html/page/Template.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/doc/model/Entity.scala | 15 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala index ac33e66a35..8b6564c27c 100644 --- a/src/compiler/scala/tools/nsc/doc/html/page/Template.scala +++ b/src/compiler/scala/tools/nsc/doc/html/page/Template.scala @@ -29,15 +29,15 @@ class Template(tpl: DocTemplateEntity) extends HtmlPage { </xml:group> val valueMembers = - (tpl.methods ::: tpl.values ::: (tpl.templates filter { tpl => tpl.isObject || tpl.isPackage })) sortBy (_.name) + tpl.methods ++ tpl.values ++ tpl.templates.filter(x => x.isObject || x.isPackage) sorted val typeMembers = - (tpl.abstractTypes ::: tpl.aliasTypes ::: (tpl.templates filter { tpl => tpl.isTrait || tpl.isClass })) sortBy (_.name) + tpl.abstractTypes ++ tpl.aliasTypes ++ tpl.templates.filter(x => x.isTrait || x.isClass) sorted val constructors = (tpl match { - case cls: Class => cls.constructors + case cls: Class => (cls.constructors: List[MemberEntity]).sorted case _ => Nil - }) sortBy (_.name) + }) /* for body, there is a special case for AnyRef, otherwise AnyRef appears like a package/object * this problem should be fixed, this implementation is just a patch diff --git a/src/compiler/scala/tools/nsc/doc/model/Entity.scala b/src/compiler/scala/tools/nsc/doc/model/Entity.scala index 37485bccab..4fb0341684 100644 --- a/src/compiler/scala/tools/nsc/doc/model/Entity.scala +++ b/src/compiler/scala/tools/nsc/doc/model/Entity.scala @@ -50,6 +50,15 @@ trait Entity { } +object Entity { + private def isDeprecated(x: Entity) = x match { + case x: MemberEntity => x.deprecation.isDefined + case _ => false + } + /** Ordering deprecated things last. */ + implicit lazy val EntityOrdering: Ordering[Entity] = + Ordering[(Boolean, String)] on (x => (isDeprecated(x), x.name)) +} /** A template, which is either a class, trait, object or package. Depending on whether documentation is available * or not, the template will be modeled as a [scala.tools.nsc.doc.model.NoDocTemplate] or a @@ -156,7 +165,11 @@ trait MemberEntity extends Entity { def isAbstract: Boolean } - +object MemberEntity { + // Oh contravariance, contravariance, wherefore art thou contravariance? + // Note: the above works for both the commonly misunderstood meaning of the line and the real one. + implicit lazy val MemberEntityOrdering: Ordering[MemberEntity] = Entity.EntityOrdering on (x => x) +} /** An entity that is parameterized by types */ trait HigherKinded extends Entity { |