diff options
author | Dmitry Petrashko <dark@d-d.me> | 2016-06-12 18:11:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-12 18:11:58 +0200 |
commit | c7d1826cf0456e5efad5cb66ae06e7273c8a8e2a (patch) | |
tree | 83d508f03ab8af65012fc65f169003fae331b2e1 /src/dotty/tools/dotc/repl/CompilingInterpreter.scala | |
parent | 002ed8e1ccaf6e821c75da3a4bfad3b3c12da0ab (diff) | |
parent | 42030aad5ad62296286f2d1ec785377ba550cb89 (diff) | |
download | dotty-c7d1826cf0456e5efad5cb66ae06e7273c8a8e2a.tar.gz dotty-c7d1826cf0456e5efad5cb66ae06e7273c8a8e2a.tar.bz2 dotty-c7d1826cf0456e5efad5cb66ae06e7273c8a8e2a.zip |
Merge pull request #1314 from dotty-staging/topic/bridge-repl
Add console to bridge
Diffstat (limited to 'src/dotty/tools/dotc/repl/CompilingInterpreter.scala')
-rw-r--r-- | src/dotty/tools/dotc/repl/CompilingInterpreter.scala | 14 |
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 |