binaryUnmarshalCall generates code for unmarshaling marshaler/appender interfaces
(refname, unmarshalMethod, readType string)
| 388 | |
| 389 | // binaryUnmarshalCall generates code for unmarshaling marshaler/appender interfaces |
| 390 | func (u *unmarshalGen) binaryUnmarshalCall(refname, unmarshalMethod, readType string) { |
| 391 | tmpBytes := randIdent() |
| 392 | refname = strings.Trim(refname, "(*)") |
| 393 | |
| 394 | u.p.printf("\nvar %s []byte", tmpBytes) |
| 395 | if readType == "String" { |
| 396 | u.p.printf("\n%s, bts, err = msgp.ReadStringZC(bts)", tmpBytes) |
| 397 | } else { |
| 398 | u.p.printf("\n%s, bts, err = msgp.ReadBytesZC(bts)", tmpBytes) |
| 399 | } |
| 400 | u.p.wrapErrCheck(u.ctx.ArgsStr()) |
| 401 | u.p.printf("\nerr = %s.%s(%s)", refname, unmarshalMethod, tmpBytes) |
| 402 | } |
| 403 | |
| 404 | func (u *unmarshalGen) gBase(b *BaseElem) { |
| 405 | if !u.p.ok() { |
no test coverage detected