Retrieve the name of the value a Scala macro invocation will be assigned to
问题 I'm attempting to write a macro that would wrap a function and deducting a parameter from the value its invocation will be assigned to. object TestMacros { def foo(name: String): String = name.toUpper def bar = macro barImpl def barImpl(c: Context): c.Expr[String] = { import c.universe._ //TODO extract value name (should be baz) c.Expr[String](Apply( Select(newTermName("TestMacros"), newTermName("foo")), // Probably wrong, just typed it quickly for demonstration purposes List(Literal(Constant