(c *Cache, name string)
| 198 | } |
| 199 | |
| 200 | func (s *methodset) method(c *Cache, name string) *method { |
| 201 | if s.methods == nil { |
| 202 | s.methods = make(map[string]*method, s.numMethod) |
| 203 | } else if m := s.methods[name]; m != nil { |
| 204 | return m |
| 205 | } |
| 206 | for ; s.idx < s.numMethod; s.idx++ { |
| 207 | rm := s.rType.Method(s.idx) |
| 208 | if !rm.IsExported() { |
| 209 | continue |
| 210 | } |
| 211 | nt := c.FromType(rm.Type) |
| 212 | if s.rType.Kind() != reflect.Interface { |
| 213 | nt.Method = true |
| 214 | nt.MethodIndex = rm.Index |
| 215 | // In case of interface type method will not have a receiver, |
| 216 | // and to prevent checker decreasing numbers of in arguments |
| 217 | // return method type as not method (second argument is false). |
| 218 | |
| 219 | // Also, we can not use m.Index here, because it will be |
| 220 | // different indexes for different types which implement |
| 221 | // the same interface. |
| 222 | } |
| 223 | m := &method{ |
| 224 | Method: rm, |
| 225 | nature: nt, |
| 226 | } |
| 227 | s.methods[rm.Name] = m |
| 228 | if rm.Name == name { |
| 229 | return m |
| 230 | } |
| 231 | } |
| 232 | return nil |
| 233 | } |
no test coverage detected