I have the following macro
object Example {
def doIt(s: String): String = macro doItImpl
def doItImpl(c: Context)(s: c.Expr[String]): c.Expr[String] = {
import c.{ universe => u }
import u._
???
}
}
Instead of the ???
I would like to inspect the line where the method doIt
was called to check if the result of the method was used (in an assignment, method call or whatever). If the result is not used I respond with an error-message.
Call-example:
val s: String = doIt("Hallo") // alright
doIt("Hallo") // ERROR!
Is there a simple way to get the Tree of the whole line?