summaryrefslogtreecommitdiff
path: root/test/pending/run/macro-reify-eval-vs-value/Macros_1.scala
blob: 98dd93b0f8cde73a559beff839c67a39d410fe01 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import scala.reflect.makro.{Context => Ctx}

object Macros {
  def fooEval(s: String) = macro Impls.fooEval
  def fooValue(s: String) = macro Impls.fooValue

  object Impls {
    def fooEval(c: Ctx)(s: c.Expr[String]) = c.reify {
      println("hello " + s.eval)
      println("hello " + s.eval)
    }

    def fooValue(c: Ctx)(s: c.Expr[String]) = c.reify {
      {
        println("hello " + s.value)
        def sayHello = println(s.value)
        sayHello
      }
      println("hello " + s.eval);
      {
        println("hello " + s.eval)
      }
    }
  }
}