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

Function cppClassWritten

src/resolution/cpp-supertypes.ts:252–263  ·  view source on GitHub ↗
(written: string, site: CppNameSite, ref: UnresolvedRef, context: ResolutionContext)

Source from the content-addressed store, hash-verified

250 * several classes could be.
251 */
252export function cppClassWritten(written: string, site: CppNameSite, ref: UnresolvedRef, context: ResolutionContext): CppWrittenClass | null | undefined {
253 // One reference asks about one name several times, a strategy at a time.
254 let memo = CLASSES_WRITTEN.get(context);
255 if (!memo) CLASSES_WRITTEN.set(context, (memo = new Map()));
256 const key = `${written}\0${site.scope}\0${site.file}\0${site.line}\0${site.classScope ?? ''}\0${site.declared ? 1 : 0}\0${site.self?.id ?? ''}\0${site.parameters.size > 0 ? [...site.parameters].join() : ''}\0${ref.filePath}\0${ref.fromNodeId}\0${ref.referenceKind}\0${ref.referenceName}\0${ref.line}\0${ref.column}`;
257 const hit = memo.get(key);
258 if (hit !== undefined) return hit === false ? undefined : hit;
259 const found = lookUpCppClass(written, site, ref, context);
260 if (memo.size >= 100_000) memo.clear();
261 memo.set(key, found === undefined ? false : found);
262 return found;
263}
264
265function lookUpCppClass(written: string, site: CppNameSite, ref: UnresolvedRef, context: ResolutionContext): CppWrittenClass | null | undefined {
266 const segments = cppTypeSegments(written);

Callers 9

templateOfClassMethod · 0.90
typedTestTemplateMethod · 0.90
writtenAsMethod · 0.90
typedListsMethod · 0.90
typeListMethod · 0.90
classWrittenMethod · 0.90
matchCppSupertypeFunction · 0.85
matchCppDeclaredTypeFunction · 0.85

Calls 5

lookUpCppClassFunction · 0.85
getMethod · 0.65
setMethod · 0.45
joinMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected