aboutsummaryrefslogtreecommitdiff
path: root/doc-tool/src/dotty/tools/dottydoc/model/references.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2017-01-16 14:05:15 +0100
committerFelix Mulder <felix.mulder@gmail.com>2017-01-31 14:32:35 +0100
commit6f6dc9767badd4bcacd8f00ef0ed467bcabc6296 (patch)
treee381a1be3195be8c69abb84a3e59b0c5470e557c /doc-tool/src/dotty/tools/dottydoc/model/references.scala
parent248f469ddcf57067d02e8b1bea41237766a75cfb (diff)
downloaddotty-6f6dc9767badd4bcacd8f00ef0ed467bcabc6296.tar.gz
dotty-6f6dc9767badd4bcacd8f00ef0ed467bcabc6296.tar.bz2
dotty-6f6dc9767badd4bcacd8f00ef0ed467bcabc6296.zip
Re-implement template expansion of references as filter
The original implementation used the template engine to recursively expand references. This was very error-prone and with no typesafety and proper stack traces it was very hard to diagnose. As such, these two expansions (links and references) have been re-implemented as filters.
Diffstat (limited to 'doc-tool/src/dotty/tools/dottydoc/model/references.scala')
-rw-r--r--doc-tool/src/dotty/tools/dottydoc/model/references.scala8
1 files changed, 8 insertions, 0 deletions
diff --git a/doc-tool/src/dotty/tools/dottydoc/model/references.scala b/doc-tool/src/dotty/tools/dottydoc/model/references.scala
index a28148fa7..766b2a340 100644
--- a/doc-tool/src/dotty/tools/dottydoc/model/references.scala
+++ b/doc-tool/src/dotty/tools/dottydoc/model/references.scala
@@ -17,4 +17,12 @@ object references {
final case class UnsetLink(title: String, query: String) extends MaterializableLink
final case class MaterializedLink(title: String, target: String) extends MaterializableLink
final case class NoLink(title: String, target: String) extends MaterializableLink
+
+ object AndOrTypeReference {
+ def unapply(ref: Reference): Option[(Reference, String, Reference)] = ref match {
+ case OrTypeReference(left, right) => Some((left, "|", right))
+ case AndTypeReference(left, right) => Some((left, "&amp;", right))
+ case _ => None
+ }
+ }
}