aboutsummaryrefslogtreecommitdiff
path: root/dottydoc
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-07-20 17:53:32 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-08-19 15:37:31 +0200
commitc53c115a10cce9b86898ee0af79838b1f9013267 (patch)
tree3bb87078244336c6949e1d3f226a833b6ca58265 /dottydoc
parentc05d62817bda480d16366a8c2041287c1524dadb (diff)
downloaddotty-c53c115a10cce9b86898ee0af79838b1f9013267.tar.gz
dotty-c53c115a10cce9b86898ee0af79838b1f9013267.tar.bz2
dotty-c53c115a10cce9b86898ee0af79838b1f9013267.zip
Add indication that paramList takes implicit arguments
Diffstat (limited to 'dottydoc')
-rw-r--r--dottydoc/js/src/html/Member.scala3
-rw-r--r--dottydoc/js/src/model/entities.scala8
-rw-r--r--dottydoc/jvm/resources/index.css3
-rw-r--r--dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala4
-rw-r--r--dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala7
-rw-r--r--dottydoc/jvm/src/dotty/tools/dottydoc/util/mutate.scala2
-rw-r--r--dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/entities.scala7
-rw-r--r--dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/factories.scala7
-rw-r--r--dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/internal.scala7
9 files changed, 36 insertions, 12 deletions
diff --git a/dottydoc/js/src/html/Member.scala b/dottydoc/js/src/html/Member.scala
index 7e39f9a4c..e7aa34c61 100644
--- a/dottydoc/js/src/html/Member.scala
+++ b/dottydoc/js/src/html/Member.scala
@@ -83,7 +83,8 @@ trait MemberLayout {
span(
cls := "param-list",
"(",
- xs.flatMap { tr =>
+ span(cls := "is-implicit no-left-margin", if (xs.isImplicit) "implicit " else ""),
+ xs.list.flatMap { tr =>
Seq(
span(cls := "param-name", tr.title).render,
span(cls := "type-separator no-left-margin", if (tr.isByName) ": =>" else ":").render,
diff --git a/dottydoc/js/src/model/entities.scala b/dottydoc/js/src/model/entities.scala
index adf7bc4ca..4ae76c58c 100644
--- a/dottydoc/js/src/model/entities.scala
+++ b/dottydoc/js/src/model/entities.scala
@@ -73,9 +73,15 @@ trait Object extends Class
trait Trait extends Class
@ScalaJSDefined
+trait ParamList extends sjs.Object {
+ val list: sjs.Array[NamedReference]
+ val isImplicit: Boolean
+}
+
+@ScalaJSDefined
trait Def extends Entity with Modifiers with ReturnValue {
val typeParams: sjs.Array[String]
- val paramLists: sjs.Array[sjs.Array[NamedReference]]
+ val paramLists: sjs.Array[ParamList]
}
@ScalaJSDefined
diff --git a/dottydoc/jvm/resources/index.css b/dottydoc/jvm/resources/index.css
index 47e0ea717..79eeaaee0 100644
--- a/dottydoc/jvm/resources/index.css
+++ b/dottydoc/jvm/resources/index.css
@@ -128,7 +128,8 @@ div.member-definition > span+span {
margin-left: 10px;
}
-div.member-definition > span.member-name {
+div.member-definition > span.member-name,
+div.member-definition > span.member-param-list span.is-implicit {
color: #458;
font-weight: 600;
}
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala
index 08898f3b1..0cf0923f3 100644
--- a/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala
+++ b/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala
@@ -29,9 +29,9 @@ class LinkReturnTypes extends DocMiniPhase with TypeLinker {
class LinkParamListTypes extends DocMiniPhase with TypeLinker {
override def transformDef(implicit ctx: Context) = { case df: DefImpl =>
val newParamLists = for {
- list <- df.paramLists
+ ParamListImpl(list, isImplicit) <- df.paramLists
newList = list.map(linkReference(df, _, ctx.base.packages[Package].toMap))
- } yield newList.asInstanceOf[List[NamedReference]]
+ } yield ParamListImpl(newList.asInstanceOf[List[NamedReference]], isImplicit)
df.copy(paramLists = newParamLists)
}
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala
index 44129e9d8..ea9658b5d 100644
--- a/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala
+++ b/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala
@@ -39,6 +39,11 @@ object json {
}
}
+ implicit class ParamListJson(val plist: ParamList) extends AnyVal {
+ def json: String =
+ s"""{"list":${plist.list.map(_.json).mkString("[",",","]")},"isImplicit":${plist.isImplicit.json}}"""
+ }
+
private def refToJson(ref: Reference): String = ref match {
case ref: TypeReference =>
s"""{"title":${ref.title.json},"tpeLink":${ref.tpeLink.json},"paramLinks":${ref.paramLinks.map(_.json).mkString("[",",","]")},"kind":"TypeReference"}"""
@@ -71,7 +76,7 @@ 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{ xs =>xs.map(_.json).mkString("[",",","]")}.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,""")}"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"}"""
}
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/util/mutate.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/util/mutate.scala
index 4ce94459d..84e3beb5b 100644
--- a/dottydoc/jvm/src/dotty/tools/dottydoc/util/mutate.scala
+++ b/dottydoc/jvm/src/dotty/tools/dottydoc/util/mutate.scala
@@ -24,7 +24,7 @@ object setters {
case _ => ()
}
- def setParamLists(ent: Entity, refs: List[List[NamedReference]]) = ent match {
+ def setParamLists(ent: Entity, refs: List[ParamList]) = ent match {
case x: DefImpl => x.paramLists = refs
case _ => ()
}
diff --git a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/entities.scala b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/entities.scala
index 6f6f1e0b7..391bd514f 100644
--- a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/entities.scala
+++ b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/entities.scala
@@ -51,6 +51,11 @@ trait ReturnValue {
def returnValue: Reference
}
+trait ParamList {
+ def list: List[NamedReference]
+ def isImplicit: Boolean
+}
+
trait Package extends Entity with Members {
val kind = "package"
@@ -74,7 +79,7 @@ trait Object extends Entity with Modifiers with SuperTypes with Members {
}
trait Def extends Entity with Modifiers with TypeParams with ReturnValue {
- def paramLists: List[List[NamedReference]]
+ def paramLists: List[ParamList]
val kind = "def"
}
diff --git a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/factories.scala b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/factories.scala
index c18465c65..f0c78fa41 100644
--- a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/factories.scala
+++ b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/factories.scala
@@ -16,6 +16,7 @@ import dotc.ast.Trees._
object factories {
import dotty.tools.dotc.ast.tpd._
+ import dotty.tools.dottydoc.model.internal.ParamListImpl
import DottyFlags._
type TypeTree = dotty.tools.dotc.ast.Trees.Tree[Type]
@@ -131,19 +132,19 @@ object factories {
case _ => Nil
}
- def paramLists(tpe: Type)(implicit ctx: Context): List[List[NamedReference]] = tpe match {
+ def paramLists(tpe: Type)(implicit ctx: Context): List[ParamList] = tpe match {
case pt: PolyType =>
paramLists(pt.resultType)
case mt: MethodType =>
- mt.paramNames.zip(mt.paramTypes).map { case (name, tpe) =>
+ ParamListImpl(mt.paramNames.zip(mt.paramTypes).map { case (name, tpe) =>
NamedReference(
name.decode.toString,
returnType(tpe),
isByName = tpe.isInstanceOf[ExprType],
isRepeated = tpe.isRepeatedParam
)
- } :: paramLists(mt.resultType)
+ }, mt.isImplicit) :: paramLists(mt.resultType)
case annot: AnnotatedType => paramLists(annot.tpe)
case (_: PolyParam | _: RefinedType | _: TypeRef | _: ThisType |
diff --git a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/internal.scala b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/internal.scala
index 0c204c066..ec1adfa88 100644
--- a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/internal.scala
+++ b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/internal.scala
@@ -64,7 +64,7 @@ object internal {
path: List[String],
var returnValue: Reference,
var typeParams: List[String] = Nil,
- var paramLists: List[List[NamedReference]] = Nil,
+ var paramLists: List[ParamList] = Nil,
var comment: Option[Comment] = None
) extends Def with Impl
@@ -75,4 +75,9 @@ object internal {
var returnValue: Reference,
var comment: Option[Comment] = None
) extends Val with Impl
+
+ final case class ParamListImpl(
+ list: List[NamedReference],
+ isImplicit: Boolean
+ ) extends ParamList
}