summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/interpreter/IMain.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-01-31 03:33:53 +0000
committerPaul Phillips <paulp@improving.org>2011-01-31 03:33:53 +0000
commit174a25e1b3bc054920a9418761bf9f4a8c3d9e79 (patch)
tree6ebde03729b33aab7a88eccfaf4f114b9dbd6411 /src/compiler/scala/tools/nsc/interpreter/IMain.scala
parentc5f20ad02b6d1806e8d0dbca6639630726afc5ee (diff)
downloadscala-174a25e1b3bc054920a9418761bf9f4a8c3d9e79.tar.gz
scala-174a25e1b3bc054920a9418761bf9f4a8c3d9e79.tar.bz2
scala-174a25e1b3bc054920a9418761bf9f4a8c3d9e79.zip
Undid some damage I did recently to tab-complet...
Undid some damage I did recently to tab-completion, and then made a bunch of stuff work better while I was at it. Clearly past time for some tests because I can't move a gear anywhere without unleashing an army of monkeys bearing wrenches. No review.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/IMain.scala')
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/IMain.scala19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
index 3231aee239..cb6971e808 100644
--- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala
@@ -114,8 +114,10 @@ class IMain(val settings: Settings, protected val out: PrintWriter) {
try {
new _compiler.Run() compileSources List(new BatchSourceFile("<init>", source))
- if (isReplDebug || settings.debug.value)
- printMessage("Repl compiler initialized.")
+ if (isReplDebug || settings.debug.value) {
+ // Can't use printMessage here, it deadlocks
+ Console.println("Repl compiler initialized.")
+ }
true
}
catch {
@@ -311,8 +313,11 @@ class IMain(val settings: Settings, protected val out: PrintWriter) {
DBG("Redefining term '%s'\n %s -> %s".format(name, t1, t2))
}
}
-
def recordRequest(req: Request) {
+ if (req == null || referencedNameMap == null) {
+ DBG("Received null value at recordRequest.")
+ return
+ }
def tripart[T](set1: Set[T], set2: Set[T]) = {
val intersect = set1 intersect set2
List(set1 -- intersect, intersect, set2 -- intersect)
@@ -466,11 +471,12 @@ class IMain(val settings: Settings, protected val out: PrintWriter) {
else Some(trees)
}
}
+
def isParseable(line: String): Boolean = {
beSilentDuring {
parse(line) match {
- case Some(xs) => xs.nonEmpty
- case _ => false
+ case Some(xs) => xs.nonEmpty // parses as-is
+ case None => true // incomplete
}
}
}
@@ -568,7 +574,7 @@ class IMain(val settings: Settings, protected val out: PrintWriter) {
if (succeeded) {
if (printResults)
show()
- if (!synthetic) // book-keeping
+ if (!synthetic) // book-keeping
recordRequest(req)
IR.Success
@@ -622,6 +628,7 @@ class IMain(val settings: Settings, protected val out: PrintWriter) {
def quietBind(p: NamedParam): IR.Result = beQuietDuring(bind(p))
def bind(p: NamedParam): IR.Result = bind(p.name, p.tpe, p.value)
def bind[T: Manifest](name: String, value: T): IR.Result = bind((name, value))
+ def bindValue(x: Any): IR.Result = bind(freshUserVarName(), TypeStrings.fromValue(x), x)
/** Reset this interpreter, forgetting all user-specified requests. */
def reset() {