Skip to content

Commit

Permalink
Add the ownerNameChain function
Browse files Browse the repository at this point in the history
- To erase the $ in all the hierarchy
  • Loading branch information
Dedelweiss committed Apr 24, 2023
1 parent 8263956 commit c297022
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions scaladoc/src/dotty/tools/scaladoc/tasty/NameNormalizer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ object NameNormalizer {
escaped
}

def normalizedFullName: String = {
import reflect.*
val fullName = s.fullName
val withoutObjectSuffix = if s.flags.is(Flags.Module) then fullName.stripSuffix("$") else fullName
val escaped = escapedName(withoutObjectSuffix)
escaped
}
def ownerNameChain: List[String] = {
import reflect.*
s match
case s: reflect.Symbol if s.isNoSymbol => List.empty
case s: reflect.Symbol if s == defn.EmptyPackageClass => List.empty
case s: reflect.Symbol if s == defn.RootPackage => List.empty
case s: reflect.Symbol if s == defn.RootClass => List.empty
case _ => s.owner.ownerNameChain :+ s.normalizedName
}

def normalizedFullName: String =
s.ownerNameChain.mkString(".")

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

Expand Down

0 comments on commit c297022

Please sign in to comment.