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

Function usedUnitFiles

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

The files of the units a file uses, in the order its `uses` clauses name them.

(fromFile: string, context: ResolutionContext)

Source from the content-addressed store, hash-verified

2344
2345/** The files of the units a file uses, in the order its `uses` clauses name them. */
2346function usedUnitFiles(fromFile: string, context: ResolutionContext): string[] {
2347 const memo = memos(context).usedFiles;
2348 const hit = memo.get(fromFile);
2349 if (hit) return hit;
2350 // The unit's `uses` clauses, then those of the files it includes: mORMot's
2351 // `.inc` files open the unit's implementation with one.
2352 const unit = unitFilesOf(fromFile, context);
2353 const files: string[] = [];
2354 const add = (name: string, own: string): void => {
2355 const file = unitFileNamed(name.toLowerCase(), own, context);
2356 if (file && !unit.includes(file) && !files.includes(file)) files.push(file);
2357 };
2358 for (const own of unit) {
2359 // What an include file in a clause lists comes first: `uses {$I mormot.uses.inc} mormot.core.base, …`.
2360 for (const name of unitsIncludedInUses(own, context)) add(name, own);
2361 for (const imp of outlineOf(own, context).imports) add(imp.name, own);
2362 }
2363 memo.set(fromFile, files);
2364 return files;
2365}
2366
2367/**
2368 * The units an include file in one of a file's `uses` clauses lists

Callers 9

unitRoutineInScopeFunction · 0.85
helperVisibleFunction · 0.85
declarationInScopeFunction · 0.85
headOfFunction · 0.85
typeOfLinksFunction · 0.85
visibleClassNamedFunction · 0.85
nearestHelperFunction · 0.85
matchPascalHelperCallFunction · 0.85
visibleFunction · 0.85

Calls 7

memosFunction · 0.85
unitFilesOfFunction · 0.85
unitsIncludedInUsesFunction · 0.85
outlineOfFunction · 0.85
addFunction · 0.70
getMethod · 0.65
setMethod · 0.45

Tested by

no test coverage detected