Using Scala reflection, you can get the value of some element within the AST. For example when I want to get the value of some String within the AST I can use the following statement which works perfectly fine:
a.tree.children.tail.collect({case Literal(Constant(id: String)) => id}).head
However, when the value I want to access is a scala.Symbol instead of a String, the statement above does not return the value:
a.tree.children.tail.collect({case Literal(Constant(id: Symbol)) => id}).head
My question: scala.Symbol appears to be something else than a Literal Constant in the AST?
Aucun commentaire:
Enregistrer un commentaire