(ctx *WriteContext, value reflect.Value, hasGenerics bool)
| 592 | type stringSliceSerializer struct{} |
| 593 | |
| 594 | func (s stringSliceSerializer) writeDataWithGenerics(ctx *WriteContext, value reflect.Value, hasGenerics bool) { |
| 595 | v := stringSliceValue(value) |
| 596 | buf := ctx.Buffer() |
| 597 | length := len(v) |
| 598 | buf.WriteVarUint32(uint32(length)) |
| 599 | if length == 0 { |
| 600 | return |
| 601 | } |
| 602 | // Write collection flags |
| 603 | // Note: Strings don't need reference tracking per xlang spec (NeedWriteRef(STRING) = false) |
| 604 | if hasGenerics { |
| 605 | // When element type is known from TypeDef, use CollectionDeclSameType and skip element type info |
| 606 | buf.WriteInt8(int8(CollectionDeclSameType)) |
| 607 | } else { |
| 608 | // When element type is not known, write CollectionIsSameType and element type info |
| 609 | buf.WriteInt8(int8(CollectionIsSameType)) |
| 610 | buf.WriteUint8(uint8(STRING)) |
| 611 | } |
| 612 | |
| 613 | // Write elements directly (no ref flag for strings) |
| 614 | for i := 0; i < length; i++ { |
| 615 | writeString(buf, v[i]) |
| 616 | } |
| 617 | } |
| 618 | |
| 619 | func (s stringSliceSerializer) WriteData(ctx *WriteContext, value reflect.Value) { |
| 620 | s.writeDataWithGenerics(ctx, value, false) |
no test coverage detected