blob: d89a5e380da51acaf03ecb6444ecf644554ae8e3 (
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 x1 = c.Expr[Int](c.resetAllAttrs(x.tree))
c.Expr[Int](Literal(Constant(c.eval(x1))))
}
}
object Macros {
def foo(x: Int) = macro Impls.foo
}
|