aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-02-16 08:35:27 +0100
committerMartin Odersky <odersky@gmail.com>2016-02-17 18:39:48 +0100
commit9b45420d2b3193469931b15406d382c499fbb453 (patch)
treeae3ad0c541f83258bf4ba8088dea200ddafd2d62 /src/dotty/tools/dotc/repl/CompilingInterpreter.scala
parent41079cd8e196817048812a51041086b31908fcc3 (diff)
downloaddotty-9b45420d2b3193469931b15406d382c499fbb453.tar.gz
dotty-9b45420d2b3193469931b15406d382c499fbb453.tar.bz2
dotty-9b45420d2b3193469931b15406d382c499fbb453.zip
Remove interpreterSettings logic
Seems to be overkill for the current interpreter. The only thing that was needed was a configrable linewidth. A plain setting works fine for this and is in line with the way things are done elsewhere.
Diffstat (limited to 'src/dotty/tools/dotc/repl/CompilingInterpreter.scala')
-rw-r--r--src/dotty/tools/dotc/repl/CompilingInterpreter.scala34
1 files changed, 4 insertions, 30 deletions
diff --git a/src/dotty/tools/dotc/repl/CompilingInterpreter.scala b/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
index 954612f1d..7d1da1419 100644
--- a/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
+++ b/src/dotty/tools/dotc/repl/CompilingInterpreter.scala
@@ -88,14 +88,11 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
}
}
- /** interpreter settings */
- override val isettings = new InterpreterSettings
-
private def newReporter = new ConsoleReporter(Console.in, out) {
override def printMessage(msg: String) = {
out.print(/*clean*/(msg) + "\n")
// Suppress clean for now for compiler messages
- // Otherwise we will completely delete all references to
+ // Otherwise we will completely delete all references to
// line$object$ module classes. The previous interpreter did not
// have the project because the module class was written without the final `$'
// and therefore escaped the purge. We can turn this back on once
@@ -200,29 +197,6 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
}
}
- /** A counter used for numbering objects created by <code>bind()</code>. */
- private var binderNum = 0
-
- override def bind(name: String, boundType: String, value: Any)(implicit ctx: Context): Interpreter.Result = {
- val binderName = "binder" + binderNum
- binderNum += 1
-
- compileString(
- "object " + binderName +
- "{ var value: " + boundType + " = _; " +
- " def set(x: Any) = value=x.asInstanceOf[" + boundType + "]; }")
-
- val binderObject =
- Class.forName(binderName, true, classLoader)
- val setterMethod =
- binderObject.getDeclaredMethods.find(_.getName == "set").get
- var argsHolder: Array[Any] = null // this roundabout approach is to try and make sure the value is boxed
- argsHolder = List(value).toArray
- setterMethod.invoke(null, argsHolder.asInstanceOf[Array[AnyRef]])
-
- interpret("val " + name + " = " + binderName + ".value")
- }
-
/** Trait collecting info about one of the statements of an interpreter request */
private trait StatementInfo {
/** The statement */
@@ -741,8 +715,8 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
}
/** Truncate a string if it is longer than settings.maxPrintString */
- private def truncPrintString(str: String): String = {
- val maxpr = isettings.maxPrintString
+ private def truncPrintString(str: String)(implicit ctx: Context): String = {
+ val maxpr = ctx.settings.XreplLineWidth.value
if (maxpr <= 0)
return str
@@ -758,7 +732,7 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
}
/** Clean up a string for output */
- private def clean(str: String) =
+ private def clean(str: String)(implicit ctx: Context) =
truncPrintString(stripWrapperGunk(str))
/** Indent some code by the width of the scala> prompt.