Rewrite fields of local instances as vals.
If a local instance does not escape the local scope, it will be removed later by DropNoEffects, thus implementing the equivalent of (local) multi parameter value classes. The main motivation for this transformation is to get ride of the intermediate tuples object somes created when pattern matching on Scala2 case classes.
Clears all the state of this optimisation, to be run last.
Does the actual Tree => Tree transformation.