summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2010-04-28 18:42:26 +0000
committerPaul Phillips <paulp@improving.org>2010-04-28 18:42:26 +0000
commitb86d72b35eb729be8226b241134bfc76e68b3ae9 (patch)
tree6a20739730068a211fd002e5db2894e803a7597d
parent9b066f5a1eb1641f8e025a065ae6313c2d204bde (diff)
downloadscala-b86d72b35eb729be8226b241134bfc76e68b3ae9.tar.gz
scala-b86d72b35eb729be8226b241134bfc76e68b3ae9.tar.bz2
scala-b86d72b35eb729be8226b241134bfc76e68b3ae9.zip
Some path-dependent type fiddling so power mode...
Some path-dependent type fiddling so power mode Trees don't come back typed _5.compiler.Tree forSome { val _5: scala.tools.nsc.Interpreter } or similar. No review.
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index ba81e1885c..556a3107cd 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -990,8 +990,10 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
/** A container class for methods to be injected into the repl
* in power mode.
*/
- class Power {
+ object power {
+ lazy val compiler: repl.compiler.type = repl.compiler
import compiler.{ phaseNames, atPhase, currentRun }
+
def mkContext(code: String = "") = compiler.analyzer.rootContext(mkUnit(code))
def mkAlias(name: String, what: String) = interpret("type %s = %s".format(name, what))
def mkSourceFile(code: String) = new BatchSourceFile("<console>", code)
@@ -1025,13 +1027,11 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
atAllPhases(op.toString) foreach { case (ph, op) => Console.println("%15s -> %s".format(ph, op take 240)) }
}
- lazy val power = new Power
-
def unleash(): Unit = beQuietDuring {
interpret("import scala.tools.nsc._")
repl.bind("repl", "scala.tools.nsc.Interpreter", this)
interpret("val global: repl.compiler.type = repl.compiler")
- interpret("val power: scala.tools.nsc.Interpreter#Power = repl.power")
+ interpret("val power: repl.power.type = repl.power")
// interpret("val replVars = repl.replVars")
}