blob: b6ec8e8911d05f06698445b7deb72de80cb7f508 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import scala.reflect.Code._
import scala.tools.nsc.reporters._
import scala.tools.nsc.Settings
import reflect.runtime.Mirror.ToolBox
object Test extends App {
val x = 2
val y = 3
val code = lift{println(x + y); x + y}
val reporter = new ConsoleReporter(new Settings)
val toolbox = new ToolBox(reporter)
println(toolbox.runExpr(code.tree))
}
|