summaryrefslogtreecommitdiff
path: root/src/scalap
diff options
context:
space:
mode:
authormpociecha <michal.pociecha@gmail.com>2014-11-28 17:36:00 +0100
committermpociecha <michal.pociecha@gmail.com>2014-11-28 18:05:35 +0100
commit74483771dcdfc963b28325d8ea3698df273370a1 (patch)
treec210b4902091f33b81093b1c80e2834d13a94b7f /src/scalap
parentd34388c1e8fad289a6198b127c6ae92c296d9246 (diff)
downloadscala-74483771dcdfc963b28325d8ea3698df273370a1.tar.gz
scala-74483771dcdfc963b28325d8ea3698df273370a1.tar.bz2
scala-74483771dcdfc963b28325d8ea3698df273370a1.zip
Abstract over ClassPath and ClassRep
This commit is intended to create the possibility to plug in into the compiler an alternative classpath representation which would be possibly more efficient, use less memory etc. Such an implementation - at least at the beginning - should exist next to the currently existing one and be possible to turn on using a flag. Several places in the compiler have a direct dependency on the classpath implementation. Examples include backend's icode generator and reader, SymbolLoaders, ClassfileParser. After closer inspection, one realizes that all those places depend only on a very small subset of classpath logic: they need to lookup classes from classpath. Hence there's introduced ClassFileLookup trait that encapsulates that functionality. The ClassPath extends that trait and an alternative one also must do it. There's also added ClassRepresentation - the base trait for ClassRep (the inner class of ClassPath). Thanks to that the compiler uses a type which is not directly related to the particular classpath representation as it was doing until now.
Diffstat (limited to 'src/scalap')
-rw-r--r--src/scalap/scala/tools/scalap/Main.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/scalap/scala/tools/scalap/Main.scala b/src/scalap/scala/tools/scalap/Main.scala
index c72f416a89..1faa855444 100644
--- a/src/scalap/scala/tools/scalap/Main.scala
+++ b/src/scalap/scala/tools/scalap/Main.scala
@@ -11,7 +11,7 @@ package tools.scalap
import java.io.{ PrintStream, OutputStreamWriter, ByteArrayOutputStream }
import scala.reflect.NameTransformer
import scalax.rules.scalasig._
-import scala.tools.nsc.util.{ ClassPath, JavaClassPath }
+import scala.tools.nsc.util.{ ClassFileLookup, ClassPath, JavaClassPath }
import scala.tools.util.PathResolver
import ClassPath.DefaultJavaContext
import scala.tools.nsc.io.AbstractFile
@@ -96,7 +96,7 @@ class Main {
/** Executes scalap with the given arguments and classpath for the
* class denoted by `classname`.
*/
- def process(args: Arguments, path: ClassPath[AbstractFile])(classname: String): Unit = {
+ def process(args: Arguments, path: ClassFileLookup[AbstractFile])(classname: String): Unit = {
// find the classfile
val encName = classname match {
case "scala.AnyRef" => "java.lang.Object"