summaryrefslogtreecommitdiff
path: root/test/files/run/macro-enclosures/Impls_Macros_1.scala
blob: dfffb48e736f2fb2448095df2ee244fb7b1616a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import scala.reflect.macros.BlackboxContext

object Macros {
  def impl(c: BlackboxContext) = {
    import c.universe._
    reify {
      println("enclosingPackage = " + c.Expr[String](Literal(Constant(c.enclosingPackage.toString))).splice)
      println("enclosingClass = " + c.Expr[String](Literal(Constant(c.enclosingClass.toString))).splice)
      println("enclosingImpl = " + c.Expr[String](Literal(Constant(c.enclosingImpl.toString))).splice)
      println("enclosingTemplate = " + c.Expr[String](Literal(Constant(c.enclosingTemplate.toString))).splice)
      println("enclosingMethod = " + c.Expr[String](Literal(Constant(c.enclosingMethod.toString))).splice)
      println("enclosingDef = " + c.Expr[String](Literal(Constant(c.enclosingDef.toString))).splice)
    }
  }

  def foo = macro impl
}