Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class json extends StaticAnnotation {
- def macroTransform(annottees: Any*) = macro impl
- private def impl(c: Context)(annottees: c.Expr[Any]*): c.Expr[Any] = {
- import c.universe._
- def modifiedClass(classDecl: ClassDef, compDeclOpt: Option[ModuleDef]) = {
- // Class modification logic goes here
- }
- annottees.map(_.tree) match {
- case (classDecl: ClassDef) :: Nil => modifiedClass(c, classDecl)
- case (classDecl: ClassDef) :: (compDecl: ModuleDef) :: Nil => modifiedClass(c, classDecl, Some(compDecl))
- case _ => c.abort(c.enclosingPosition, "Invalid annottee")
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement