forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsupply.go
35 lines (27 loc) · 790 Bytes
/
supply.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package depinject
import (
"reflect"
"cosmossdk.io/depinject/internal/graphviz"
)
type supplyResolver struct {
typ reflect.Type
value reflect.Value
loc Location
graphNode *graphviz.Node
}
func (s supplyResolver) getType() reflect.Type {
return s.typ
}
func (s supplyResolver) describeLocation() string {
return s.loc.String()
}
func (s supplyResolver) addNode(provider *simpleProvider, _ int) error {
return duplicateDefinitionError(s.typ, provider.provider.Location, s.loc.String())
}
func (s supplyResolver) resolve(c *container, _ *moduleKey, caller Location) (reflect.Value, error) {
c.logf("Supplying %v from %s to %s", s.typ, s.loc, caller.Name())
return s.value, nil
}
func (s supplyResolver) typeGraphNode() *graphviz.Node {
return s.graphNode
}