Skip to content

Instantly share code, notes, and snippets.

View proboscis's full-sized avatar

Proboscis proboscis

View GitHub Profile
@proboscis
proboscis / TimeMeasuring.scala
Created November 11, 2013 15:20
This is a macro that inserts time-measuring logic into all methods declared in the modules which are annotated with "hello"
import scala.reflect.macros.Context
import scala.language.experimental.macros
import scala.annotation.StaticAnnotation
object helloMacro {
def impl(c: Context)(annottees: c.Expr[Any]*): c.Expr[Any] = {
import c.universe._
import Flag._
val result = {
annottees.map(_.tree).toList match {