@@ -436,33 +436,12 @@ class TastyLoader(val tastyFile: AbstractFile) extends SymbolLoader {
436
436
load(root)
437
437
438
438
def load (root : SymDenotation )(using Context ): Unit = {
439
- val tastyBytes = loadTastyBytes()
439
+ val tastyBytes = tastyFile.toByteArray
440
440
val (classRoot, moduleRoot) = rootDenots(root.asClass)
441
441
unpickleTASTY(tastyBytes, classRoot, moduleRoot)
442
442
// TODO check TASTy UUID matches classfile
443
443
}
444
444
445
- def loadTastyBytes (): Array [Byte ] =
446
- tastyFile match { // TODO: simplify when #3552 is fixed
447
- case tastyFile : io.ZipArchive # Entry => // We are in a jar
448
- val stream = tastyFile.input
449
- try {
450
- val tastyOutStream = new ByteArrayOutputStream ()
451
- val buffer = new Array [Byte ](1024 )
452
- var read = stream.read(buffer, 0 , buffer.length)
453
- while (read != - 1 ) {
454
- tastyOutStream.write(buffer, 0 , read)
455
- read = stream.read(buffer, 0 , buffer.length)
456
- }
457
- tastyOutStream.flush()
458
- tastyOutStream.toByteArray.nn
459
- } finally {
460
- stream.close()
461
- }
462
- case _ =>
463
- tastyFile.toByteArray
464
- }
465
-
466
445
def unpickleTASTY (bytes : Array [Byte ], classRoot : ClassDenotation , moduleRoot : ClassDenotation )(using Context ): tasty.DottyUnpickler = {
467
446
val unpickler = new tasty.DottyUnpickler (bytes)
468
447
unpickler.enter(roots = Set (classRoot, moduleRoot, moduleRoot.sourceModule))(using ctx.withSource(util.NoSource ))
0 commit comments