blob: 449b91d074ff830b143a15a449e0efa729af3853 (
plain) (
tree)
|
|
import scala.reflect.makro.{Context => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int])(y: c.Expr[Int]) = {
import c.mirror._
val sum = Apply(Select(x.tree, newTermName("$plus")), List(y.tree))
val body = Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(sum))
Expr[Unit](body)
}
}
object Macros {
def foo(x: Int)(y: Int) = macro Impls.foo
}
|