summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/classpath/FlatClassPath.scala
diff options
context:
space:
mode:
authormpociecha <michal.pociecha@gmail.com>2014-11-29 17:41:32 +0100
committermpociecha <michal.pociecha@gmail.com>2014-11-30 22:31:31 +0100
commitaf295c53a9c9bc3d579abd5678aba62210d23ada (patch)
tree5fc10c80481847f98b8bf2868994bd3cb4421ed3 /src/compiler/scala/tools/nsc/classpath/FlatClassPath.scala
parent1545d2aead61e8c85f554d00b58d5a6536d5d5d8 (diff)
downloadscala-af295c53a9c9bc3d579abd5678aba62210d23ada.tar.gz
scala-af295c53a9c9bc3d579abd5678aba62210d23ada.tar.bz2
scala-af295c53a9c9bc3d579abd5678aba62210d23ada.zip
Add the flat classpath type aggregating flat classpath instances
There's added AggregateFlatClassPath - an equivalent of MergedClassPath from the old implementation. It is supposed to group classpath instances handling different files being directories, zips or jars. Unlike in the case of the old (recursive) implementation, there won't be a deep, nested hierarchy of classpath instances - just one root (aggregate) and a flat structure of its children. AggregateFlatClassPath ensures the distinction of classpath entries and merges corresponding entries for class and source files into one entry. This is required as SymbolLoaders class makes use of this kind of ClassRepresentation. There are also added unit tests which check whether AggregateFlatClassPath obtains correct entries from classpath instances specified in a constructor and whether it preserves the ordering in the case of repeated entries. There's added a test type of flat classpath using VirtualFiles so it's easy to check the real behaviour.
Diffstat (limited to 'src/compiler/scala/tools/nsc/classpath/FlatClassPath.scala')
-rw-r--r--src/compiler/scala/tools/nsc/classpath/FlatClassPath.scala6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/classpath/FlatClassPath.scala b/src/compiler/scala/tools/nsc/classpath/FlatClassPath.scala
index f1bb6010a4..bbd244b647 100644
--- a/src/compiler/scala/tools/nsc/classpath/FlatClassPath.scala
+++ b/src/compiler/scala/tools/nsc/classpath/FlatClassPath.scala
@@ -47,6 +47,12 @@ object FlatClassPath {
case class FlatClassPathEntries(packages: Seq[PackageEntry], classesAndSources: Seq[ClassRepClassPathEntry])
+object FlatClassPathEntries {
+ import scala.language.implicitConversions
+ // to have working unzip method
+ implicit def entry2Tuple(entry: FlatClassPathEntries) = (entry.packages, entry.classesAndSources)
+}
+
sealed trait ClassRepClassPathEntry extends ClassRepresentation[AbstractFile]
trait ClassFileEntry extends ClassRepClassPathEntry {