0

I noticed that scala-meta provides transformation functions, but not functions to insert additional code (e.g., import statements, or a method call at every start of a function).

Since all structures (scala.meta.Tree and its children) are immutable, I'm not sure if it possible and how I would achieve this?

Captain Obvious
  • 745
  • 3
  • 17
  • 39

1 Answers1

0

Essentially, A new tree structure has to be built based on the original with whatever modifications are desired. Tree.transform allows just such a thing.

Sledge
  • 178
  • 13