I have a following code:
usage.scala
object Test extends App {
import Macros._
val f = 1
Macros.get(f)
}
macros.scala
import language.experimental.macros
import scala.reflect.macros.Context
object Macros {
def get(a: Int) = macro getImpl
def getImpl(c: Context)(a: c.Expr[Int]) = {
import c.universe._
println(showRaw(a))
}
}
It return:
Expr(Select(This(newTypeName("Test")), newTermName("f")))
How to extract from termName("f") a 1 value ?
It's possible with macros?