Skip to content

Commit f270e02

Browse files
committed
Polishing and better documentation of Names.scala
1 parent 6178648 commit f270e02

File tree

9 files changed

+181
-136
lines changed

9 files changed

+181
-136
lines changed

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
643643
toDenot(sym)(shiftedContext).isStatic(shiftedContext)
644644
}
645645

646-
def isStaticConstructor: Boolean = (isStaticMember && isClassConstructor) || (sym.name eq core.Names.STATIC_CONSTRUCTOR)
646+
def isStaticConstructor: Boolean = (isStaticMember && isClassConstructor) || (sym.name eq nme.STATIC_CONSTRUCTOR)
647647

648648

649649
// navigation

compiler/src/dotty/tools/dotc/core/NameKinds.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ object NameKinds {
253253
if (i > 0) {
254254
val index = name.drop(i).toString.toInt - 1
255255
var original = name.take(i - str.DEFAULT_GETTER.length).asTermName
256-
if (original == nme.DEFAULT_GETTER_INIT) original = Names.CONSTRUCTOR
256+
if (original == nme.DEFAULT_GETTER_INIT) original = nme.CONSTRUCTOR
257257
apply(original, index)
258258
}
259259
else name

compiler/src/dotty/tools/dotc/core/NameOps.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,10 @@ object NameOps {
100100
* it is also called from the backend.
101101
*/
102102
def stripModuleClassSuffix: N = likeSpaced {
103-
val semName =
104-
if (name.isSimple && name.endsWith("$")) name.unmangleClassName else name
103+
val semName = name.toTermName match {
104+
case name: SimpleTermName if name.endsWith("$") => name.unmangleClassName
105+
case _ => name
106+
}
105107
semName.exclude(ModuleClassName)
106108
}
107109

0 commit comments

Comments
 (0)