summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLex Spoon <lex@lexspoon.org>2007-07-13 19:22:08 +0000
committerLex Spoon <lex@lexspoon.org>2007-07-13 19:22:08 +0000
commit72105be047b775ad0c3080cb31dd43e392b6ce2b (patch)
tree0c96b8b1d5946a782113789ee067739cf66b406c
parent7529035f6d21021dcf518a8b53729d1c5c6374f5 (diff)
downloadscala-72105be047b775ad0c3080cb31dd43e392b6ce2b.tar.gz
scala-72105be047b775ad0c3080cb31dd43e392b6ce2b.tar.bz2
scala-72105be047b775ad0c3080cb31dd43e392b6ce2b.zip
- interpret() creates compiler.Run the first ti...
- interpret() creates compiler.Run the first time it is called - setContextClassLoader() is now available
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index 68210e1fa4..6e1507e9fd 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -136,6 +136,13 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
new URLClassLoader((classfilePath.toURL :: compilerClasspath).toArray,
parentClassLoader)
+ /** Set the current Java "context" class loader to this
+ * interpreter's class loader */
+ def setContextClassLoader() {
+ Thread.currentThread.setContextClassLoader(classLoader)
+ }
+
+
/** XXX Let's get rid of this. I believe the Eclipse plugin is
* the only user of it, so this should be doable. */
protected def parentClassLoader: ClassLoader = null
@@ -422,6 +429,9 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
* @return ...
*/
def interpret(line: String): IR.Result = {
+ if (prevRequests.isEmpty)
+ new compiler.Run // initialize the compiler
+
// parse
val trees = parse(line) match {
case None => return IR.Incomplete