Slight refactoring of type checking code generation