diff options
Diffstat (limited to 'src/compiler/scala/tools/nsc/interpreter/ReplVals.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/interpreter/ReplVals.scala | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala b/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala index 80ccd06c70..2f2489b242 100644 --- a/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala +++ b/src/compiler/scala/tools/nsc/interpreter/ReplVals.scala @@ -6,35 +6,15 @@ package scala.tools.nsc package interpreter -import java.lang.reflect.{ Method => JMethod, Modifier => JModifier } - -final class ReplVals(final val r: ILoop) { - final val vals = this - final val intp = r.intp - final val global = intp.global - final val power = r.power - final val phased = power.phased - final val isettings = intp.isettings - final val completion = r.in.completion - final val history = r.in.history - final val rutil = power.rutil - - /** Reflectively finds the vals defined in this class. */ - private def valMethods = this.getClass.getDeclaredMethods.toList filter { m => - ( - JModifier.isPublic(m.getModifiers()) - && m.getParameterTypes.isEmpty - && !m.getName.contains('$') - ) - } - - /** Binds each val declared here into the repl with explicit singleton types - * based on the given prefix. - */ - def bindWithPrefix(prefix: String) { - valMethods foreach { m => - repldbg("intp.bind " + (m.getName, prefix + "." + m.getName + ".type", m.invoke(this))) - intp.bind(m.getName, prefix + "." + m.getName + ".type", m.invoke(this)) - } - } +final class ReplVals(r: ILoop) { + lazy val repl = r + lazy val intp = r.intp + lazy val power = r.power + lazy val reader = r.in + lazy val vals = this + lazy val global = intp.global + lazy val isettings = intp.isettings + lazy val completion = reader.completion + lazy val history = reader.history + lazy val phased = power.phased } |