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

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

Issue 2495403003: getResult() should not try to compute for non-Dart files. (Closed)
Patch Set: Created 4 years, 1 month 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f18e7675ddd0b14aa0aec549acb808e62a7134d9..543e3828d86e6b3876ee63256c3e6101796bb46d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -342,8 +342,9 @@ class AnalysisDriver {
}
/**
- * Return the [Future] that completes with a [AnalysisResult] for the file
- * with the given [path].
+ * Return the [Future] that completes with a [AnalysisResult] for the Dart
+ * file with the given [path]. If the file is not a Dart file, the [Future]
+ * completes with `null`.
*
* The [path] must be absolute and normalized.
*
@@ -356,13 +357,16 @@ class AnalysisDriver {
* transitions to "idle".
*/
Future<AnalysisResult> getResult(String path) {
- var completer = new Completer<AnalysisResult>();
- _requestedFiles
- .putIfAbsent(path, () => <Completer<AnalysisResult>>[])
- .add(completer);
- _statusSupport.transitionToAnalyzing();
- _scheduler._notify(this);
- return completer.future;
+ if (AnalysisEngine.isDartFileName(path)) {
+ var completer = new Completer<AnalysisResult>();
+ _requestedFiles
+ .putIfAbsent(path, () => <Completer<AnalysisResult>>[])
+ .add(completer);
+ _statusSupport.transitionToAnalyzing();
+ _scheduler._notify(this);
+ return completer.future;
+ }
+ return new Future.value();
}
/**
« no previous file with comments | « no previous file | pkg/analyzer/test/src/dart/analysis/driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698