Skip to content

Commit 91de509

Browse files
committed
Inline some methods
1 parent 7334e94 commit 91de509

File tree

4 files changed

+11
-28
lines changed

4 files changed

+11
-28
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
9393
* must-single-thread
9494
*/
9595
def initBytecodeWriter(): BytecodeWriter = {
96-
getSingleOutput match {
96+
(None: Option[AbstractFile] /*getSingleOutput*/) match { // todo: implement
9797
case Some(f) if f.hasExtension("jar") =>
9898
new DirectToJarfileWriter(f.file)
9999
case _ =>
@@ -212,7 +212,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
212212

213213
private def assertClassNotArray(sym: Symbol): Unit = {
214214
assert(sym.isClass, sym)
215-
assert(sym != defn.ArrayClass || isCompilingArray, sym)
215+
assert(sym != defn.ArrayClass || ctx.compilationUnit.source.file.name == "Array.scala", sym)
216216
}
217217

218218
private def assertClassNotArrayNotPrimitive(sym: Symbol): Unit = {
@@ -613,7 +613,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
613613
null /* SourceDebugExtension */)
614614
}
615615

616-
val ssa = getAnnotPickle(mirrorName, if (moduleClass.is(Flags.Module)) moduleClass.companionClass else moduleClass.companionModule)
616+
val ssa = None // getAnnotPickle(mirrorName, if (moduleClass.is(Flags.Module)) moduleClass.companionClass else moduleClass.companionModule)
617617
mirrorClass.visitAttribute(if (ssa.isDefined) pickleMarkerLocal else pickleMarkerForeign)
618618
emitAnnotations(mirrorClass, moduleClass.annotations ++ ssa)
619619

@@ -641,8 +641,8 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
641641
*/
642642
val androidFieldName = "CREATOR".toTermName
643643

644-
lazy val AndroidParcelableInterface : Symbol = getClassIfDefined("android.os.Parcelable")
645-
lazy val AndroidCreatorClass : Symbol = getClassIfDefined("android.os.Parcelable$Creator")
644+
lazy val AndroidParcelableInterface : Symbol = NoSymbol // getClassIfDefined("android.os.Parcelable")
645+
lazy val AndroidCreatorClass : Symbol = NoSymbol // getClassIfDefined("android.os.Parcelable$Creator")
646646

647647
/*
648648
* must-single-thread

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ trait BCodeSkelBuilder extends BCodeHelpers {
170170
case _ => ()
171171
}
172172

173-
val ssa = getAnnotPickle(thisName, claszSymbol)
173+
val ssa = None // getAnnotPickle(thisName, claszSymbol)
174174
cnode.visitAttribute(if (ssa.isDefined) pickleMarkerLocal else pickleMarkerForeign)
175175
emitAnnotations(cnode, claszSymbol.annotations ++ ssa)
176176

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package jvm
44

55
import scala.annotation.switch
66

7+
import dotty.tools.dotc.core.Decorators._
78
import dotty.tools.dotc.core.Symbols._
89
import dotty.tools.dotc.transform.Erasure
910

@@ -112,8 +113,8 @@ class CoreBTypes[BTFS <: BTypesFromSymbols[_ <: DottyBackendInterface]](val bTyp
112113
* names of NothingClass and NullClass can't be emitted as-is.
113114
* TODO @lry Once there's a 2.11.3 starr, use the commented argument list. The current starr crashes on the type literal `scala.runtime.Nothing$`
114115
*/
115-
lazy val RT_NOTHING : ClassBType = classBTypeFromSymbol(getRequiredClass("scala.runtime.Nothing$")) // (requiredClass[scala.runtime.Nothing$])
116-
lazy val RT_NULL : ClassBType = classBTypeFromSymbol(getRequiredClass("scala.runtime.Null$")) // (requiredClass[scala.runtime.Null$])
116+
lazy val RT_NOTHING : ClassBType = classBTypeFromSymbol(ctx.requiredClass("scala.runtime.Nothing$")) // (requiredClass[scala.runtime.Nothing$])
117+
lazy val RT_NULL : ClassBType = classBTypeFromSymbol(ctx.requiredClass("scala.runtime.Null$")) // (requiredClass[scala.runtime.Null$])
117118

118119
lazy val ObjectReference : ClassBType = classBTypeFromSymbol(defn.ObjectClass)
119120
lazy val objArrayReference : ArrayBType = ArrayBType(ObjectReference)

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

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,6 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
7676
annot.tree.tpe.typeSymbol.getAnnotation(AnnotationRetentionAttr).
7777
flatMap(_.argumentConstant(0).map(_.symbolValue)).getOrElse(AnnotationRetentionClassAttr)
7878

79-
private def normalizeArgument(arg: Tree): Tree = arg match {
80-
case Trees.NamedArg(_, arg1) => normalizeArgument(arg1)
81-
case Trees.Typed(arg1, _) => normalizeArgument(arg1)
82-
case _ => arg
83-
}
84-
85-
def getAnnotPickle(jclassName: String, sym: Symbol): Option[Annotation] = None
86-
87-
88-
def getRequiredClass(fullname: String): Symbol = ctx.requiredClass(fullname)
89-
90-
def getClassIfDefined(fullname: String): Symbol = NoSymbol // used only for android. todo: implement
91-
9279
private def erasureString(clazz: Class[_]): String = {
9380
if (clazz.isArray) "Array[" + erasureString(clazz.getComponentType) + "]"
9481
else clazz.getName
@@ -153,8 +140,6 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
153140
(sym derivesFrom defn.BoxedBooleanClass)
154141
}
155142

156-
def getSingleOutput: Option[AbstractFile] = None // todo: implement
157-
158143
// @M don't generate java generics sigs for (members of) implementation
159144
// classes, as they are monomorphic (TODO: ok?)
160145
private final def needsGenericSignature(sym: Symbol): Boolean = !(
@@ -417,7 +402,7 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
417402
*/
418403
def primitiveOrClassToBType(sym: Symbol): BType = {
419404
assert(sym.isClass, sym)
420-
assert(sym != defn.ArrayClass || isCompilingArray, sym)
405+
assert(sym != defn.ArrayClass || ctx.compilationUnit.source.file.name == "Array.scala", sym)
421406
primitiveTypeMap.getOrElse(sym.asInstanceOf[ct.bTypes.coreBTypes.bTypes.int.Symbol],
422407
storage.getClassBTypeAndRegisterInnerClass(sym.asInstanceOf[ct.int.Symbol])).asInstanceOf[BType]
423408
}
@@ -427,7 +412,7 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
427412
* signatures, e.g. `def apply(i: Int): T`. A TyperRef to T is replaced by ObjectReference.
428413
*/
429414
def nonClassTypeRefToBType(sym: Symbol): ClassBType = {
430-
assert(sym.isType && isCompilingArray, sym)
415+
assert(sym.isType && ctx.compilationUnit.source.file.name == "Array.scala", sym)
431416
ObjectReference.asInstanceOf[ct.bTypes.ClassBType]
432417
}
433418

@@ -587,9 +572,6 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
587572
primitiveCompilationUnits(ctx.compilationUnit.source.file.name)
588573
}
589574

590-
def isCompilingArray = {
591-
ctx.compilationUnit.source.file.name == "Array.scala"
592-
}
593575
}
594576

595577
object DottyBackendInterface {

0 commit comments

Comments
 (0)