aboutsummaryrefslogtreecommitdiff
path: root/dottydoc
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-07-20 10:21:26 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-08-19 15:37:30 +0200
commit7d8458ff50f56cee13698ce933a295090680d11e (patch)
tree9fa4a8159a9aff3223c6d5c8b8ed3558425e7d3d /dottydoc
parentfe1ff8f0570d3d582a884a9b8f35a14235c0c71f (diff)
downloaddotty-7d8458ff50f56cee13698ce933a295090680d11e.tar.gz
dotty-7d8458ff50f56cee13698ce933a295090680d11e.tar.bz2
dotty-7d8458ff50f56cee13698ce933a295090680d11e.zip
Add support for repeated parameters in producer
Diffstat (limited to 'dottydoc')
-rw-r--r--dottydoc/js/src/model/references.scala6
-rw-r--r--dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala2
-rw-r--r--dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala2
-rw-r--r--dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/comment/BodyEntities.scala2
-rw-r--r--dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/factories.scala9
5 files changed, 17 insertions, 4 deletions
diff --git a/dottydoc/js/src/model/references.scala b/dottydoc/js/src/model/references.scala
index 7cd396e94..051251b68 100644
--- a/dottydoc/js/src/model/references.scala
+++ b/dottydoc/js/src/model/references.scala
@@ -42,6 +42,7 @@ trait NamedReference extends Reference {
val title: String
val ref: Reference
val isByName: Boolean
+ val isRepeated: Boolean
}
@ScalaJSDefined
@@ -55,6 +56,11 @@ trait FunctionReference extends Reference {
val returnValue: Reference
}
+@ScalaJSDefined
+trait TupleReference extends Reference {
+ val args: sjs.Array[Reference]
+}
+
/** Materializable links */
@ScalaJSDefined
sealed trait MaterializableLink extends sjs.Object {
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala
index a6d474c8f..d05d1acbd 100644
--- a/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala
+++ b/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala
@@ -57,7 +57,7 @@ trait TypeLinker extends MemberLookup {
rv.copy(left = linkReference(ent, left, packs), right = linkReference(ent, right, packs))
case rv @ AndTypeReference(left, right) =>
rv.copy(left = linkReference(ent, left, packs), right = linkReference(ent, right, packs))
- case rv @ NamedReference(_, ref, _) => rv.copy(ref = linkReference(ent, ref, packs))
+ case rv @ NamedReference(_, ref, _, _) => rv.copy(ref = linkReference(ent, ref, packs))
case _ => rv
}
}
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala
index 52bb9d36c..3618d325f 100644
--- a/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala
+++ b/dottydoc/jvm/src/dotty/tools/dottydoc/model/json.scala
@@ -49,7 +49,7 @@ object json {
case ref: BoundsReference =>
s"""{"low":${refToJson(ref.low)},"high":${refToJson(ref.high)},"kind":"BoundsReference"}"""
case ref: NamedReference =>
- s"""{"title":${ref.title.json},"ref":${refToJson(ref.ref)},"isByName":${ref.isByName.json},"kind":"NamedReference"}"""
+ s"""{"title":${ref.title.json},"ref":${refToJson(ref.ref)},"isByName":${ref.isByName.json},"isRepeated":${ref.isRepeated.json},"kind":"NamedReference"}"""
case ref: ConstantReference =>
s"""{"title":${ref.title.json},"kind": "ConstantReference"}"""
case ref: FunctionReference =>
diff --git a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/comment/BodyEntities.scala b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/comment/BodyEntities.scala
index b8918c493..ef8343d77 100644
--- a/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/comment/BodyEntities.scala
+++ b/dottydoc/shared/src/main/scala/dotty/tools/dottydoc/model/comment/BodyEntities.scala
@@ -105,5 +105,5 @@ final case class OrTypeReference(left: Reference, right: Reference) extends Refe
final case class AndTypeReference(left: Reference, right: Reference) extends Reference
final case class FunctionReference(args: List[Reference], returnValue: Reference) extends Reference
final case class BoundsReference(low: Reference, high: Reference) extends Reference
-final case class NamedReference(title: String, ref: Reference, isByName: Boolean = false) 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
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 a48f6d9b0..bd38701d9 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
@@ -50,6 +50,8 @@ object factories {
}
def returnType(t: Type)(implicit ctx: Context): Reference = {
+ val defn = ctx.definitions
+
def typeRef(name: String, query: String = "", params: List[Reference] = Nil) = {
val realQuery = if (query != "") query else name
TypeReference(name, UnsetLink(name, realQuery), params)
@@ -123,7 +125,12 @@ object factories {
case mt: MethodType =>
mt.paramNames.zip(mt.paramTypes).map { case (name, tpe) =>
- NamedReference(name.decode.toString, returnType(tpe), tpe.isInstanceOf[ExprType])
+ NamedReference(
+ name.decode.toString,
+ returnType(tpe),
+ isByName = tpe.isInstanceOf[ExprType],
+ isRepeated = tpe.isRepeatedParam
+ )
} :: paramLists(mt.resultType)
case annot: AnnotatedType => paramLists(annot.tpe)