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

Function nodeSourceText

internal/rules/redundant_map_error.go:369–380  ·  view source on GitHub ↗
(sf *ast.SourceFile, node *ast.Node)

Source from the content-addressed store, hash-verified

367}
368
369func nodeSourceText(sf *ast.SourceFile, node *ast.Node) string {
370 if sf == nil || node == nil {
371 return ""
372 }
373 text := sf.Text()
374 pos := scanner.GetTokenPosOfNode(node, sf, false)
375 end := node.End()
376 if pos < 0 || end < pos || end > len(text) {
377 return ""
378 }
379 return text[pos:end]
380}

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected