blob: 1fc18cfa135e4a41203b7cab2dae5e3873138950 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
import scala.reflect.mirror._
object Test extends App {
def foo(y: Int) = {
class Foo(val y: Int) {
def fun = reify{y}
}
val toolbox = mkToolBox()
val dyn = toolbox.runExpr(new Foo(y).fun.tree)
dyn.asInstanceOf[Int]
}
println(foo(10))
}
|