diff options
author | Felix Mulder <felix.mulder@gmail.com> | 2016-07-20 17:25:45 +0200 |
---|---|---|
committer | Felix Mulder <felix.mulder@gmail.com> | 2016-08-19 15:37:31 +0200 |
commit | 5d6c15f023b07fd3b6a62b31a1ab32911b9ca01a (patch) | |
tree | 0807a87c3c65691d9efdb69b276b6cb82b9c03d8 /dottydoc | |
parent | c1b57e984a448248569adab579e91a79235ba1e7 (diff) | |
download | dotty-5d6c15f023b07fd3b6a62b31a1ab32911b9ca01a.tar.gz dotty-5d6c15f023b07fd3b6a62b31a1ab32911b9ca01a.tar.bz2 dotty-5d6c15f023b07fd3b6a62b31a1ab32911b9ca01a.zip |
Handle all types of references when linking
Diffstat (limited to 'dottydoc')
-rw-r--r-- | dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala index d05d1acbd..08898f3b1 100644 --- a/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala +++ b/dottydoc/jvm/src/dotty/tools/dottydoc/core/TypeLinkingPhases.scala @@ -38,9 +38,11 @@ class LinkParamListTypes extends DocMiniPhase with TypeLinker { } trait TypeLinker extends MemberLookup { - def linkReference(ent: Entity, rv: Reference, packs: Map[String, Package]): Reference = - rv match { - case rv @ TypeReference(_, UnsetLink(t, query), tps) => + def linkReference(ent: Entity, ref: Reference, packs: Map[String, Package]): Reference = { + def linkRef(ref: Reference) = linkReference(ent, ref, packs) + + ref match { + case ref @ TypeReference(_, UnsetLink(t, query), tps) => val inlineToHtml = InlineToHtml(ent) val title = t @@ -52,12 +54,21 @@ trait TypeLinker extends MemberLookup { val target = handleEntityLink(title, makeEntityLink(ent, packs, Text(t), NoPosition, query).link) val tpTargets = tps.map(linkReference(ent, _, packs)) - rv.copy(tpeLink = target, paramLinks = tpTargets) - case rv @ OrTypeReference(left, right) => - 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 + ref.copy(tpeLink = target, paramLinks = tpTargets) + case ref @ OrTypeReference(left, right) => + ref.copy(left = linkReference(ent, left, packs), right = linkReference(ent, right, packs)) + case ref @ AndTypeReference(left, right) => + ref.copy(left = linkReference(ent, left, packs), right = linkReference(ent, right, packs)) + case ref @ NamedReference(_, rf, _, _) => + ref.copy(ref = linkRef(rf)) + case ref @ FunctionReference(args, rv) => + ref.copy(args = args.map(linkReference(ent, _, packs)), returnValue = linkReference(ent, rv, packs)) + case ref @ TupleReference(args) => + ref.copy(args = args.map(linkRef)) + case ref @ BoundsReference(low, high) => + ref.copy(low = linkRef(low), high = linkRef(high)) + case _ => + ref } + } } |