Use IMain.bindValue to bind repl values. This does a better job of getting the type to use for a bound value.

This commit is contained in:
Mark Harrah 2013-07-17 14:58:53 -04:00
parent 3d11d50ffa
commit 4b8f0f3f94
1 changed files with 15 additions and 3 deletions

View File

@ -40,9 +40,21 @@ class ConsoleInterface
}
else
super.createInterpreter()
for( (id, value) <- bindNames zip bindValues)
interpreter.beQuietDuring(interpreter.bind(id, value.asInstanceOf[AnyRef].getClass.getName, value))
def bind(values: Seq[(String,Any)])
{
// for 2.8 compatibility
final class Compat {
def bindValue(id: String, value: Any) =
interpreter.bind(id, value.asInstanceOf[AnyRef].getClass.getName, value)
}
implicit def compat(a: AnyRef): Compat = new Compat
for( (id, value) <- values )
interpreter.beQuietDuring(interpreter.bindValue(id, value))
}
bind(bindNames zip bindValues)
if(!initialCommands.isEmpty)
interpreter.interpret(initialCommands)