Last active
May 2, 2016 20:06
-
-
Save leogrim/d86a11c31b2e644ae2ebc7f4d50c0461 to your computer and use it in GitHub Desktop.
Scala Macro Annotation by Martin Raison
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val (className, fields) = try { | |
val q"case class $className(..$fields) extends ..$bases { ..$body }" = classDecl | |
(className, fields) | |
} catch { | |
case _: MatchError => c.abort(c.enclosingPosition, "Annotation is only supported on case class") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment