blob: 53b96691e986d8d6534bd7ce16c649578eb75a76 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
import scala.reflect.macros.{BlackboxContext => Ctx}
object Impls {
def foo(c: Ctx)(x: c.Expr[Int]) = {
import c.universe._
val body = Apply(Select(x.tree, TermName("$plus")), List(Literal(Constant(1))))
c.Expr[Int](body)
}
}
object Macros {
def foo(x: Int) = macro Impls.foo
}
|