aboutsummaryrefslogtreecommitdiff
path: root/doc-tool/src/dotty/tools/dottydoc/model
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-01-31 14:24:41 +0100
committerFelix Mulder <felix.mulder@gmail.com>2017-01-31 14:35:43 +0100
commit1fe56e16de74c4c90eec5a4c411ba0b1adde0ee2 (patch)
tree5758270b371391746dcc7171d519d68f0c83f588 /doc-tool/src/dotty/tools/dottydoc/model
parentfef1af300edfa0697f9d8f749a5c9398f209bf36 (diff)
downloaddotty-1fe56e16de74c4c90eec5a4c411ba0b1adde0ee2.tar.gz
dotty-1fe56e16de74c4c90eec5a4c411ba0b1adde0ee2.tar.bz2
dotty-1fe56e16de74c4c90eec5a4c411ba0b1adde0ee2.zip
Fix `setParent` for `TypeAlias` and only recurse from root
Previously all packages would be iterated through on `setParent`. With this change, only the root packages will be mutated. This gives about 30% speedup for doc compile on Dotty
Diffstat (limited to 'doc-tool/src/dotty/tools/dottydoc/model')
-rw-r--r--doc-tool/src/dotty/tools/dottydoc/model/references.scala11
1 files changed, 10 insertions, 1 deletions
diff --git a/doc-tool/src/dotty/tools/dottydoc/model/references.scala b/doc-tool/src/dotty/tools/dottydoc/model/references.scala
index 02304b302..a103347c1 100644
--- a/doc-tool/src/dotty/tools/dottydoc/model/references.scala
+++ b/doc-tool/src/dotty/tools/dottydoc/model/references.scala
@@ -16,7 +16,16 @@ object references {
/** Use MaterializableLink for entities that need be picklable */
sealed trait MaterializableLink { def title: String }
final case class UnsetLink(title: String, query: String) extends MaterializableLink
- final case class MaterializedLink(title: String, target: String) extends MaterializableLink
+ final case class MaterializedLink(title: String, target: String) extends MaterializableLink {
+ def this(title: String, target: Entity) = this(title, target match {
+ case target: Package =>
+ target.path.mkString("/") + "/index.html"
+ case _: TypeAlias | _: Def | _: Val =>
+ target.parent.path.mkString("/") + ".html#" + target.signature
+ case _ =>
+ target.path.mkString("/") + ".html"
+ })
+ }
final case class NoLink(title: String, target: String) extends MaterializableLink
object AndOrTypeReference {