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

Function collectMemberTypeNames

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

Source from the content-addressed store, hash-verified

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

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