MCPcopy Index your code
hub / github.com/microsoft/typescript-go / encodeNodeIndexArray

Function encodeNodeIndexArray

internal/api/encoder/encoder.go:715–725  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

713// uint node indices. Returns the byte offset into the buffer, or noStructuredData
714// if the slice is empty.
715func 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

Callers 1

encodeTreeFunction · 0.85

Calls 4

lenFunction · 0.85
msgpackWriteArrayHeaderFunction · 0.85
msgpackWriteUintFunction · 0.85
AsNodeMethod · 0.65

Tested by

no test coverage detected