encodeNodeIndexArray encodes a slice of LiteralLikeNodes as a msgpack array of uint node indices. Returns the byte offset into the buffer, or noStructuredData if the slice is empty.
(nodes []*ast.LiteralLikeNode, indexMap map[*ast.Node]uint32, buf *[]byte)
| 713 | // uint node indices. Returns the byte offset into the buffer, or noStructuredData |
| 714 | // if the slice is empty. |
| 715 | func encodeNodeIndexArray(nodes []*ast.LiteralLikeNode, indexMap map[*ast.Node]uint32, buf *[]byte) uint32 { |
| 716 | if len(nodes) == 0 { |
| 717 | return noStructuredData |
| 718 | } |
| 719 | offset := uint32(len(*buf)) |
| 720 | *buf = msgpackWriteArrayHeader(*buf, len(nodes)) |
| 721 | for _, node := range nodes { |
| 722 | *buf = msgpackWriteUint(*buf, indexMap[node.AsNode()]) |
| 723 | } |
| 724 | return offset |
| 725 | } |
| 726 | |
| 727 | // encodeModuleAugmentations encodes a slice of ModuleName nodes as a msgpack array |
| 728 | // of uint node indices. Returns the byte offset into the buffer, or noStructuredData |
no test coverage detected