Is it possible to access the symbol table in a macro?

For example, to get all the values ​​and their types available on the macro invocation site? Or at least just the values ​​from the current class? For instance:.

class A {
  val v1 = 10
  var v2 = "2"

  def m {
    val m3 = true

    // Here I would like to get information that v1: Int, v2: String and
    // v3: Boolean are available
    macroInvocation() 
  }
}

I looked into the Context and the Universe, but did not find any good methods.

The only solution I have found so far is to get a macro spanning the class / method (through the context) and look for the tree.

+5
source share
1 answer

The only solution I have found so far is to get a macro spanning the class / method (via context) and look for the tree

, , , . . c Context, :

c.enclosingClass.symbol.typeSignature.members
+2

All Articles