encodeModuleAugmentations encodes a slice of ModuleName nodes as a msgpack array of uint node indices. Returns the byte offset into the buffer, or noStructuredData if the slice is empty.
(nodes []*ast.ModuleName, indexMap map[*ast.Node]uint32, buf *[]byte)
| 728 | // of uint node indices. Returns the byte offset into the buffer, or noStructuredData |
| 729 | // if the slice is empty. |
| 730 | func encodeModuleAugmentations(nodes []*ast.ModuleName, indexMap map[*ast.Node]uint32, buf *[]byte) uint32 { |
| 731 | if len(nodes) == 0 { |
| 732 | return noStructuredData |
| 733 | } |
| 734 | offset := uint32(len(*buf)) |
| 735 | *buf = msgpackWriteArrayHeader(*buf, len(nodes)) |
| 736 | for _, node := range nodes { |
| 737 | *buf = msgpackWriteUint(*buf, indexMap[node.AsNode()]) |
| 738 | } |
| 739 | return offset |
| 740 | } |
| 741 | |
| 742 | // encodeStringArray encodes a slice of strings as a msgpack array of strings. |
| 743 | // Returns the byte offset into the buffer, or noStructuredData if the slice is empty. |
no test coverage detected