@@ -88,14 +88,11 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
88
88
}
89
89
}
90
90
91
- /** interpreter settings */
92
- override val isettings = new InterpreterSettings
93
-
94
91
private def newReporter = new ConsoleReporter (Console .in, out) {
95
92
override def printMessage (msg : String ) = {
96
93
out.print(/* clean*/ (msg) + " \n " )
97
94
// Suppress clean for now for compiler messages
98
- // Otherwise we will completely delete all references to
95
+ // Otherwise we will completely delete all references to
99
96
// line$object$ module classes. The previous interpreter did not
100
97
// have the project because the module class was written without the final `$'
101
98
// 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
200
197
}
201
198
}
202
199
203
- /** A counter used for numbering objects created by <code>bind()</code>. */
204
- private var binderNum = 0
205
-
206
- override def bind (name : String , boundType : String , value : Any )(implicit ctx : Context ): Interpreter .Result = {
207
- val binderName = " binder" + binderNum
208
- binderNum += 1
209
-
210
- compileString(
211
- " object " + binderName +
212
- " { var value: " + boundType + " = _; " +
213
- " def set(x: Any) = value=x.asInstanceOf[" + boundType + " ]; }" )
214
-
215
- val binderObject =
216
- Class .forName(binderName, true , classLoader)
217
- val setterMethod =
218
- binderObject.getDeclaredMethods.find(_.getName == " set" ).get
219
- var argsHolder : Array [Any ] = null // this roundabout approach is to try and make sure the value is boxed
220
- argsHolder = List (value).toArray
221
- setterMethod.invoke(null , argsHolder.asInstanceOf [Array [AnyRef ]])
222
-
223
- interpret(" val " + name + " = " + binderName + " .value" )
224
- }
225
-
226
200
/** Trait collecting info about one of the statements of an interpreter request */
227
201
private trait StatementInfo {
228
202
/** The statement */
@@ -741,8 +715,8 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
741
715
}
742
716
743
717
/** Truncate a string if it is longer than settings.maxPrintString */
744
- private def truncPrintString (str : String ): String = {
745
- val maxpr = isettings.maxPrintString
718
+ private def truncPrintString (str : String )( implicit ctx : Context ) : String = {
719
+ val maxpr = ctx.settings. XreplLineWidth .value
746
720
747
721
if (maxpr <= 0 )
748
722
return str
@@ -758,7 +732,7 @@ class CompilingInterpreter(out: PrintWriter, ictx: Context) extends Compiler wit
758
732
}
759
733
760
734
/** Clean up a string for output */
761
- private def clean (str : String ) =
735
+ private def clean (str : String )( implicit ctx : Context ) =
762
736
truncPrintString(stripWrapperGunk(str))
763
737
764
738
/** Indent some code by the width of the scala> prompt.
0 commit comments