blob: ad279fac6d3f7a63d8cedc867c29fd0d7ee3b208 (
plain) (
tree)
|
|
import scala.reflect.Code._
import scala.tools.nsc.reporters._
import scala.tools.nsc.Settings
import reflect.runtime.Mirror.ToolBox
object Test extends App {
def foo(y: Int) = {
class Foo(y: Int) {
def fun = lift{y}
}
val reporter = new ConsoleReporter(new Settings)
val toolbox = new ToolBox(reporter)
val dyn = toolbox.runExpr(new Foo(y).fun.tree)
dyn.asInstanceOf[Int]
}
println(foo(10))
}
|