0

I want get StaticAnnotation's parameters defined as:

class Log(logTag: List[LogTag] = Info() :: Nil )
         (implicit logger: String => Unit = a => {println(a)})
  extends scala.annotation.StaticAnnotation {
  inline def apply(defn: Any): Any = meta {
    val logTag = ??? //todo
    val logger = ??? //todo
  }
}

How to get the logTag and logger Function values in meta block? I have seem meta tutorials about this point. But the Lit just refers Int/Double,etc, rather then custom class type.

LoranceChen
  • 2,453
  • 2
  • 22
  • 48

1 Answers1

0

You can deconstruct this as a scala.meta.Tree to get the class parameters. See http://scalameta.org/tutorial/#HowdoIpassanargumenttothemacroannotation%3F for an example