Fix detection of "foreign" impl classes.

Foreign impl classes are those loaded from .class files.
When they are loaded through their representative's
pickle, they receive the IMPLCLASS flag, and hence
sym.isImplClass is true. However, when they are loaded
through a $class.class file, they do not get the IMPLCLASS
flag, and sym.isImplClass returns false.

This does not really matter to scalac. But to Scala.js,
it matters because impl classes are encoded totally
differently from module classes.

So this commit fixes the issue by doing "true" detection
of impl classes through their name. This done only when
the class is not being compiled in the current compilation
unit, because in that case we now it does have the flag.
Rearrangement of StandardOut/Err.