aboutsummaryrefslogtreecommitdiff
path: root/doc-tool/src/dotty/tools/dottydoc/core/SortMembersPhase.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-01-17 16:20:17 +0100
committerFelix Mulder <felix.mulder@gmail.com>2017-01-31 14:32:39 +0100
commit637c888b8fad660464fc1b35d40279c3482cab65 (patch)
tree3502666c4a0eb5a07d24aee9870c4468384256fc /doc-tool/src/dotty/tools/dottydoc/core/SortMembersPhase.scala
parente77fe63f98099caca481f74f3613c5814fff3020 (diff)
downloaddotty-637c888b8fad660464fc1b35d40279c3482cab65.tar.gz
dotty-637c888b8fad660464fc1b35d40279c3482cab65.tar.bz2
dotty-637c888b8fad660464fc1b35d40279c3482cab65.zip
Add `genDocs` command to sbt in order to generate docs
Diffstat (limited to 'doc-tool/src/dotty/tools/dottydoc/core/SortMembersPhase.scala')
-rw-r--r--doc-tool/src/dotty/tools/dottydoc/core/SortMembersPhase.scala10
1 files changed, 9 insertions, 1 deletions
diff --git a/doc-tool/src/dotty/tools/dottydoc/core/SortMembersPhase.scala b/doc-tool/src/dotty/tools/dottydoc/core/SortMembersPhase.scala
index 29898b140..a281558d4 100644
--- a/doc-tool/src/dotty/tools/dottydoc/core/SortMembersPhase.scala
+++ b/doc-tool/src/dotty/tools/dottydoc/core/SortMembersPhase.scala
@@ -10,9 +10,17 @@ import model.internal._
/** This DocMiniPhase sorts the members of all classes, traits, objects and packages */
class SortMembers extends DocMiniPhase {
+ private implicit val EntityOrdering: Ordering[Entity] = new Ordering[Entity] {
+ def compare(x: Entity, y: Entity): Int = {
+ val nameComp = x.name.compareTo(y.name)
+ if (nameComp == 0) x.kind.compareTo(y.kind)
+ else nameComp
+ }
+ }
+
private def sort(xs: List[Entity]): List[Entity] = {
def sortOrNil(xs: Option[List[Entity]]*) =
- xs.map(_.getOrElse(Nil)).reduceLeft(_ ++ _).sortBy(_.name)
+ xs.map(_.getOrElse(Nil)).reduceLeft(_ ++ _).sorted
val map = xs.groupBy(_.kind)