File tree 2 files changed +11
-15
lines changed
scaladoc/src/dotty/tools/scaladoc/tasty
2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -5,17 +5,12 @@ import scala.quoted._
5
5
import dotty .tools .scaladoc .util .Escape ._
6
6
import scala .util .matching .Regex
7
7
8
- trait Scaladoc2AnchorCreator :
9
- self : SymOps [_] =>
8
+ object Scaladoc2AnchorCreator :
10
9
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._
5
5
import dotty .tools .scaladoc .util .Escape ._
6
6
import scala .collection .mutable .{ Map => MMap }
7
7
import dotty .tools .io .AbstractFile
8
+ import Scaladoc2AnchorCreator .getScaladoc2Type
8
9
9
- class SymOps [Q <: Quotes ](val q : Q ) extends JavadocAnchorCreator with Scaladoc2AnchorCreator :
10
+ class SymOps [Q <: Quotes ](val q : Q ) extends JavadocAnchorCreator :
10
11
import q .reflect ._
11
12
12
- given Q = q
13
+ given q . type = q
13
14
14
15
private val externalLinkCache : scala.collection.mutable.Map [AbstractFile , Option [ExternalDocLink ]] = MMap ()
15
16
You can’t perform that action at this time.
0 commit comments