blob: 5da33babd34adc3f3ed07a6a2c19acef9f5dafc1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
import scala.reflect.runtime.universe._
import scala.reflect.macros.{BlackboxContext => Ctx}
object Impls {
def impl(c: Ctx)(meth: String) = {
import c.universe._
val body = Apply(Select(Ident(definitions.PredefModule), TermName("println")), List(Literal(Constant(meth))))
c.Expr[Unit](body)
}
def fooNullary(c: Ctx) = impl(c)("fooNullary")
def fooEmpty(c: Ctx)() = impl(c)("fooEmpty")
def barNullary(c: Ctx)(x: c.Expr[Int]) = impl(c)("barNullary")
def barEmpty(c: Ctx)(x: c.Expr[Int])() = impl(c)("barEmpty")
}
|