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

Method recurse

bind/gen_func.go:13–33  ·  view source on GitHub ↗
(gotype types.Type, prefix, name string)

Source from the content-addressed store, hash-verified

11)
12
13func (g *pyGen) recurse(gotype types.Type, prefix, name string) {
14 switch t := gotype.(type) {
15 case *types.Basic:
16 // pass
17 case *types.Map:
18 g.recurse(t.Elem(), prefix, "Map_"+t.Key().String()+"_string_elem")
19 case *types.Named:
20 o := t.Obj()
21 if o == nil || o.Pkg() == nil {
22 return
23 }
24 g.recurse(t.Underlying(), prefix, o.Pkg().Name()+"_"+o.Name())
25 case *types.Struct:
26 for i := 0; i < t.NumFields(); i++ {
27 f := t.Field(i)
28 g.recurse(f.Type(), prefix, name+"_"+f.Name()+"_Get")
29 }
30 case *types.Slice:
31 g.recurse(t.Elem(), prefix, "Slice_string_elem")
32 }
33}
34
35// genFuncSig generates just the signature for binding
36// returns false if function is not suitable for python

Callers

nothing calls this directly

Calls 3

StringMethod · 0.45
ObjMethod · 0.45
NameMethod · 0.45

Tested by

no test coverage detected