Skip to content

Commit 6e3f1ac

Browse files
authored
Use the existing AnalysisContext in PackageBuilder (#3814)
1 parent 5e8de16 commit 6e3f1ac

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

lib/src/model/package_builder.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,9 @@ class PubPackageBuilder implements PackageBuilder {
190190
Future<DartDocResolvedLibrary?> _resolveLibrary(String filePath) async {
191191
logDebug('Resolving $filePath...');
192192

193-
var analysisContext = _contextCollection.contextFor(_config.inputDir);
194193
// Allow dart source files with inappropriate suffixes (#1897).
195194
final library =
196-
await analysisContext.currentSession.getResolvedLibrary(filePath);
195+
await _analysisContext.currentSession.getResolvedLibrary(filePath);
197196
if (library is ResolvedLibraryResult) {
198197
return DartDocResolvedLibrary(library);
199198
}

lib/src/model/package_graph.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class PackageGraph with CommentReferable, Nameable {
4343

4444
final InheritanceManager3 inheritanceManager = InheritanceManager3();
4545

46-
final AnalysisContext analysisContext;
46+
final AnalysisContext _analysisContext;
4747

4848
/// PackageMeta for the default package.
4949
final PackageMeta packageMeta;
@@ -55,7 +55,7 @@ class PackageGraph with CommentReferable, Nameable {
5555
DartSdk sdk,
5656
this.hasEmbedderSdk,
5757
this.packageMetaProvider,
58-
this.analysisContext,
58+
this._analysisContext,
5959
) : packageMeta = config.topLevelPackageMeta,
6060
sdkLibrarySources = {
6161
for (var lib in sdk.sdkLibraries) sdk.mapDartUri(lib.shortName): lib
@@ -244,7 +244,7 @@ class PackageGraph with CommentReferable, Nameable {
244244
() => ModelNode(
245245
directive,
246246
resolvedLibrary.element,
247-
analysisContext,
247+
_analysisContext,
248248
commentData: commentData,
249249
));
250250
}
@@ -299,7 +299,7 @@ class PackageGraph with CommentReferable, Nameable {
299299
() => ModelNode(
300300
declaration,
301301
element,
302-
analysisContext,
302+
_analysisContext,
303303
commentData: commentData,
304304
),
305305
);

0 commit comments

Comments
 (0)