aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-05-20 10:47:53 +0200
committerFelix Mulder <felix.mulder@gmail.com>2016-05-20 10:47:53 +0200
commita5db35def41d10e4e84dc294e55fbfd79ebc8cab (patch)
tree5c04f10bb376b4076bb769d923e0844408b36d91 /src/dotty/tools/dotc/repl/CompilingInterpreter.scala
parent799007fcf66b5d4299f31533d57a8eee1a345c22 (diff)
downloaddotty-a5db35def41d10e4e84dc294e55fbfd79ebc8cab.tar.gz
dotty-a5db35def41d10e4e84dc294e55fbfd79ebc8cab.tar.bz2
dotty-a5db35def41d10e4e84dc294e55fbfd79ebc8cab.zip
Factor out coloring check to new method `Context#useColors`
Diffstat (limited to 'src/dotty/tools/dotc/repl/CompilingInterpreter.scala')
-rw-r--r--src/dotty/tools/dotc/repl/CompilingInterpreter.scala11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/repl/CompilingInterpreter.scala b/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
index 700909fd0..7b8ba698a 100644
--- a/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
+++ b/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
@@ -406,7 +406,7 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
}
/** load and run the code using reflection.
- * @return A pair consisting of the run's result as a string, and
+ * @return A pair consisting of the run's result as a `List[String]`, and
* a boolean indicating whether the run succeeded without throwing
* an exception.
*/
@@ -417,12 +417,11 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
interpreterResultObject.getMethod("result")
try {
withOutput(new ByteOutputStream) { ps =>
- val rawRes = valMethodRes.invoke(interpreterResultObject).toString
- val res =
- if (List("auto", "always").contains(ictx.settings.color.value))
- new String(SyntaxHighlighting(rawRes).toArray)
+ val rawRes = valMethodRes.invoke(interpreterResultObject).toString
+ val res =
+ if (ictx.useColors) new String(SyntaxHighlighting(rawRes).toArray)
else rawRes
- val prints = ps.toString("utf-8")
+ val prints = ps.toString("utf-8")
val printList = if (prints != "") prints :: Nil else Nil
if (!delayOutput) out.print(prints)