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

Function classByQualifiedName

src/resolution/pascal-scope.ts:698–713  ·  view source on GitHub ↗

* The class (or record) an implementation header names (`TOuter::TInner`, * generic parameters dropped): the one `filePath` declares, whatever its case * or parameters, else one the file sees.

(qualifiedName: string, filePath: string, context: ResolutionContext)

Source from the content-addressed store, hash-verified

696 * or parameters, else one the file sees.
697 */
698function classByQualifiedName(qualifiedName: string, filePath: string, context: ResolutionContext): Node | null {
699 const memo = memos(context).classByQn;
700 const key = `${filePath}|${qualifiedName}`;
701 if (memo.has(key)) return memo.get(key)!;
702 const exact = context.getNodesByQualifiedName(qualifiedName).filter((n) => n.language === 'pascal' && CLASS_KINDS.has(n.kind));
703 const lower = qualifiedName.toLowerCase();
704 let cls: Node | null = null;
705 for (const file of ownUnitFiles(filePath, context)) {
706 cls = declarationOf(exact.filter((n) => n.filePath === file)) ??
707 declarationOf(outlineOf(file, context).classes.filter((n) => n.qualifiedName.replace(/<[^>]*>/g, '').toLowerCase() === lower));
708 if (cls) break;
709 }
710 cls ??= declarationOf(exact) ?? classNamed(qualifiedName.split('::').pop()!, filePath, context);
711 memo.set(key, cls);
712 return cls;
713}
714
715/**
716 * The class declaration among same-named nodes, not a forward declaration

Callers 2

matchPascalParenlessRefFunction · 0.85
classOfCallFunction · 0.85

Calls 9

memosFunction · 0.85
ownUnitFilesFunction · 0.85
declarationOfFunction · 0.85
outlineOfFunction · 0.85
hasMethod · 0.80
classNamedFunction · 0.70
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected