@@ -39,24 +39,15 @@ case class VirtualDirectoryClassPath(dir: VirtualDirectory) extends ClassPath wi
39
39
def asClassPathStrings : Seq [String ] = Seq (dir.path)
40
40
41
41
override def findClass (className : String ): Option [ClassRepresentation ] =
42
- val pathSeq = FileUtils .dirPath(className).split(java.io.File .separator)
43
- val parentDir = lookupPath(dir)(pathSeq.init.toSeq, directory = true )
44
- if parentDir == null then return None
45
- else
46
- val classfile = lookupPath(parentDir)(pathSeq.last + " .class" :: Nil , directory = false )
47
- val tasty = lookupPath(parentDir)(pathSeq.last + " .tasty" :: Nil , directory = false )
48
- if tasty != null then
49
- if classfile != null then Some (TastyFileEntry (tasty))
50
- else Some (StandaloneTastyFileEntry (tasty))
51
- else
52
- if classfile != null then Some (ClassFileEntry (classfile))
53
- else None
42
+ findClassFile(className).map(BinaryFileEntry (_))
54
43
55
44
def findClassFile (className : String ): Option [AbstractFile ] = {
56
45
val pathSeq = FileUtils .dirPath(className).split(java.io.File .separator)
57
46
val parentDir = lookupPath(dir)(pathSeq.init.toSeq, directory = true )
58
47
if parentDir == null then return None
59
- else Option (lookupPath(parentDir)(pathSeq.last + " .class" :: Nil , directory = false ))
48
+ else
49
+ Option (lookupPath(parentDir)(pathSeq.last + " .tasty" :: Nil , directory = false ))
50
+ .orElse(Option (lookupPath(parentDir)(pathSeq.last + " .class" :: Nil , directory = false )))
60
51
}
61
52
62
53
private [dotty] def classes (inPackage : PackageName ): Seq [BinaryFileEntry ] = files(inPackage)
0 commit comments