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

Function collectMemberTypeNames

src/extraction/languages/c-cpp.ts:136–155  ·  view source on GitHub ↗
(list: SyntaxNode, own: ReadonlySet<string>, source: string, names: CTypeName[])

Source from the content-addressed store, hash-verified

134}
135
136function collectMemberTypeNames(list: SyntaxNode, own: ReadonlySet<string>, source: string, names: CTypeName[]): void {
137 for (const child of list.namedChildren) {
138 if (MEMBER_CONDITIONALS.has(child.type)) {
139 collectMemberTypeNames(child, own, source, names);
140 continue;
141 }
142 if (child.type !== 'field_declaration') continue;
143 const type = getChildByField(child, 'type');
144 if (!type) continue;
145 const declarators = child.childrenForFieldName('declarator').filter((d: SyntaxNode | null): d is SyntaxNode => !!d);
146 const unnamedBody = CLASS_LIKE_SPECIFIERS.has(type.type) && !getChildByField(type, 'name')
147 ? getChildByField(type, 'body')
148 : null;
149 if (unnamedBody) collectMemberTypeNames(unnamedBody, own, source, names);
150 else if (declarators.length > 0) collectCTypeNames(type, own, source, names);
151 for (const declarator of declarators) {
152 if (!declaresMemberFunction(declarator)) collectDeclaratorTypeNames(declarator, own, source, names);
153 }
154 }
155}
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 {

Callers 1

cMemberTypeNamesFunction · 0.85

Calls 5

getChildByFieldFunction · 0.90
collectCTypeNamesFunction · 0.85
declaresMemberFunctionFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected