aboutsummaryrefslogtreecommitdiff
path: root/dottydoc/jvm/src/dotty/tools/dottydoc/model
diff options
context:
space:
mode:
Diffstat (limited to 'dottydoc/jvm/src/dotty/tools/dottydoc/model')
-rw-r--r--dottydoc/jvm/src/dotty/tools/dottydoc/model/entities.scala4
-rw-r--r--dottydoc/jvm/src/dotty/tools/dottydoc/model/factories.scala19
-rw-r--r--dottydoc/jvm/src/dotty/tools/dottydoc/model/internal.scala6
-rw-r--r--dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala4
4 files changed, 11 insertions, 22 deletions
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/model/entities.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/model/entities.scala
index 391bd514f..16d05306e 100644
--- a/dottydoc/jvm/src/dotty/tools/dottydoc/model/entities.scala
+++ b/dottydoc/jvm/src/dotty/tools/dottydoc/model/entities.scala
@@ -79,12 +79,14 @@ trait Object extends Entity with Modifiers with SuperTypes with Members {
}
trait Def extends Entity with Modifiers with TypeParams with ReturnValue {
- def paramLists: List[ParamList]
val kind = "def"
+ def paramLists: List[ParamList]
+ def implicitlyAddedFrom: Option[Reference]
}
trait Val extends Entity with Modifiers with ReturnValue {
val kind = "val"
+ def implicitlyAddedFrom: Option[Reference]
}
trait Var extends Entity with Modifiers with ReturnValue {
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/model/factories.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/model/factories.scala
index f0c78fa41..4d80c08a9 100644
--- a/dottydoc/jvm/src/dotty/tools/dottydoc/model/factories.scala
+++ b/dottydoc/jvm/src/dotty/tools/dottydoc/model/factories.scala
@@ -29,26 +29,11 @@ object factories {
def path(sym: Symbol)(implicit ctx: Context): List[String] = sym match {
case sym if sym.name.decode.toString == "<root>" => Nil
- case sym if sym is Flags.Module => path(sym.owner) :+ sym.name.decode.toString.dropRight(1)
- case sym => path(sym.owner) :+ sym.name.decode.toString
+ case sym => path(sym.owner) :+ sym.name.show
}
private val product = """Product[1-9][0-9]*""".r
- private def cleanTitle(title: String): String = title match {
- // matches Entity.this.Something
- case x if x matches "[^\\[]+\\.this\\..+" => x.split("\\.").last
- // Matches Entity[P, ...]
- case x if x matches "[^\\[]+\\[[^\\]]+\\]" =>
- val Array(tpe, params) = x.dropRight(1).split("\\[")
- s"""$tpe[${params.split(",").map(x => cleanTitle(x.trim)).mkString(", ")}]"""
- case _ => title
- }
-
- private def cleanQuery(query: String): String = query match {
- case x if x matches "[^\\[]+\\[[^\\]]+\\]" => x.takeWhile(_ != '[')
- case _ => query
- }
def returnType(t: Type)(implicit ctx: Context): Reference = {
val defn = ctx.definitions
@@ -107,7 +92,7 @@ object factories {
case tt: ThisType =>
expandTpe(tt.underlying)
case ci: ClassInfo =>
- typeRef(ci.cls.show)
+ typeRef(ci.cls.name.show)
case mt: MethodType =>
expandTpe(mt.resultType)
case pt: PolyType =>
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/model/internal.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/model/internal.scala
index ec1adfa88..a8756c82a 100644
--- a/dottydoc/jvm/src/dotty/tools/dottydoc/model/internal.scala
+++ b/dottydoc/jvm/src/dotty/tools/dottydoc/model/internal.scala
@@ -65,7 +65,8 @@ object internal {
var returnValue: Reference,
var typeParams: List[String] = Nil,
var paramLists: List[ParamList] = Nil,
- var comment: Option[Comment] = None
+ var comment: Option[Comment] = None,
+ implicitlyAddedFrom: Option[Reference] = None
) extends Def with Impl
final case class ValImpl(
@@ -73,7 +74,8 @@ object internal {
modifiers: List[String],
path: List[String],
var returnValue: Reference,
- var comment: Option[Comment] = None
+ var comment: Option[Comment] = None,
+ implicitlyAddedFrom: Option[Reference] = None
) extends Val with Impl
final case class ParamListImpl(
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala
index ea9658b5d..f83f43138 100644
--- a/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala
+++ b/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala
@@ -76,9 +76,9 @@ object json {
case ent: Object =>
s"""{"name":${ent.name.json},"members":${ent.members.map(_.json).mkString("[",",","]")},"modifiers":${ent.modifiers.map(_.json).mkString("[",",","]")},"path":${ent.path.map(_.json).mkString("[",",","]")},"superTypes":${ent.superTypes.map(_.json).mkString("[",",","]")},${ent.comment.map(_.json).fold("")(cmt => s""""comment":$cmt,""")}"kind":"object"}"""
case ent: Def =>
- s"""{"name":${ent.name.json},"modifiers":${ent.modifiers.map(_.json).mkString("[",",","]")},"path":${ent.path.map(_.json).mkString("[",",","]")},"returnValue":${ent.returnValue.json},"typeParams":${ent.typeParams.map(_.json).mkString("[",",","]")},"paramLists":${ent.paramLists.map(_.json).mkString("[",",","]")},${ent.comment.map(_.json).fold("")(cmt => s""""comment":$cmt,""")}"kind":"def"}"""
+ s"""{"name":${ent.name.json},"modifiers":${ent.modifiers.map(_.json).mkString("[",",","]")},"path":${ent.path.map(_.json).mkString("[",",","]")},"returnValue":${ent.returnValue.json},"typeParams":${ent.typeParams.map(_.json).mkString("[",",","]")},"paramLists":${ent.paramLists.map(_.json).mkString("[",",","]")},${ent.comment.map(_.json).fold("")(cmt => s""""comment":$cmt,""")}${ent.implicitlyAddedFrom.fold("")(ref => s""""implicitlyAddedFrom":${ref.json},""")}"kind":"def"}"""
case ent: Val =>
- s"""{"name":${ent.name.json},"modifiers":${ent.modifiers.map(_.json).mkString("[",",","]")},"path":${ent.path.map(_.json).mkString("[",",","]")},"returnValue":${ent.returnValue.json},${ent.comment.map(_.json).fold("")(cmt => s""""comment":$cmt,""")}"kind":"val"}"""
+ s"""{"name":${ent.name.json},"modifiers":${ent.modifiers.map(_.json).mkString("[",",","]")},"path":${ent.path.map(_.json).mkString("[",",","]")},"returnValue":${ent.returnValue.json},${ent.comment.map(_.json).fold("")(cmt => s""""comment":$cmt,""")}${ent.implicitlyAddedFrom.fold("")(ref => s""""implicitlyAddedFrom":${ref.json},""")}"kind":"val"}"""
}
implicit class EntityJson(val ent: Entity) extends AnyVal { def json: String = entToJson(ent) }
implicit class PackageJson(val pack: Package) extends AnyVal { def json: String = (pack: Entity).json }