Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the existing AnalysisContext in PackageBuilder #3814

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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