Skip to content

Commit 022bb18

Browse files
committed
BackendInterface: clean-up name handling
- Remove simpleName since it's equivalent to name - Remove unused fullName(sep: Char) - Rename fullName to showFullName since it's only used for logging statements
1 parent 9e1f8a2 commit 022bb18

File tree

5 files changed

+8
-12
lines changed

5 files changed

+8
-12
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
114114
case POS => () // nothing
115115
case NEG => bc.neg(resKind)
116116
case NOT => bc.genPrimitiveArithmetic(Primitives.NOT, resKind)
117-
case _ => abort(s"Unknown unary operation: ${fun.symbol.fullName} code: $code")
117+
case _ => abort(s"Unknown unary operation: ${fun.symbol.showFullName} code: $code")
118118
}
119119

120120
// binary operation
@@ -256,7 +256,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
256256
coercionTo(code)
257257
}
258258
else abort(
259-
s"Primitive operation not handled yet: ${sym.fullName}(${fun.symbol.simpleName}) at: ${tree.pos}"
259+
s"Primitive operation not handled yet: ${sym.showFullName}(${fun.symbol.name}) at: ${tree.pos}"
260260
)
261261
}
262262

@@ -633,7 +633,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
633633
val cast = sym match {
634634
case Object_isInstanceOf => false
635635
case Object_asInstanceOf => true
636-
case _ => abort(s"Unexpected type application $fun[sym: ${sym.fullName}] in: $t")
636+
case _ => abort(s"Unexpected type application $fun[sym: ${sym.showFullName}] in: $t")
637637
}
638638

639639
val l = tpeTK(obj)
@@ -736,7 +736,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
736736
mkArrayConstructorCall(arr, app, args)
737737

738738
case rt: ClassBType =>
739-
assert(classBTypeFromSymbol(ctor.owner) == rt, s"Symbol ${ctor.owner.fullName} is different from $rt")
739+
assert(classBTypeFromSymbol(ctor.owner) == rt, s"Symbol ${ctor.owner.showFullName} is different from $rt")
740740
mnode.visitTypeInsn(asm.Opcodes.NEW, rt.internalName)
741741
bc dup generatedType
742742
genLoadArguments(args, paramTKs(app))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class BTypesFromSymbols[I <: BackendInterface](val int: I) extends BTypes {
4949
assert(
5050
(!primitiveTypeMap.contains(classSym) || isCompilingPrimitive) &&
5151
(classSym != NothingClass && classSym != NullClass),
52-
s"Cannot create ClassBType for special class symbol ${classSym.fullName}")
52+
s"Cannot create ClassBType for special class symbol ${classSym.showFullName}")
5353

5454
convertedClasses.getOrElse(classSym, {
5555
val internalName = classSym.javaBinaryName

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,7 @@ abstract class BackendInterface extends BackendInterfaceDefinitions {
443443

444444
abstract class SymbolHelper {
445445
// names
446-
def fullName(sep: Char): String
447-
def fullName: String
448-
def simpleName: Name
446+
def showFullName: String
449447
def javaSimpleName: String
450448
def javaBinaryName: String
451449
def javaClassName: String

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -628,9 +628,7 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
628628

629629
implicit def symHelper(sym: Symbol): SymbolHelper = new SymbolHelper {
630630
// names
631-
def fullName(sep: Char): String = sym.showFullName
632-
def fullName: String = sym.showFullName
633-
def simpleName: Name = sym.name
631+
def showFullName: String = sym.showFullName
634632
def javaSimpleName: String = toDenot(sym).name.mangledString // addModuleSuffix(simpleName.dropLocal)
635633
def javaBinaryName: String = javaClassName.replace('.', '/') // TODO: can we make this a string? addModuleSuffix(fullNameInternal('/'))
636634
def javaClassName: String = toDenot(sym).fullName.mangledString // addModuleSuffix(fullNameInternal('.')).toString

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class GenBCodePipeline(val int: DottyBackendInterface)(implicit val ctx: Context
207207
if (claszSymbol.companionClass == NoSymbol) {
208208
mirrorCodeGen.genMirrorClass(claszSymbol, cunit)
209209
} else {
210-
ctx.log(s"No mirror class for module with linked class: ${claszSymbol.fullName}")
210+
ctx.log(s"No mirror class for module with linked class: ${claszSymbol.showFullName}")
211211
null
212212
}
213213
} else null

0 commit comments

Comments
 (0)