Skip to content

Commit 26e8f85

Browse files
committed
Cleanup
1 parent 16204b4 commit 26e8f85

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

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

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -412,18 +412,8 @@ class ClassfileLoader(val classfile: AbstractFile) extends SymbolLoader {
412412
def load(root: SymDenotation)(using Context): Unit = {
413413
val (classRoot, moduleRoot) = rootDenots(root.asClass)
414414
val classfileParser = new ClassfileParser(classfile, classRoot, moduleRoot)(ctx)
415-
val result = classfileParser.run()
416-
if (mayLoadTreesFromTasty)
417-
result match {
418-
case Some(unpickler: tasty.DottyUnpickler) =>
419-
classRoot.classSymbol.rootTreeOrProvider = unpickler
420-
moduleRoot.classSymbol.rootTreeOrProvider = unpickler
421-
case _ =>
422-
}
415+
classfileParser.run()
423416
}
424-
425-
private def mayLoadTreesFromTasty(using Context): Boolean =
426-
ctx.settings.YretainTrees.value || ctx.settings.fromTasty.value
427417
}
428418

429419
class TastyLoader(val tastyFile: AbstractFile) extends SymbolLoader {
@@ -436,19 +426,15 @@ class TastyLoader(val tastyFile: AbstractFile) extends SymbolLoader {
436426
load(root)
437427

438428
def load(root: SymDenotation)(using Context): Unit = {
439-
val tastyBytes = tastyFile.toByteArray
440429
val (classRoot, moduleRoot) = rootDenots(root.asClass)
441-
unpickleTASTY(tastyBytes, classRoot, moduleRoot)
442-
// TODO check TASTy UUID matches classfile
443-
}
444-
445-
def unpickleTASTY(bytes: Array[Byte], classRoot: ClassDenotation, moduleRoot: ClassDenotation)(using Context): tasty.DottyUnpickler = {
446-
val unpickler = new tasty.DottyUnpickler(bytes)
430+
val unpickler =
431+
val tastyBytes = tastyFile.toByteArray
432+
new tasty.DottyUnpickler(tastyBytes)
447433
unpickler.enter(roots = Set(classRoot, moduleRoot, moduleRoot.sourceModule))(using ctx.withSource(util.NoSource))
448434
if (mayLoadTreesFromTasty)
449435
classRoot.classSymbol.rootTreeOrProvider = unpickler
450436
moduleRoot.classSymbol.rootTreeOrProvider = unpickler
451-
unpickler
437+
// TODO check TASTy UUID matches classfile
452438
}
453439

454440
private def mayLoadTreesFromTasty(using Context): Boolean =

compiler/src/dotty/tools/dotc/fromtasty/ReadTasty.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ class ReadTasty extends Phase {
6262
staticRef(className) match {
6363
case clsd: ClassDenotation =>
6464
clsd.infoOrCompleter match {
65-
case info: (ClassfileLoader | TastyLoader) =>
66-
info.doComplete(clsd) // sets cls.rootTreeOrProvider and cls.moduleClass.treeProvider as a side-effect
65+
case info: TastyLoader =>
66+
info.load(clsd) // sets cls.rootTreeOrProvider and cls.moduleClass.treeProvider as a side-effect
6767
case _ =>
6868
}
6969
def moduleClass = clsd.owner.info.member(className.moduleClassName).symbol

0 commit comments

Comments
 (0)