The function had grown too long. Several related cleanups:
- Factored out the function return value logic, which had been
duplicated between providers and injectors.
- Moved code generation for different provider call types into separate
functions. This moves injector-specific state to a new type
injectorGen to keep the parameter count down.
- Since it's infeasible to keep the "shadow pass" collecting import
identifiers in sync the spread out logic, the injector code
generation is just run twice, with initial output discarded.
- Removed the zero value logic left over from Optional.
Reviewed-by: Tuo Shan <shantuo@google.com>