File tree Expand file tree Collapse file tree 2 files changed +11
-15
lines changed
scaladoc/src/dotty/tools/scaladoc/tasty Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -5,17 +5,12 @@ import scala.quoted._
55import dotty .tools .scaladoc .util .Escape ._
66import scala .util .matching .Regex
77
8- trait Scaladoc2AnchorCreator :
9- self : SymOps [_] =>
8+ object Scaladoc2AnchorCreator :
109
11- import self .q .reflect ._
12-
13- implicit private val printer : Printer [Tree ] = Printer .TreeShortCode
14-
15- def getScaladoc2Type (t : Tree ) = {
16- (t match {
17- case d : DefDef => d.show.split(" def" , 2 )(1 )
18- case t : TypeDef => t.show.split(" type" , 2 )(1 )
19- case v : ValDef => v.show.split(" val|var" , 2 )(1 )
20- }).replace(" " ," " )
21- }
10+ def getScaladoc2Type (using Quotes )(t : quotes.reflect.Tree ) =
11+ import quotes .reflect .*
12+ val regex = t match
13+ case d : DefDef => " def"
14+ case t : TypeDef => " type"
15+ case v : ValDef => " val|var"
16+ t.show(using Printer .TreeShortCode ).split(regex, 2 )(1 ).replace(" " ," " )
Original file line number Diff line number Diff line change @@ -5,11 +5,12 @@ import scala.quoted._
55import dotty .tools .scaladoc .util .Escape ._
66import scala .collection .mutable .{ Map => MMap }
77import dotty .tools .io .AbstractFile
8+ import Scaladoc2AnchorCreator .getScaladoc2Type
89
9- class SymOps [Q <: Quotes ](val q : Q ) extends JavadocAnchorCreator with Scaladoc2AnchorCreator :
10+ class SymOps [Q <: Quotes ](val q : Q ) extends JavadocAnchorCreator :
1011 import q .reflect ._
1112
12- given Q = q
13+ given q . type = q
1314
1415 private val externalLinkCache : scala.collection.mutable.Map [AbstractFile , Option [ExternalDocLink ]] = MMap ()
1516
You can’t perform that action at this time.
0 commit comments