MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / guardsInSource

Function guardsInSource

src/graph/branch-guards.ts:936–950  ·  view source on GitHub ↗
(
  source: string,
  language: Language,
  line: number,
  column: number | null = null
)

Source from the content-addressed store, hash-verified

934
935/** Guards for one site in source text — the test seam; production reads files. */
936export async function guardsInSource(
937 source: string,
938 language: Language,
939 line: number,
940 column: number | null = null
941): Promise<BranchGuard[]> {
942 if (!supportsBranchGuards(language)) return [];
943 const tree = await parse(source, language);
944 if (!tree) return [];
945 try {
946 return guardsInTree(tree.rootNode, source, language, line, column);
947 } finally {
948 tree.delete();
949 }
950}
951
952/** Loops for one site in source text — the test seam; production reads files. */
953export async function loopsInSource(source: string, language: Language, line: number, column: number | null = null): Promise<SiteLoop[]> {

Callers 4

labelAtFunction · 0.90
labelAtFunction · 0.90
guardsAtFunction · 0.90

Calls 4

supportsBranchGuardsFunction · 0.85
guardsInTreeFunction · 0.85
parseFunction · 0.70
deleteMethod · 0.65

Tested by 3

labelAtFunction · 0.72
labelAtFunction · 0.72
guardsAtFunction · 0.72