MCPcopy Index your code
hub / github.com/go-python/gopy / isStringer

Function isStringer

bind/utils.go:27–55  ·  view source on GitHub ↗
(obj types.Object)

Source from the content-addressed store, hash-verified

25}
26
27func isStringer(obj types.Object) bool {
28 switch obj := obj.(type) {
29 case *types.Func:
30 if obj.Name() != "String" {
31 return false
32 }
33 sig, ok := obj.Type().(*types.Signature)
34 if !ok {
35 return false
36 }
37 if sig.Recv() == nil {
38 return false
39 }
40 if sig.Params().Len() != 0 {
41 return false
42 }
43 res := sig.Results()
44 if res.Len() != 1 {
45 return false
46 }
47 ret := res.At(0).Type()
48 if ret != types.Universe.Lookup("string").Type() {
49 return false
50 }
51 return true
52 default:
53 return false
54 }
55}
56
57func hasError(sig *types.Signature) bool {
58 res := sig.Results()

Callers 5

genMapInitMethod · 0.85
processMethod · 0.85
genSliceInitMethod · 0.85
genStructInitMethod · 0.85
genIfaceInitMethod · 0.85

Calls 6

RecvMethod · 0.80
ParamsMethod · 0.80
ResultsMethod · 0.80
LookupMethod · 0.80
NameMethod · 0.45
AtMethod · 0.45

Tested by

no test coverage detected