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 d8c2527f92554c4c73e337398c165e19ee68a19c..8eba8dbefabce1ed1779e9a42626101d25987daa 100644 |
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart |
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart |
@@ -539,6 +539,23 @@ class AnalysisDriver implements AnalysisDriverGeneric { |
} |
/** |
+ * Return the cached [AnalysisResult] for the Dart file with the given [path]. |
+ * If there is no cached result, return `null`. Usually only results of |
+ * priority files are cached. |
+ * |
+ * The [path] must be absolute and normalized. |
+ * |
+ * The [path] can be any file - explicitly or implicitly analyzed, or neither. |
+ */ |
+ AnalysisResult getCachedResult(String path) { |
+ AnalysisResult result = _priorityResults[path]; |
+ if (disableChangesAndCacheAllResults) { |
+ result ??= _allCachedResults[path]; |
+ } |
+ return result; |
+ } |
+ |
+ /** |
* Return a [Future] that completes with the [ErrorsResult] for the Dart |
* file with the given [path]. If the file is not a Dart file or cannot |
* be analyzed, the [Future] completes with `null`. |
@@ -666,10 +683,7 @@ class AnalysisDriver implements AnalysisDriverGeneric { |
// Return the cached result. |
{ |
- AnalysisResult result = _priorityResults[path]; |
- if (disableChangesAndCacheAllResults) { |
- result ??= _allCachedResults[path]; |
- } |
+ AnalysisResult result = getCachedResult(path); |
if (result != null) { |
return new Future.value(result); |
} |