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

Function collectDeclaratorTypeNames

src/extraction/languages/c-cpp.ts:161–169  ·  view source on GitHub ↗

The types a declarator names, past the type written before it: a function pointer's parameters.

(declarator: SyntaxNode, own: ReadonlySet<string>, source: string, names: CTypeName[])

Source from the content-addressed store, hash-verified

159
160/** The types a declarator names, past the type written before it: a function pointer's parameters. */
161function collectDeclaratorTypeNames(declarator: SyntaxNode, own: ReadonlySet<string>, source: string, names: CTypeName[]): void {
162 if (declarator.type === 'function_declarator') {
163 const parameters = getChildByField(declarator, 'parameters');
164 if (parameters) collectCTypeNames(parameters, own, source, names);
165 }
166 if (!declarator.type.endsWith('declarator')) return;
167 const inner = innerDeclarator(declarator);
168 if (inner) collectDeclaratorTypeNames(inner, own, source, names);
169}
170
171/** Collects the type names under `node` onto `names`, in source order. */
172function collectCTypeNames(node: SyntaxNode, own: ReadonlySet<string>, source: string, names: CTypeName[]): void {

Callers 2

cAliasTypeNamesFunction · 0.85
collectMemberTypeNamesFunction · 0.85

Calls 3

getChildByFieldFunction · 0.90
collectCTypeNamesFunction · 0.85
innerDeclaratorFunction · 0.85

Tested by

no test coverage detected