blob: 10487b1515ccfaa2f78638f75f236a6564b7e36f (
plain) (
tree)
|
|
object Test extends App {
//val list: List[String] = Macros.foo("hello world")
//println(list)
import scala.reflect.runtime.universe._
import scala.reflect.runtime.{currentMirror => cm}
import scala.tools.reflect.ToolBox
val tpt = AppliedTypeTree(Ident(definitions.ListClass), List(Ident(definitions.StringClass)))
val rhs = Apply(Select(Ident(newTermName("Macros")), newTermName("foo")), List(Literal(Constant("hello world"))))
val list = ValDef(NoMods, newTermName("list"), tpt, rhs)
val tree = Block(list, Apply(Select(Ident(definitions.PredefModule), newTermName("println")), List(Ident(list.name))))
println(cm.mkToolBox().eval(tree))
}
|