From e4ecaa0d977661954a7c686e3fe8eca2d71dba82 Mon Sep 17 00:00:00 2001 From: Felix Mulder Date: Wed, 18 Jan 2017 17:45:42 +0100 Subject: Harmonize package objects and packages in Doc AST --- doc-tool/src/dotty/tools/dottydoc/model/entities.scala | 2 +- doc-tool/src/dotty/tools/dottydoc/model/internal.scala | 1 + doc-tool/src/dotty/tools/dottydoc/model/java.scala | 3 +++ doc-tool/src/dotty/tools/dottydoc/model/json.scala | 1 + doc-tool/src/dotty/tools/dottydoc/model/references.scala | 1 + 5 files changed, 7 insertions(+), 1 deletion(-) (limited to 'doc-tool/src/dotty/tools/dottydoc/model') diff --git a/doc-tool/src/dotty/tools/dottydoc/model/entities.scala b/doc-tool/src/dotty/tools/dottydoc/model/entities.scala index a40666e0d..613788964 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/entities.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/entities.scala @@ -84,7 +84,7 @@ trait ImplicitlyAddedEntity extends Entity { def implicitlyAddedFrom: Option[Reference] } -trait Package extends Entity with Members { +trait Package extends Entity with Members with SuperTypes { val kind = "package" } diff --git a/doc-tool/src/dotty/tools/dottydoc/model/internal.scala b/doc-tool/src/dotty/tools/dottydoc/model/internal.scala index 5bc410706..ac789f29f 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/internal.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/internal.scala @@ -17,6 +17,7 @@ object internal { name: String, var members: List[Entity], path: List[String], + superTypes: List[MaterializableLink] = Nil, var comment: Option[Comment] = None ) extends Package with Impl diff --git a/doc-tool/src/dotty/tools/dottydoc/model/java.scala b/doc-tool/src/dotty/tools/dottydoc/model/java.scala index 8e493f889..189012e18 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/java.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/java.scala @@ -52,6 +52,7 @@ object java { "path" -> ent.path.asJava, "members" -> ent.members.map(_.asJava()).asJava, "comment" -> ent.comment.map(_.asJava).asJava, + "superTypes" -> ent.superTypes, "hasVisibleMembers" -> ent.hasVisibleMembers ) ++ extras).asJava } @@ -234,6 +235,8 @@ object java { "title" -> title, "scala" -> ref ).asJava + + case EmptyReference => ??? } } diff --git a/doc-tool/src/dotty/tools/dottydoc/model/json.scala b/doc-tool/src/dotty/tools/dottydoc/model/json.scala index 145728f8a..766f0c147 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/json.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/json.scala @@ -63,6 +63,7 @@ object json { s"""{"args":${ref.args.map(refToJson).mkString("[",",","]")},"returnValue":${refToJson(ref.returnValue)},"kind": "FunctionReference"}""" case ref: TupleReference => s"""{"args":${ref.args.map(refToJson).mkString("[",",","]")},"kind": "TupleReference"}""" + case EmptyReference => ??? } implicit class ReferenceJson(val ref: Reference) extends AnyVal { def json: String = refToJson(ref) } diff --git a/doc-tool/src/dotty/tools/dottydoc/model/references.scala b/doc-tool/src/dotty/tools/dottydoc/model/references.scala index 766b2a340..02304b302 100644 --- a/doc-tool/src/dotty/tools/dottydoc/model/references.scala +++ b/doc-tool/src/dotty/tools/dottydoc/model/references.scala @@ -11,6 +11,7 @@ object references { final case class BoundsReference(low: Reference, high: Reference) extends Reference final case class NamedReference(title: String, ref: Reference, isByName: Boolean = false, isRepeated: Boolean = false) extends Reference final case class ConstantReference(title: String) extends Reference + final case object EmptyReference extends Reference /** Use MaterializableLink for entities that need be picklable */ sealed trait MaterializableLink { def title: String } -- cgit v1.2.3