aboutsummaryrefslogtreecommitdiff
path: root/doc-tool/src/dotty/tools/dottydoc/model
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-01-16 19:08:57 +0100
committerFelix Mulder <felix.mulder@gmail.com>2017-01-31 14:32:37 +0100
commitab09530d350a2a7b2576d06a870082b975cf6c4f (patch)
treee4f3785d1584a9a4febde3616eb0a540783f0877 /doc-tool/src/dotty/tools/dottydoc/model
parent6f6dc9767badd4bcacd8f00ef0ed467bcabc6296 (diff)
downloaddotty-ab09530d350a2a7b2576d06a870082b975cf6c4f.tar.gz
dotty-ab09530d350a2a7b2576d06a870082b975cf6c4f.tar.bz2
dotty-ab09530d350a2a7b2576d06a870082b975cf6c4f.zip
Add `TypeAlias` to docs
Diffstat (limited to 'doc-tool/src/dotty/tools/dottydoc/model')
-rw-r--r--doc-tool/src/dotty/tools/dottydoc/model/entities.scala14
-rw-r--r--doc-tool/src/dotty/tools/dottydoc/model/internal.scala15
2 files changed, 23 insertions, 6 deletions
diff --git a/doc-tool/src/dotty/tools/dottydoc/model/entities.scala b/doc-tool/src/dotty/tools/dottydoc/model/entities.scala
index aea09f745..6f6e8d3e8 100644
--- a/doc-tool/src/dotty/tools/dottydoc/model/entities.scala
+++ b/doc-tool/src/dotty/tools/dottydoc/model/entities.scala
@@ -5,7 +5,7 @@ import comment._
import references._
import dotty.tools.dotc.core.Symbols.{ Symbol, NoSymbol }
-trait Entity {
+trait Entity { entity =>
def symbol: Symbol
def name: String
@@ -21,6 +21,12 @@ trait Entity {
def annotations: List[String]
+ def children: List[Entity with Members] = entity match {
+ case e: Entity with Members =>
+ e.members.collect { case e: Entity with Members if e.kind != "package" => e }
+ case _ => Nil
+ }
+
/** All parents from package level i.e. Package to Object to Member etc */
def parents: List[Entity] = parent match {
case NonEntity => Nil
@@ -72,8 +78,12 @@ trait ImplicitlyAddedEntity extends Entity {
trait Package extends Entity with Members {
val kind = "package"
+}
- def children: List[Entity with Members]
+trait TypeAlias extends Entity with Modifiers {
+ val kind = "type"
+ def alias: Option[Reference]
+ def isAbstract: Boolean = !alias.isDefined
}
trait Class extends Entity with Modifiers with TypeParams with Constructors with SuperTypes with Members {
diff --git a/doc-tool/src/dotty/tools/dottydoc/model/internal.scala b/doc-tool/src/dotty/tools/dottydoc/model/internal.scala
index 9787da7ce..dd592c2e1 100644
--- a/doc-tool/src/dotty/tools/dottydoc/model/internal.scala
+++ b/doc-tool/src/dotty/tools/dottydoc/model/internal.scala
@@ -18,10 +18,17 @@ object internal {
var members: List[Entity],
path: List[String],
var comment: Option[Comment] = None
- ) extends Package with Impl {
- def children: List[Entity with Members] =
- members.collect { case x: Entity with Members => x }
- }
+ ) extends Package with Impl
+
+ final case class TypeAliasImpl (
+ symbol: Symbol,
+ annotations: List[String],
+ modifiers: List[String],
+ name: String,
+ path: List[String],
+ alias: Option[Reference],
+ var comment: Option[Comment] = None
+ ) extends TypeAlias with Impl
final case class ClassImpl(
symbol: Symbol,