diff options
author | Paul Phillips <paulp@improving.org> | 2012-10-30 14:29:23 -0700 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-11-01 18:54:17 -0700 |
commit | d5ebd7e069d6a60936267e239f74ce89a3851453 (patch) | |
tree | d32e72e3867d8f7c49db6a8d052b3d2e9e3cc9ff /src/compiler/scala/tools/nsc/interpreter/IMain.scala | |
parent | d0c4be6861109683d80513eda74e5c6ca88f1441 (diff) | |
download | scala-d5ebd7e069d6a60936267e239f74ce89a3851453.tar.gz scala-d5ebd7e069d6a60936267e239f74ce89a3851453.tar.bz2 scala-d5ebd7e069d6a60936267e239f74ce89a3851453.zip |
Remove unused private members.
That's a lot of unused code. Most of this is pure cruft; a small
amount is debugging code which somebody might want to keep around,
but we should not be using trunk as a repository of our personal
snippets of undocumented, unused, unintegrated debugging code. So
let's make the easy decision to err in the removing direction.
If it isn't built to last, it shouldn't be checked into master.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/IMain.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/IMain.scala | 35 |
1 files changed, 7 insertions, 28 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/IMain.scala b/src/compiler/scala/tools/nsc/interpreter/IMain.scala index 4e702a09e6..a44f862dd7 100644 --- a/src/compiler/scala/tools/nsc/interpreter/IMain.scala +++ b/src/compiler/scala/tools/nsc/interpreter/IMain.scala @@ -437,18 +437,6 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends executingRequest } - // rewriting "5 // foo" to "val x = { 5 // foo }" creates broken code because - // the close brace is commented out. Strip single-line comments. - // ... but for error message output reasons this is not used, and rather than - // enclosing in braces it is constructed like "val x =\n5 // foo". - private def removeComments(line: String): String = { - showCodeIfDebugging(line) // as we're about to lose our // show - line.lines map (s => s indexOf "//" match { - case -1 => s - case idx => s take idx - }) mkString "\n" - } - private def safePos(t: Tree, alt: Int): Int = try t.pos.startOrPoint catch { case _: UnsupportedOperationException => alt } @@ -682,10 +670,6 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends class ReadEvalPrint(lineId: Int) { def this() = this(freshLineId()) - private var lastRun: Run = _ - private var evalCaught: Option[Throwable] = None - private var conditionalWarnings: List[ConditionalWarning] = Nil - val packageName = sessionNames.line + lineId val readName = sessionNames.read val evalName = sessionNames.eval @@ -742,10 +726,7 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends } lazy val evalClass = load(evalPath) - lazy val evalValue = callEither(resultName) match { - case Left(ex) => evalCaught = Some(ex) ; None - case Right(result) => Some(result) - } + lazy val evalValue = callOpt(resultName) def compile(source: String): Boolean = compileAndSaveRun("<console>", source) @@ -789,7 +770,6 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends showCodeIfDebugging(code) val (success, run) = compileSourcesKeepingRun(new BatchSourceFile(label, packaged(code))) updateRecentWarnings(run) - lastRun = run success } } @@ -1150,13 +1130,12 @@ class IMain(initialSettings: Settings, protected val out: JPrintWriter) extends /** Secret bookcase entrance for repl debuggers: end the line * with "// show" and see what's going on. */ - def isShow = code.lines exists (_.trim endsWith "// show") - def isShowRaw = code.lines exists (_.trim endsWith "// raw") - - // old style - beSilentDuring(parse(code)) foreach { ts => - ts foreach { t => - withoutUnwrapping(repldbg(asCompactString(t))) + def isShow = code.lines exists (_.trim endsWith "// show") + if (isReplDebug || isShow) { + beSilentDuring(parse(code)) foreach { ts => + ts foreach { t => + withoutUnwrapping(echo(asCompactString(t))) + } } } } |