blob: d0f895ae4d64d8a41dadc5de88ca98f6d76a79a3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
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)
val ttree = toolbox.typeCheck(code.tree)
println(toolbox.runExpr(ttree))
}
|