Skip to content

Commit 8ec198f

Browse files
committed
wip
1 parent 22d77f1 commit 8ec198f

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

compiler/src/dotty/tools/repl/ReplDriver.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,10 @@ class ReplDriver(settings: Array[String],
211211
}
212212

213213
try {
214-
println("hardcodedInputLines " + hardcodedInputLines)
215214
val line =
216215
if (hardcodedInputLines != null) hardcodedInputLines.readLine()
217216
else terminal.readLine(completer)
218-
println("line " + line)
217+
219218
if (line == null) Quit
220219
else ParseResult(line)
221220
} catch {

compiler/src/dotty/tools/repl/ReplMain.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ class ReplMain(
2727
val driver = new ReplDriver(settings, out, classLoader, fullPredef)
2828

2929
if (testCode == "") driver.tryRunning
30-
else {
31-
driver.runUntilQuit(using driver.initialState)(new java.io.ByteArrayInputStream(testCode.getBytes()))
32-
}
30+
else driver.runUntilQuit(using driver.initialState)(
31+
new java.io.ByteArrayInputStream(testCode.getBytes())
32+
)
3333
()
3434
finally
3535
ReplMain.currentBindings.set(null)
@@ -49,12 +49,12 @@ object ReplMain:
4949
'{TypeName[A](${Expr(Type.show[A])})}
5050

5151

52-
case class Bind[T](name: String, value: T)(implicit val typeName: TypeName[T])
52+
case class Bind[T](name: String, value: () => T)(implicit val typeName: TypeName[T])
5353
object Bind:
5454
implicit def ammoniteReplArrowBinder[T](t: (String, T))(implicit typeName: TypeName[T]): Bind[T] = {
55-
Bind(t._1, t._2)(typeName)
55+
Bind(t._1, () => t._2)(typeName)
5656
}
5757

58-
def currentBinding[T](s: String): T = currentBindings.get().apply(s).asInstanceOf[T]
58+
def currentBinding[T](s: String): T = currentBindings.get().apply(s).apply().asInstanceOf[T]
5959

60-
private val currentBindings = new ThreadLocal[Map[String, Any]]()
60+
private val currentBindings = new ThreadLocal[Map[String, () => Any]]()

0 commit comments

Comments
 (0)