blob: c8c3d255c4169c29705d9cc84db96914d6bb7b99 (
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.blackbox.Context
object Impls {
def impl(c: Context)(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: Context) = impl(c)("fooNullary")
def fooEmpty(c: Context)() = impl(c)("fooEmpty")
def barNullary(c: Context)(x: c.Expr[Int]) = impl(c)("barNullary")
def barEmpty(c: Context)(x: c.Expr[Int])() = impl(c)("barEmpty")
}
|