File tree 4 files changed +13
-17
lines changed
compiler/src/dotty/tools/dotc/classpath 4 files changed +13
-17
lines changed Original file line number Diff line number Diff line change 3
3
*/
4
4
package dotty .tools .dotc .classpath
5
5
6
+ import dotty .tools .dotc .classpath .FileUtils .isTasty
6
7
import dotty .tools .io .AbstractFile
7
8
import dotty .tools .io .ClassRepresentation
8
9
@@ -48,16 +49,20 @@ sealed trait BinaryFileEntry extends ClassRepresentation {
48
49
final def source : Option [AbstractFile ] = None
49
50
}
50
51
52
+ object BinaryFileEntry {
53
+ def apply (file : AbstractFile ): BinaryFileEntry =
54
+ if file.isTasty then
55
+ if file.resolveSiblingWithExtension(" class" ) != null then TastyFileEntry (file)
56
+ else StandaloneTastyFileEntry (file)
57
+ else
58
+ ClassFileEntry (file)
59
+ }
60
+
51
61
/** A classfile or .sig that does not have an associated TASTy file */
52
62
private [dotty] final case class ClassFileEntry (file : AbstractFile ) extends BinaryFileEntry {
53
63
def binary : Option [AbstractFile ] = Some (file)
54
64
}
55
65
56
- // object TastyFileEntry:
57
- // def apply(file: AbstractFile, hasClassfile: Boolean): BinaryFileEntry =
58
- // if hasClassfile then TastyFileEntry(file)
59
- // else StandaloneTastyFileEntry(file)
60
-
61
66
/** A TASTy file that has an associated TASTy */
62
67
private [dotty] final case class TastyFileEntry (file : AbstractFile ) extends BinaryFileEntry {
63
68
def binary : Option [AbstractFile ] = Some (file)
Original file line number Diff line number Diff line change @@ -295,10 +295,7 @@ case class DirectoryClassPath(dir: JFile) extends JFileDirectoryLookup[BinaryFil
295
295
else None
296
296
}
297
297
298
- protected def createFileEntry (file : AbstractFile ): BinaryFileEntry =
299
- if ! file.isTasty then ClassFileEntry (file)
300
- else if file.resolveSiblingWithExtension(" class" ) != null then TastyFileEntry (file)
301
- else StandaloneTastyFileEntry (file)
298
+ protected def createFileEntry (file : AbstractFile ): BinaryFileEntry = BinaryFileEntry (file)
302
299
303
300
protected def isMatchingFile (f : JFile ): Boolean =
304
301
f.isTasty || (f.isClass && f.classToTasty.isEmpty)
Original file line number Diff line number Diff line change @@ -61,10 +61,7 @@ case class VirtualDirectoryClassPath(dir: VirtualDirectory) extends ClassPath wi
61
61
62
62
private [dotty] def classes (inPackage : PackageName ): Seq [BinaryFileEntry ] = files(inPackage)
63
63
64
- protected def createFileEntry (file : AbstractFile ): BinaryFileEntry =
65
- if ! file.isTasty then ClassFileEntry (file)
66
- else if file.resolveSiblingWithExtension(" class" ) != null then TastyFileEntry (file)
67
- else StandaloneTastyFileEntry (file)
64
+ protected def createFileEntry (file : AbstractFile ): BinaryFileEntry = BinaryFileEntry (file)
68
65
69
66
protected def isMatchingFile (f : AbstractFile ): Boolean =
70
67
f.isTasty || (f.isClass && f.classToTasty.isEmpty)
Original file line number Diff line number Diff line change @@ -56,10 +56,7 @@ object ZipAndJarClassPathFactory extends ZipAndJarFileLookupFactory {
56
56
57
57
override private [dotty] def classes (inPackage : PackageName ): Seq [BinaryFileEntry ] = files(inPackage)
58
58
59
- override protected def createFileEntry (file : FileZipArchive # Entry ): BinaryFileEntry =
60
- if ! file.isTasty then ClassFileEntry (file)
61
- else if file.resolveSiblingWithExtension(" class" ) != null then TastyFileEntry (file)
62
- else StandaloneTastyFileEntry (file)
59
+ override protected def createFileEntry (file : FileZipArchive # Entry ): BinaryFileEntry = BinaryFileEntry (file)
63
60
64
61
override protected def isRequiredFileType (file : AbstractFile ): Boolean =
65
62
file.isTasty || (file.isClass && file.classToTasty.isEmpty)
You can’t perform that action at this time.
0 commit comments