MCPcopy Create free account
hub / github.com/go-python/gopy / addMethod

Method addMethod

bind/symbols.go:1136–1161  ·  view source on GitHub ↗
(pkg *types.Package, obj types.Object, t types.Type, kind symkind, id, n string)

Source from the content-addressed store, hash-verified

1134}
1135
1136func (sym *symtab) addMethod(pkg *types.Package, obj types.Object, t types.Type, kind symkind, id, n string) error {
1137 sig := t.Underlying().(*types.Signature)
1138 _, _, _, err := isPyCompatFunc(sig)
1139 if err != nil {
1140 if !NoWarn {
1141 fmt.Printf("ignoring python incompatible method: %v.%v: %v: %v\n", pkg.Name(), obj.String(), t.String(), err)
1142 }
1143 }
1144 if err == nil {
1145 fn := types.ObjectString(obj, nil)
1146 kind |= skFunc
1147 sym.syms[fn] = &symbol{
1148 gopkg: pkg,
1149 goobj: obj,
1150 gotyp: t,
1151 kind: kind,
1152 id: id,
1153 goname: n,
1154 cgoname: fn + "_" + id,
1155 cpyname: fn + "_" + id,
1156 }
1157 sym.processTuple(sig.Results())
1158 sym.processTuple(sig.Params())
1159 }
1160 return nil
1161}
1162
1163func (sym *symtab) addPointerType(pkg *types.Package, obj types.Object, t types.Type, kind symkind, id, n string) error {
1164 fn := sym.fullTypeString(t)

Callers 1

addTypeMethod · 0.95

Calls 7

processTupleMethod · 0.95
isPyCompatFuncFunction · 0.85
PrintfMethod · 0.80
ResultsMethod · 0.80
ParamsMethod · 0.80
NameMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected