()
| 155 | } |
| 156 | |
| 157 | func (stct *Struct) Methods() (methods []*Function) { |
| 158 | for _, file := range stct.Package().Files() { |
| 159 | for _, fn := range file.Functions() { |
| 160 | recv := fn.Receiver() |
| 161 | if recv == nil { |
| 162 | continue |
| 163 | } |
| 164 | if TypeName(recv.Type()) != stct.Name() { |
| 165 | continue |
| 166 | } |
| 167 | methods = append(methods, fn) |
| 168 | } |
| 169 | } |
| 170 | return methods |
| 171 | } |
| 172 | |
| 173 | func (stct *Struct) Method(name string) *Function { |
| 174 | for _, method := range stct.Methods() { |