summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/classpath
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2016-03-22 21:26:35 +0100
committerLukas Rytz <lukas.rytz@gmail.com>2016-03-22 21:46:51 +0100
commitf8950c1457955835f4411beb8dcb3672f7cd39bd (patch)
treeee7b309b133ca04b2acf0d53533641e939cee75b /src/compiler/scala/tools/nsc/classpath
parent6cb50acfb5ee4df342e83d8505116d4607f45d1c (diff)
downloadscala-f8950c1457955835f4411beb8dcb3672f7cd39bd.tar.gz
scala-f8950c1457955835f4411beb8dcb3672f7cd39bd.tar.bz2
scala-f8950c1457955835f4411beb8dcb3672f7cd39bd.zip
Support :require when using the flat classpath representation.
:require was re-incarnated in https://github.com/scala/scala/pull/4051, it seems to be used by the spark repl. This commit makes it work when using the flat classpath representation.
Diffstat (limited to 'src/compiler/scala/tools/nsc/classpath')
-rw-r--r--src/compiler/scala/tools/nsc/classpath/AggregateFlatClassPath.scala12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/classpath/AggregateFlatClassPath.scala b/src/compiler/scala/tools/nsc/classpath/AggregateFlatClassPath.scala
index 7bfb3240eb..f97d97548e 100644
--- a/src/compiler/scala/tools/nsc/classpath/AggregateFlatClassPath.scala
+++ b/src/compiler/scala/tools/nsc/classpath/AggregateFlatClassPath.scala
@@ -125,3 +125,15 @@ case class AggregateFlatClassPath(aggregates: Seq[FlatClassPath]) extends FlatCl
private def classesGetter(pkg: String) = (cp: FlatClassPath) => cp.classes(pkg)
private def sourcesGetter(pkg: String) = (cp: FlatClassPath) => cp.sources(pkg)
}
+
+object AggregateFlatClassPath {
+ def createAggregate(parts: FlatClassPath*): FlatClassPath = {
+ val elems = new ArrayBuffer[FlatClassPath]()
+ parts foreach {
+ case AggregateFlatClassPath(ps) => elems ++= ps
+ case p => elems += p
+ }
+ if (elems.size == 1) elems.head
+ else AggregateFlatClassPath(elems.toIndexedSeq)
+ }
+}