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

Add minimal AnalysisDriverModel implementation #3814

Merged
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Address review comments.
davidmorgan committed Feb 3, 2025
commit ef704b8da2a245cf1378f03c474bc68d3956c86f
12 changes: 2 additions & 10 deletions build_resolvers/lib/src/analysis_driver_model.dart
Original file line number Diff line number Diff line change
@@ -118,19 +118,10 @@ class AnalysisDriverModel {
});
}

/// Walks the import graph from [ids], returns full transitive deps.s
/// Walks the import graph from [ids], returns full transitive deps.
Future<Set<AssetId>> _expandToTransitive(
AssetReader reader, Iterable<AssetId> ids) async {
final result = <AssetId>{};
await __expandToTransitive(reader, ids, result);
return result;
}

/// Walks the import graph from [ids], ignoring nodes already in [result].
///
/// Call with [result] empty to add full transitive deps to [result].
Future<void> __expandToTransitive(
AssetReader reader, Iterable<AssetId> ids, Set<AssetId> result) async {
final nextIds = Queue.of(ids);
while (nextIds.isNotEmpty) {
final nextId = nextIds.removeFirst();
@@ -145,6 +136,7 @@ class AnalysisDriverModel {
final deps = _parseDependencies(content, nextId);
nextIds.addAll(deps.where((id) => !result.contains(id)));
}
return result;
}
}