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

Function includesByName

src/resolution/cpp-includers.ts:86–99  ·  view source on GitHub ↗
(context: ResolutionContext, memo: Memo)

Source from the content-addressed store, hash-verified

84}
85
86function includesByName(context: ResolutionContext, memo: Memo): Map<string, Include[]> {
87 if (memo.byName) return memo.byName;
88 const byName = new Map<string, Include[]>();
89 const nodes = context.getCppIncludeNodes?.() ?? context.iterateNodesByKind?.('import') ?? context.getNodesByKind('import');
90 for (const n of nodes) {
91 if (!isCFamily(n.language)) continue;
92 const name = fileName(n.name);
93 const list = byName.get(name);
94 if (list) list.push(toInclude(n));
95 else byName.set(name, [toInclude(n)]);
96 }
97 memo.byName = byName;
98 return byName;
99}
100
101function includesByStem(context: ResolutionContext, memo: Memo): Map<string, Include[]> {
102 if (memo.byStem) return memo.byStem;

Callers 4

includesByStemFunction · 0.85
cppIncludeTargetsFunction · 0.85
cppIncludedSourcesFunction · 0.85
cppIncludersFunction · 0.85

Calls 9

fileNameFunction · 0.85
toIncludeFunction · 0.85
pushMethod · 0.80
isCFamilyFunction · 0.70
getCppIncludeNodesMethod · 0.65
iterateNodesByKindMethod · 0.65
getNodesByKindMethod · 0.65
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected