@@ -137,17 +137,11 @@ func (c *constructor) resolves(call ssa.CallInstruction) []*ssa.Function {
137137
138138// resolve returns a set of functions `c` resolves to based on the
139139// type propagation results in `types`.
140- func resolve (c ssa.CallInstruction , types propTypeMap , cache methodCache ) (fns map [* ssa.Function ]empty ) {
140+ func resolve (c ssa.CallInstruction , types propTypeMap , cache methodCache ) map [* ssa.Function ]empty {
141+ fns := make (map [* ssa.Function ]empty )
141142 n := local {val : c .Common ().Value }
142143 types .propTypes (n )(func (p propType ) bool {
143- pfs := propFunc (p , c , cache )
144- if len (pfs ) == 0 {
145- return true
146- }
147- if fns == nil {
148- fns = make (map [* ssa.Function ]empty )
149- }
150- for _ , f := range pfs {
144+ for _ , f := range propFunc (p , c , cache ) {
151145 fns [f ] = empty {}
152146 }
153147 return true
@@ -174,9 +168,6 @@ func propFunc(p propType, c ssa.CallInstruction, cache methodCache) []*ssa.Funct
174168// ssa.Program.MethodSets and ssa.Program.MethodValue
175169// APIs. The cache is used to speed up querying of
176170// methods of a type as the mentioned APIs are expensive.
177- //
178- // TODO(adonovan): Program.MethodValue already does this kind of
179- // caching. Is this really necessary?
180171type methodCache map [types.Type ]map [string ][]* ssa.Function
181172
182173// methods returns methods of a type `t` named `name`. First consults
0 commit comments