Small Refactoring

Move code generation into translation unit when all parts of the
implementation file have been parsed.