goose: refactor *gen.inject
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>
This commit is contained in:
@@ -48,9 +48,8 @@ type call struct {
|
||||
name string
|
||||
|
||||
// args is a list of arguments to call the provider with. Each element is:
|
||||
// a) one of the givens (args[i] < len(given)),
|
||||
// b) the result of a previous provider call (args[i] >= len(given)), or
|
||||
// c) the zero value for the type (args[i] == -1).
|
||||
// a) one of the givens (args[i] < len(given)), or
|
||||
// b) the result of a previous provider call (args[i] >= len(given))
|
||||
//
|
||||
// This will be nil for kind == valueExpr.
|
||||
args []int
|
||||
|
||||
Reference in New Issue
Block a user