Skip to content

Commit e696dce

Browse files
committed
implement usageResolver
1 parent 49caef5 commit e696dce

File tree

9 files changed

+810
-1245
lines changed

9 files changed

+810
-1245
lines changed

packages/cli/src/languagePlugins2/python/dependencyResolver/index.ts

Lines changed: 204 additions & 195 deletions
Large diffs are not rendered by default.

packages/cli/src/languagePlugins2/python/exportResolver/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ describe("PythonExportResolver", () => {
139139
const filePath = "project/module.py";
140140
const cacheKey = `${filePath}|symbols`;
141141

142-
expect(resolver["exportedSymbolCache"].has(cacheKey)).toBe(false);
142+
expect(resolver["cache"].has(cacheKey)).toBe(false);
143143
const symbolsFirstCall = resolver.getSymbols(filePath);
144-
expect(resolver["exportedSymbolCache"].has(cacheKey)).toBe(true);
144+
expect(resolver["cache"].has(cacheKey)).toBe(true);
145145

146146
const symbolsSecondCall = resolver.getSymbols(filePath);
147147
expect(symbolsSecondCall).toBe(symbolsFirstCall);

packages/cli/src/languagePlugins2/python/exportResolver/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface ExportedSymbol {
3333
export class PythonExportResolver {
3434
private files: Map<string, { path: string; rootNode: Parser.SyntaxNode }>;
3535
private parser: Parser;
36-
private exportedSymbolCache = new Map<string, ExportedSymbol[]>(); // Caching extracted symbols for efficiency
36+
private cache = new Map<string, ExportedSymbol[]>(); // Caching extracted symbols for efficiency
3737

3838
constructor(
3939
parser: Parser,
@@ -50,7 +50,7 @@ export class PythonExportResolver {
5050
* @returns Cached exported symbols if available, otherwise undefined.
5151
*/
5252
private getFromExportedSymbolCache(cacheKey: string) {
53-
return this.exportedSymbolCache.get(cacheKey) || undefined;
53+
return this.cache.get(cacheKey) || undefined;
5454
}
5555

5656
/**
@@ -359,7 +359,7 @@ export class PythonExportResolver {
359359
});
360360

361361
// Store result in cache
362-
this.exportedSymbolCache.set(cacheKey, exportedSymbols);
362+
this.cache.set(cacheKey, exportedSymbols);
363363

364364
return exportedSymbols;
365365
}

packages/cli/src/languagePlugins2/python/moduleResolver/index copy.ts

Lines changed: 0 additions & 166 deletions
This file was deleted.

0 commit comments

Comments
 (0)