MCPcopy
hub / github.com/tinylib/msgp / nextShim

Method nextShim

parse/inline.go:63–87  ·  view source on GitHub ↗
(ref *gen.Elem, id string, e gen.Elem)

Source from the content-addressed store, hash-verified

61}
62
63func (fs *FileSet) nextShim(ref *gen.Elem, id string, e gen.Elem) {
64 if (*ref).TypeName() == id {
65 vn := (*ref).Varname()
66 *ref = e.Copy()
67 (*ref).SetVarname(vn)
68 } else {
69 switch el := (*ref).(type) {
70 case *gen.Struct:
71 for i := range el.Fields {
72 fs.nextShim(&el.Fields[i].FieldElem, id, e)
73 }
74 case *gen.Array:
75 fs.nextShim(&el.Els, id, e)
76 case *gen.Slice:
77 fs.nextShim(&el.Els, id, e)
78 case *gen.Map:
79 fs.nextShim(&el.Value, id, e)
80 if el.Key != nil {
81 fs.nextShim(&el.Key, id, e)
82 }
83 case *gen.Ptr:
84 fs.nextShim(&el.Value, id, e)
85 }
86 }
87}
88
89// propInline identifies and inlines candidates
90func (fs *FileSet) propInline() {

Callers 1

findShimMethod · 0.95

Calls 4

TypeNameMethod · 0.65
VarnameMethod · 0.65
CopyMethod · 0.65
SetVarnameMethod · 0.65

Tested by

no test coverage detected