MCPcopy Create free account
hub / github.com/Effect-TS/tsgo / nodeText

Function nodeText

internal/typeparser/reconstruct.go:11–22  ·  view source on GitHub ↗

nodeText extracts the source text of a node from the source file.

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

Source from the content-addressed store, hash-verified

9
10// nodeText extracts the source text of a node from the source file.
11func nodeText(sf *ast.SourceFile, node *ast.Node) string {
12 if node == nil || sf == nil {
13 return ""
14 }
15 text := sf.Text()
16 pos := node.Pos()
17 end := node.End()
18 if pos >= 0 && end >= pos && end <= len(text) {
19 return text[pos:end]
20 }
21 return ""
22}
23
24// ReconstructPipingFlow reconstructs a piping flow into a string expression
25// by applying transformations sequentially.

Calls

no outgoing calls