aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-06-08 17:56:41 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-06-09 11:38:40 +0200
commitdf8490167708d009157710e5ad73fa6f8ed3f6fc (patch)
tree5802d1c62e678d90be7ea5f575c8793563ef9ab7 /src/dotty/tools/dotc/repl/CompilingInterpreter.scala
parenta00a972c7425232432364bf991e118d248578f0d (diff)
downloaddotty-df8490167708d009157710e5ad73fa6f8ed3f6fc.tar.gz
dotty-df8490167708d009157710e5ad73fa6f8ed3f6fc.tar.bz2
dotty-df8490167708d009157710e5ad73fa6f8ed3f6fc.zip
Add loader support for dotty bridge
Diffstat (limited to 'src/dotty/tools/dotc/repl/CompilingInterpreter.scala')
-rw-r--r--src/dotty/tools/dotc/repl/CompilingInterpreter.scala14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/repl/CompilingInterpreter.scala b/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
index b6a3e388e..897011be2 100644
--- a/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
+++ b/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
@@ -60,7 +60,11 @@ import printing.SyntaxHighlighting
* @param ictx The context to use for initialization of the interpreter,
* needed to access the current classpath.
*/
-class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler with Interpreter {
+class CompilingInterpreter(
+ out: PrintWriter,
+ ictx: Context,
+ parentClassLoader: Option[ClassLoader]
+) extends Compiler with Interpreter {
import ast.untpd._
import CompilingInterpreter._
@@ -136,8 +140,6 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
/** the compiler's classpath, as URL's */
val compilerClasspath: List[URL] = ictx.platform.classPath(ictx).asURLs
- protected def parentClassLoader: ClassLoader = classOf[Interpreter].getClassLoader
-
/* A single class loader is used for all commands interpreted by this Interpreter.
It would also be possible to create a new class loader for each command
to interpret. The advantages of the current approach are:
@@ -153,8 +155,10 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
*/
/** class loader used to load compiled code */
val classLoader: ClassLoader = {
- val parent = new URLClassLoader(compilerClasspath.toArray, parentClassLoader)
- new AbstractFileClassLoader(virtualDirectory, parent)
+ lazy val parent = new URLClassLoader(compilerClasspath.toArray,
+ classOf[Interpreter].getClassLoader)
+
+ new AbstractFileClassLoader(virtualDirectory, parentClassLoader.getOrElse(parent))
}
// Set the current Java "context" class loader to this interpreter's class loader