Skip to content

Commit 2f7c678

Browse files
committed
Polishing and better documentation of Names.scala
1 parent 568b5b9 commit 2f7c678

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
@@ -250,7 +250,7 @@ object NameKinds {
250250
if (i > 0) {
251251
val index = name.drop(i).toString.toInt - 1
252252
var original = name.take(i - str.DEFAULT_GETTER.length).asTermName
253-
if (original == nme.DEFAULT_GETTER_INIT) original = Names.CONSTRUCTOR
253+
if (original == nme.DEFAULT_GETTER_INIT) original = nme.CONSTRUCTOR
254254
apply(original, index)
255255
}
256256
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)