I have the following code for:
@compileTimeOnly("enable macro paradise to expand macro annotations")
class replace extends StaticAnnotation {
def macroTransform(annottees: Any*) = macro replaceImpl.replace
}
object replaceImpl {
def replace(c: Context)(annottees: c.Expr[Any]*): c.Expr[Any] = {
import c.universe._
// ?
c.Expr[Any](q"")
}
}
Via this code, i want to replace variable name (x
) in next example of usage:
@replace
def foo(x: Int) = x + 1
it's simple method, but if i have a big method with many expression, what are the simpest way to replace variable name (from x
to y
for example)?