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

Function lastNamedOfType

src/extraction/function-ref.ts:629–639  ·  view source on GitHub ↗

Rightmost descendant-or-self named child of one of the given types.

(node: SyntaxNode, types: Set<string>)

Source from the content-addressed store, hash-verified

627
628/** Rightmost descendant-or-self named child of one of the given types. */
629function lastNamedOfType(node: SyntaxNode, types: Set<string>): SyntaxNode | null {
630 let found: SyntaxNode | null = null;
631 for (let i = 0; i < node.namedChildCount; i++) {
632 const child = node.namedChild(i);
633 if (!child) continue;
634 if (types.has(child.type)) found = child;
635 const deeper = lastNamedOfType(child, types);
636 if (deeper) found = deeper;
637 }
638 return found;
639}
640
641function normalizeSpecial(
642 node: SyntaxNode,

Callers 1

normalizeSpecialFunction · 0.85

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected