MCPcopy
hub / github.com/colbymchenry/codegraph / extractName

Function extractName

src/extraction/tree-sitter.ts:65–71  ·  view source on GitHub ↗

* Extract the name from a node based on language

(node: SyntaxNode, source: string, extractor: LanguageExtractor)

Source from the content-addressed store, hash-verified

63 * Extract the name from a node based on language
64 */
65function extractName(node: SyntaxNode, source: string, extractor: LanguageExtractor): string {
66 const name = extractNameRaw(node, source, extractor);
67 // Universal fallback: recover a real identifier from a name still mangled by a
68 // macro the pre-parse didn't blank (C/C++ only — see recoverMangledName). A
69 // no-op on well-formed names, so a clean name is never altered.
70 return extractor.recoverMangledName ? extractor.recoverMangledName(name) : name;
71}
72
73function extractNameRaw(node: SyntaxNode, source: string, extractor: LanguageExtractor): string {
74 const hookName = extractor.resolveName?.(node, source);

Callers 9

extractFunctionMethod · 0.85
extractClassMethod · 0.85
extractMethodMethod · 0.85
extractInterfaceMethod · 0.85
extractStructMethod · 0.85
extractEnumMethod · 0.85
extractVariableMethod · 0.85
extractTypeAliasMethod · 0.85

Calls 1

extractNameRawFunction · 0.85

Tested by

no test coverage detected