MCPcopy Index your code
hub / github.com/php/frankenphp / extractNodeSource

Function extractNodeSource

internal/extgen/astutil.go:27–34  ·  view source on GitHub ↗

extractNodeSource returns the verbatim source text covered by node in src.

(src []byte, fset *token.FileSet, node ast.Node)

Source from the content-addressed store, hash-verified

25
26// extractNodeSource returns the verbatim source text covered by node in src.
27func extractNodeSource(src []byte, fset *token.FileSet, node ast.Node) string {
28 start := fset.Position(node.Pos()).Offset
29 end := fset.Position(node.End()).Offset
30 if start < 0 || end > len(src) || start > end {
31 return ""
32 }
33 return string(src[start:end])
34}
35
36// checkOrphanDirectives returns an error for the first comment that matches re
37// but whose source line was not consumed by a declaration.

Callers 2

parseMethod · 0.85
parseMethodsMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected