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

Function collectCTypeNames

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

Collects the type names under `node` onto `names`, in source order.

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

Source from the content-addressed store, hash-verified

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 {
170 if (COMPUTED_TYPE_SPECIFIERS.has(node.type)) return;
171 if (node.type === 'type_identifier' || node.type === 'qualified_identifier' || node.type === 'template_type') {
172 const name = stripCppTemplateArgs(getNodeText(node, source)).trim();
173 if (name && !own.has(name) && !C_STANDARD_TYPE_NAME.test(name)) names.push({ name, node });
174 collectTemplateArguments(node, own, source, names);
175 return;
176 }
177 const tag = CLASS_LIKE_SPECIFIERS.has(node.type) ? getChildByField(node, 'name') : null;
178 for (const c of tag ? [tag] : node.namedChildren) collectCTypeNames(c, own, source, names);
179}
180
181/** The types the template arguments of a written name name, wherever in the name they are. */
182function collectTemplateArguments(node: SyntaxNode, own: ReadonlySet<string>, source: string, names: CTypeName[]): void {

Callers 4

cAliasTypeNamesFunction · 0.85
collectMemberTypeNamesFunction · 0.85
collectTemplateArgumentsFunction · 0.85

Calls 6

getNodeTextFunction · 0.90
getChildByFieldFunction · 0.90
stripCppTemplateArgsFunction · 0.85
collectTemplateArgumentsFunction · 0.85
hasMethod · 0.80
pushMethod · 0.80

Tested by

no test coverage detected