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

Method findShim

parse/inline.go:36–61  ·  view source on GitHub ↗

begin recursive search for identities with the given name and replace them with e

(id string, e gen.Elem, addID bool)

Source from the content-addressed store, hash-verified

34// begin recursive search for identities with the
35// given name and replace them with e
36func (fs *FileSet) findShim(id string, e gen.Elem, addID bool) {
37 for name, el := range fs.Identities {
38 pushstate(name)
39 switch el := el.(type) {
40 case *gen.Struct:
41 for i := range el.Fields {
42 fs.nextShim(&el.Fields[i].FieldElem, id, e)
43 }
44 case *gen.Array:
45 fs.nextShim(&el.Els, id, e)
46 case *gen.Slice:
47 fs.nextShim(&el.Els, id, e)
48 case *gen.Map:
49 fs.nextShim(&el.Value, id, e)
50 if el.Key != nil {
51 fs.nextShim(&el.Key, id, e)
52 }
53 case *gen.Ptr:
54 fs.nextShim(&el.Value, id, e)
55 }
56 popstate()
57 }
58 if addID {
59 fs.Identities[id] = e
60 }
61}
62
63func (fs *FileSet) nextShim(ref *gen.Elem, id string, e gen.Elem) {
64 if (*ref).TypeName() == id {

Callers 6

applyShimFunction · 0.80
replaceFunction · 0.80
binmarshalFunction · 0.80
binappendFunction · 0.80
textmarshalFunction · 0.80
textappendFunction · 0.80

Calls 3

nextShimMethod · 0.95
pushstateFunction · 0.85
popstateFunction · 0.85

Tested by

no test coverage detected