EXCLUSIVE_LOCKS_REQUIRED(prog.methodsMu)
(mset *ssaMethodSet, sel *Selection)
| 69 | |
| 70 | // EXCLUSIVE_LOCKS_REQUIRED(prog.methodsMu) |
| 71 | func (prog *Program) addMethod(mset *ssaMethodSet, sel *Selection) *Function { |
| 72 | if sel.Kind() == MethodExpr { |
| 73 | panic(sel) |
| 74 | } |
| 75 | id := sel.Obj().Id() |
| 76 | fn := mset.mapping[id] |
| 77 | if fn == nil { |
| 78 | obj := sel.Obj().(*Func) |
| 79 | |
| 80 | needsPromotion := len(sel.Index()) > 1 |
| 81 | needsIndirection := !isPointer(recvType(obj)) && isPointer(sel.Recv()) |
| 82 | if needsPromotion || needsIndirection { |
| 83 | fn = prog.makeWrapper(sel) |
| 84 | } else { |
| 85 | fn = prog.declaredFunc(obj) |
| 86 | } |
| 87 | if fn.Signature.Recv() == nil { |
| 88 | panic(fn) // missing receiver |
| 89 | } |
| 90 | mset.mapping[id] = fn |
| 91 | } |
| 92 | return fn |
| 93 | } |
| 94 | |
| 95 | // RuntimeTypes returns a new unordered slice containing all |
| 96 | // concrete types in the program for which a complete (non-empty) |
no test coverage detected