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

Function collectDeclaratorTypeNames

src/extraction/languages/c-cpp.ts:158–166  ·  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

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