Optimization: Cache `Phase#flatClasses` for the current phase
Optimizing Scopes

 - Split branches of hot methods into smaller methods for easier
   profiling and potentially better JITability.
 - Use hand rolled loop rather than List#foreach
Optimize nested Scope creation

Rather than reversing the parent scope and adding all the elements
to the current hash table

    newNestedScope
      Scope#<init>
        Scope#createHash
          Scope#enterAllInHash

We can just copy the hash table of the parent scope in
`newNestedScope` (which is a copy constructor.)

I had to rework the constructors and factory methods for
scopes a little to make this possible, but I think the
end result is clearer, as well as faster.