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

Function EncodeNode

internal/api/encoder/encoder.go:412–414  ·  view source on GitHub ↗

EncodeNode encodes an arbitrary AST node and its descendants into the binary format. The sourceFile is needed to provide the source text for efficient string encoding. When encoding a non-SourceFile node, the header hash and parse options fields will be zero. Returns the encoded bytes and a NodeInde

(node *ast.Node, sourceFile *ast.SourceFile)

Source from the content-addressed store, hash-verified

410// When encoding a non-SourceFile node, the header hash and parse options fields will be zero.
411// Returns the encoded bytes and a NodeIndexTable mapping encoder indices to AST nodes.
412func EncodeNode(node *ast.Node, sourceFile *ast.SourceFile) ([]byte, *NodeIndexTable, error) {
413 return encodeTree(node, sourceFile)
414}
415
416func encodeTree(rootNode *ast.Node, sourceFile *ast.SourceFile) ([]byte, *NodeIndexTable, error) {
417 var parentIndex, nodeCount, prevIndex uint32

Calls 1

encodeTreeFunction · 0.85

Tested by 1