Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Unified Diff: pkg/analyzer/lib/src/dart/analysis/driver.dart

Issue 2989633002: Issue 30238. Fix for subscribing for a notifications with already cached analysis result. (Closed)
Patch Set: Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/dart/analysis/driver.dart
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 3fe580f5c197771e8574cadb3198b9763bb6cb04..cc99ae0315e941df00289ee9dd23dd6391db3e2c 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -669,6 +669,8 @@ class AnalysisDriver implements AnalysisDriverGeneric {
* The [path] can be any file - explicitly or implicitly analyzed, or neither.
*
* If the driver has the cached analysis result for the file, it is returned.
+ * If [sendCachedToStream] is `true`, then the result is also reported into
+ * the [results] stream, just as if it were freshly computed.
*
* Otherwise causes the analysis state to transition to "analyzing" (if it is
* not in that state already), the driver will produce the analysis result for
@@ -676,7 +678,8 @@ class AnalysisDriver implements AnalysisDriverGeneric {
* of the files previously reported using [changeFile]), prior to the next
* time the analysis state transitions to "idle".
*/
- Future<AnalysisResult> getResult(String path) {
+ Future<AnalysisResult> getResult(String path,
+ {bool sendCachedToStream: false}) {
if (!_fsState.hasUri(path)) {
return new Future.value();
}
@@ -685,6 +688,9 @@ class AnalysisDriver implements AnalysisDriverGeneric {
{
AnalysisResult result = getCachedResult(path);
if (result != null) {
+ if (sendCachedToStream) {
+ _resultController.add(result);
+ }
return new Future.value(result);
}
}
« no previous file with comments | « pkg/analysis_server/test/analysis/notification_outline_test.dart ('k') | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698