MCPcopy
hub / github.com/TarsCloud/TarsGo / genWriteSimpleList

Method genWriteSimpleList

tars/tools/tars2go/gencode/gen_go.go:465–480  ·  view source on GitHub ↗
(mb *ast.StructMember, prefix string, hasRet bool)

Source from the content-addressed store, hash-verified

463}
464
465func (g *GenGo) genWriteSimpleList(mb *ast.StructMember, prefix string, hasRet bool) {
466 tag := strconv.Itoa(int(mb.Tag))
467 unsigned := "Int8"
468 if mb.Type.TypeK.Unsigned {
469 unsigned = "Uint8"
470 }
471 errStr := errString(hasRet)
472 g.P("err = buf.WriteHead(codec.SimpleList, ", tag, ")")
473 g.P(errStr)
474 g.P("err = buf.WriteHead(codec.BYTE, 0)")
475 g.P(errStr)
476 g.P("err = buf.WriteInt32(int32(len(", g.genVariableName(prefix, mb.Key), ")), 0)")
477 g.P(errStr)
478 g.P("err = buf.WriteSlice", unsigned, "(", g.genVariableName(prefix, mb.Key), ")")
479 g.P(errStr)
480}
481
482func (g *GenGo) genWriteVector(mb *ast.StructMember, prefix string, hasRet bool) {
483 if !mb.Require {

Callers 2

genWriteVectorMethod · 0.95
genWriteArrayMethod · 0.95

Calls 3

PMethod · 0.95
genVariableNameMethod · 0.95
errStringFunction · 0.85

Tested by

no test coverage detected