Fix for #4518 -- classes not getting added to compiler.classes
The responsibility for adding classes to the compiler's classes list (for use
in constructing classes.txt) moved around a bit in the 0.25 to 2.6 transition
before being dropped in a merge conflict resolution. Ooops. This restores it,
and adds tests to prevent regression.