@@ -137,17 +137,11 @@ func (c *constructor) resolves(call ssa.CallInstruction) []*ssa.Function {
137
137
138
138
// resolve returns a set of functions `c` resolves to based on the
139
139
// 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 )
141
142
n := local {val : c .Common ().Value }
142
143
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 ) {
151
145
fns [f ] = empty {}
152
146
}
153
147
return true
@@ -174,9 +168,6 @@ func propFunc(p propType, c ssa.CallInstruction, cache methodCache) []*ssa.Funct
174
168
// ssa.Program.MethodSets and ssa.Program.MethodValue
175
169
// APIs. The cache is used to speed up querying of
176
170
// 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?
180
171
type methodCache map [types.Type ]map [string ][]* ssa.Function
181
172
182
173
// methods returns methods of a type `t` named `name`. First consults
0 commit comments