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

Function encodeModuleAugmentations

internal/api/encoder/encoder.go:730–740  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

728// of uint node indices. Returns the byte offset into the buffer, or noStructuredData
729// if the slice is empty.
730func 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.

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