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

Function lastNamedOfType

src/extraction/function-ref.ts:626–636  ·  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

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

Callers 1

normalizeSpecialFunction · 0.85

Calls 1

hasMethod · 0.80

Tested by

no test coverage detected