title: IMain.valueOfTerm only gets last value
body: <pre><code>import scala.tools.nsc._
  import scala.tools.nsc.interpreter._
  
  val settings = new Settings
  val n = new IMain(settings)
  
  n.interpret("""
  val y = 5
  val x = 10
  """)
  println(n.valueOfTerm("y").get)
  
  n.close()
  </code></pre>
  
  <p>I would expect that <code>println</code> would print <code>5</code>, the value of <code>y</code>. Instead it prints <code>10</code>, the value of <code>x</code>.</p>
  
  <p>Now if I interpret this:</p>
  
  <pre><code>n.interpret("""
  val y = 5
  val x = 10
  y
  """)
  </code></pre>
  
  <p>It prints <code>5</code>, the value of <code>y</code>. Therefor I assume <code>valueOfTerm</code> returns only the last mentioned value. Isn't it intended to return the requested value? Anyone can reproduce this? Or is something wrong with my code?</p>
  
  <p>I used Scala 2.10.3 for this setup. <a href="http://www.scala-lang.org/files/archive/nightly/docs-2.10.x/compiler/index.html#scala.tools.nsc.interpreter.IMain" rel="nofollow">Scala Doc IMain</a></p>