Skip to content

Commit

Permalink
API. Add AnalysisContextCollection.dispose() to API.
Browse files Browse the repository at this point in the history
Bug: #56102
Change-Id: I06a53805514655fa01e962bbc98255b5e70f3ed8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/375720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
  • Loading branch information
scheglov authored and Commit Queue committed Jul 15, 2024
1 parent 2516931 commit 86e263f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/analyzer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 6.8.0-dev
* Add `AnalysisContextCollection.dispose()`. It must be invoked at the end.

## 6.7.0
* Deprecated `File.createSource()`, it violates levels of abstraction.
You can get `Source` instances from `AnalysisResult`s.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ abstract class AnalysisContextCollection {
///
/// If [sdkPath] is given, then Dart SDK at this path will be used, otherwise
/// the default Dart SDK will be used.
///
/// [dispose] must be invoked after collection is finished being used.
factory AnalysisContextCollection({
required List<String> includedPaths,
List<String>? excludedPaths,
Expand All @@ -34,4 +36,7 @@ abstract class AnalysisContextCollection {
/// given [path], or throw [StateError] if the [path] is not analyzed in any
/// of the created analysis contexts.
AnalysisContext contextFor(String path);

/// Stops associated processes, and free resources.
Future<void> dispose();
}
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class AnalysisContextCollectionImpl implements AnalysisContextCollection {
throw StateError('Unable to find the context to $path');
}

@override
Future<void> dispose({
bool forTesting = false,
}) async {
Expand Down
2 changes: 1 addition & 1 deletion pkg/analyzer/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: analyzer
version: 6.7.0
version: 6.8.0-dev
description: >-
This package provides a library that performs static analysis of Dart code.
repository: https://github.com/dart-lang/sdk/tree/main/pkg/analyzer
Expand Down

0 comments on commit 86e263f

Please sign in to comment.