Skip to content

Commit c297022

Browse files
committed
Add the ownerNameChain function
- To erase the $ in all the hierarchy
1 parent 8263956 commit c297022

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

scaladoc/src/dotty/tools/scaladoc/tasty/NameNormalizer.scala

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,18 @@ object NameNormalizer {
1818
escaped
1919
}
2020

21-
def normalizedFullName: String = {
22-
import reflect.*
23-
val fullName = s.fullName
24-
val withoutObjectSuffix = if s.flags.is(Flags.Module) then fullName.stripSuffix("$") else fullName
25-
val escaped = escapedName(withoutObjectSuffix)
26-
escaped
27-
}
21+
def ownerNameChain: List[String] = {
22+
import reflect.*
23+
s match
24+
case s: reflect.Symbol if s.isNoSymbol => List.empty
25+
case s: reflect.Symbol if s == defn.EmptyPackageClass => List.empty
26+
case s: reflect.Symbol if s == defn.RootPackage => List.empty
27+
case s: reflect.Symbol if s == defn.RootClass => List.empty
28+
case _ => s.owner.ownerNameChain :+ s.normalizedName
29+
}
30+
31+
def normalizedFullName: String =
32+
s.ownerNameChain.mkString(".")
2833

2934
private val ignoredKeywords: Set[String] = Set("this")
3035

0 commit comments

Comments
 (0)