Patch generated local vars as vals if they are not mutated.

This is important for optimizations to be able to kick in with
enough accuracy. There are typically 2 kinds of such local vars
that are handled by this:
* ParamDefs of tail recursive methods
* Variables captured by lambdas or inner classes, and thus
  transformed to instances of IntRef/ObjectRef/etc. by
  lambdalift.
(not to mention vars declared by the programmer that they don't
mutate.)
Merge pull request #836 from sjrd/refine-vars-as-vals

Patch generated local vars as vals if they are not mutated.