Skip to content

Commit

Permalink
Use the existing AnalysisContext in PackageBuilder (#3814)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins committed Jul 8, 2024
1 parent 5e8de16 commit 6e3f1ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
3 changes: 1 addition & 2 deletions lib/src/model/package_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,9 @@ class PubPackageBuilder implements PackageBuilder {
Future<DartDocResolvedLibrary?> _resolveLibrary(String filePath) async {
logDebug('Resolving $filePath...');

var analysisContext = _contextCollection.contextFor(_config.inputDir);
// Allow dart source files with inappropriate suffixes (#1897).
final library =
await analysisContext.currentSession.getResolvedLibrary(filePath);
await _analysisContext.currentSession.getResolvedLibrary(filePath);
if (library is ResolvedLibraryResult) {
return DartDocResolvedLibrary(library);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/src/model/package_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class PackageGraph with CommentReferable, Nameable {

final InheritanceManager3 inheritanceManager = InheritanceManager3();

final AnalysisContext analysisContext;
final AnalysisContext _analysisContext;

/// PackageMeta for the default package.
final PackageMeta packageMeta;
Expand All @@ -55,7 +55,7 @@ class PackageGraph with CommentReferable, Nameable {
DartSdk sdk,
this.hasEmbedderSdk,
this.packageMetaProvider,
this.analysisContext,
this._analysisContext,
) : packageMeta = config.topLevelPackageMeta,
sdkLibrarySources = {
for (var lib in sdk.sdkLibraries) sdk.mapDartUri(lib.shortName): lib
Expand Down Expand Up @@ -244,7 +244,7 @@ class PackageGraph with CommentReferable, Nameable {
() => ModelNode(
directive,
resolvedLibrary.element,
analysisContext,
_analysisContext,
commentData: commentData,
));
}
Expand Down Expand Up @@ -299,7 +299,7 @@ class PackageGraph with CommentReferable, Nameable {
() => ModelNode(
declaration,
element,
analysisContext,
_analysisContext,
commentData: commentData,
),
);
Expand Down

0 comments on commit 6e3f1ac

Please sign in to comment.