diff options
author | Martin Odersky <odersky@gmail.com> | 2016-03-17 14:55:24 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-03-18 12:22:46 +0100 |
commit | c938f00ad86dc526c46f30c6c8465552cc12b44b (patch) | |
tree | c36fd316dea28698cbb135f4aad3517627ee496e /src | |
parent | f08c741efb6b64d6df7bd02b5191617037f6be12 (diff) | |
download | dotty-c938f00ad86dc526c46f30c6c8465552cc12b44b.tar.gz dotty-c938f00ad86dc526c46f30c6c8465552cc12b44b.tar.bz2 dotty-c938f00ad86dc526c46f30c6c8465552cc12b44b.zip |
Get rid of indentCode
It messed up parsing of multi-line strings and did not
seem to have a purpose. Error messages print fine without it.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/repl/CompilingInterpreter.scala | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/dotty/tools/dotc/repl/CompilingInterpreter.scala b/src/dotty/tools/dotc/repl/CompilingInterpreter.scala index a7d3fbc1c..bc898488d 100644 --- a/src/dotty/tools/dotc/repl/CompilingInterpreter.scala +++ b/src/dotty/tools/dotc/repl/CompilingInterpreter.scala @@ -177,7 +177,7 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit // if (prevRequests.isEmpty) // new Run(this) // initialize the compiler // (not sure this is needed) // parse - parse(indentCode(line)) match { + parse(line) match { case None => Interpreter.Incomplete case Some(Nil) => Interpreter.Error // parse error or empty input case Some(tree :: Nil) if tree.isTerm && !tree.isInstanceOf[Assign] => @@ -273,7 +273,7 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit // header for the wrapper object code.println("object " + objectName + " {") code.print(importsPreamble) - code.println(indentCode(toCompute)) + code.println(toCompute) handlers.foreach(_.extraCodeToEvaluate(this,code)) code.println(importsTrailer) //end the wrapper object @@ -736,20 +736,6 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit /** Clean up a string for output */ private def clean(str: String)(implicit ctx: Context) = truncPrintString(stripWrapperGunk(str)) - - /** Indent some code by the width of the scala> prompt. - * This way, compiler error messages read better. - */ - def indentCode(code: String) = { - val spaces = " " - - stringFrom(str => - for (line <- code.lines) { - str.print(spaces) - str.print(line + "\n") - str.flush() - }) - } } /** Utility methods for the Interpreter. */ |