有没有办法在scala中的对象方法中找到代码的解析树?据我了解,这可以用于作为参数传递给 reify 方法的表达式,如下所示...
import scala.reflect.runtime.universe._
//I am able to retrieve a scala.reflect.api.Trees$Tree for this block of code...
val i=1
val tree1=reify{
val b=i*3
println("b was "+b)
}.tree
println("tree1->"+tree1)
//Is it possible to obtain a tree for the block of code encapsulated in fooTest?
object foo{
def fooTest(i:Int)={
val b=i*3
println("b was "+b)
}
}