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

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

Issue 2453693002: Analyze priority files first. (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | no next file » | 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 b01894771a07a1420283a7a2b322160cf8afaffe..5d92e0725beaedfe1ad44cd83ab3d18ce1eb19f2 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -108,15 +108,20 @@ class AnalysisDriver {
PackageBundle _sdkBundle;
/**
- * The mapping from the files for which analysis was requested using
- * [getResult] to the [Completer]s to report the result.
+ * The set of explicitly analyzed files.
*/
- final _requestedFiles = <String, List<Completer<AnalysisResult>>>{};
+ final _explicitFiles = new LinkedHashSet<String>();
/**
- * The set of explicitly analyzed files.
+ * The set of priority files, that should be analyzed sooner.
*/
- final _explicitFiles = new LinkedHashSet<String>();
+ final _priorityFiles = new LinkedHashSet<String>();
+
+ /**
+ * The mapping from the files for which analysis was requested using
+ * [getResult] to the [Completer]s to report the result.
+ */
+ final _requestedFiles = <String, List<Completer<AnalysisResult>>>{};
/**
* The set of files were reported as changed through [changeFile] and not
@@ -176,7 +181,9 @@ class AnalysisDriver {
* between priority files, nor between priority and non-priority files.
*/
void set priorityFiles(List<String> priorityPaths) {
- // TODO(scheglov) implement
+ _priorityFiles.clear();
+ _priorityFiles.addAll(priorityPaths);
+ _hasWork.notify();
}
/**
@@ -220,7 +227,27 @@ class AnalysisDriver {
continue;
}
- // Analyze the first file in the general queue.
+ // TODO(scheglov) analyze requested files
+
+ // Analyze a priority file.
+ if (_priorityFiles.isNotEmpty) {
+ bool analyzed = false;
+ for (String path in _priorityFiles) {
+ if (_filesToAnalyze.remove(path)) {
+ _File file = _fileForPath(path);
+ AnalysisResult result = _computeAnalysisResult(file);
+ yield result;
+ break;
Paul Berry 2016/10/31 16:51:40 Do need to set `analyzed = true` here? Otherwise
scheglov 2016/10/31 17:38:52 Yes, you are right, we need to set `analyzed = tru
+ }
+ }
+ // Repeat the processing loop.
+ if (analyzed) {
+ _hasWork.notify();
+ continue;
+ }
+ }
+
+ // Analyze a general file.
if (_filesToAnalyze.isNotEmpty) {
String path = _removeFirst(_filesToAnalyze);
_File file = _fileForPath(path);
@@ -235,7 +262,6 @@ class AnalysisDriver {
analysisSection.exit();
analysisSection = null;
}
- // TODO(scheglov) implement
} finally {
print('The stream was cancelled.');
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698