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

Method Execute

gen/encode.go:95–121  ·  view source on GitHub ↗
(p Elem, ctx Context)

Source from the content-addressed store, hash-verified

93}
94
95func (e *encodeGen) Execute(p Elem, ctx Context) error {
96 e.ctx = &ctx
97 if !e.p.ok() {
98 return e.p.err
99 }
100 p = e.applyall(p)
101 if p == nil {
102 return nil
103 }
104 if !IsPrintable(p) {
105 return nil
106 }
107
108 e.p.comment("EncodeMsg implements msgp.Encodable")
109 rcv := imutMethodReceiver(p)
110 ogVar := p.Varname()
111 if p.AlwaysPtr(nil) {
112 rcv = methodReceiver(p)
113 }
114 e.p.printf("\nfunc (%s %s) EncodeMsg(en *msgp.Writer) (err error) {", ogVar, rcv)
115 next(e, p)
116 if p.AlwaysPtr(nil) {
117 p.SetVarname(ogVar)
118 }
119 e.p.nakedReturn()
120 return e.p.err
121}
122
123func (e *encodeGen) gStruct(s *Struct) {
124 if !e.p.ok() {

Callers

nothing calls this directly

Calls 12

IsPrintableFunction · 0.85
imutMethodReceiverFunction · 0.85
methodReceiverFunction · 0.85
nextFunction · 0.85
okMethod · 0.80
applyallMethod · 0.80
commentMethod · 0.80
printfMethod · 0.80
nakedReturnMethod · 0.80
VarnameMethod · 0.65
AlwaysPtrMethod · 0.65
SetVarnameMethod · 0.65

Tested by

no test coverage detected