diff options
Diffstat (limited to 'dottydoc/jvm/src/dotty/tools/dottydoc/model/parsers.scala')
-rw-r--r-- | dottydoc/jvm/src/dotty/tools/dottydoc/model/parsers.scala | 56 |
1 files changed, 0 insertions, 56 deletions
diff --git a/dottydoc/jvm/src/dotty/tools/dottydoc/model/parsers.scala b/dottydoc/jvm/src/dotty/tools/dottydoc/model/parsers.scala index 2c163b1e6..3b2f2df43 100644 --- a/dottydoc/jvm/src/dotty/tools/dottydoc/model/parsers.scala +++ b/dottydoc/jvm/src/dotty/tools/dottydoc/model/parsers.scala @@ -83,60 +83,4 @@ object parsers { def clear(): Unit = commentCache = Map.empty } - - sealed trait TypeLinker extends MemberLookup { - protected def linkReference(ent: Entity, rv: Reference, packs: Map[String, Package]): Reference = - rv match { - case rv @ TypeReference(_, UnsetLink(t, query), tps) => - val inlineToHtml = InlineToHtml(ent) - val title = inlineToHtml(t) - - def handleEntityLink(title: String, lt: LinkTo): MaterializableLink = lt match { - case Tooltip(str) => NoLink(title, str) - case LinkToExternal(_, url) => MaterializedLink(title, url) - case LinkToEntity(target) => MaterializedLink(title, util.traversing.relativePath(ent, target)) - } - - val target = handleEntityLink(title, makeEntityLink(ent, packs, t, NoPosition, query).link) - - val tpTargets = tps.map { - case UnsetLink(t, query) => - handleEntityLink(inlineToHtml(t), makeEntityLink(ent, packs, t, NoPosition, query).link) - case x => x - } - - 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 - } - - def link(packs: Map[String, Package]): Unit - } - - class ReturnTypeLinker extends TypeLinker { - def link(packs: Map[String, Package]): Unit = - for (pack <- packs.values) mutateEntities(pack) { - case ent: ReturnValue => - setReturnValue(ent, linkReference(ent, ent.returnValue, packs)) - case _ => () - } - } - - class ParamListLinker extends TypeLinker { - def link(packs: Map[String, Package]): Unit = - for (pack <- packs.values) mutateEntities(pack) { - case ent: Def => - val newParamLists = for { - list <- ent.paramLists - newList = list.map(linkReference(ent, _, packs)) - } yield newList.asInstanceOf[List[NamedReference]] - - setParamLists(ent, newParamLists) - case _ => () - } - } } |