(p Elem, ctx Context)
| 93 | } |
| 94 | |
| 95 | func (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 | |
| 123 | func (e *encodeGen) gStruct(s *Struct) { |
| 124 | if !e.p.ok() { |
nothing calls this directly
no test coverage detected