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

Unified Diff: pkg/analysis_server/lib/src/analysis_server.dart

Issue 892493003: Fix incremental resolution of files referenced by multiple contexts. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove temporary testing code Created 5 years, 11 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/analysis_server/lib/src/analysis_server.dart
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 5b8d9837801f8443211b9453c39080e05770b26e..39f45bb2345442a1eb3a112234438295fa09c769 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -836,20 +836,26 @@ class AnalysisServer {
* Set the priority files to the given [files].
*/
void setPriorityFiles(String requestId, List<String> files) {
+ // Note: when a file is a priority file, that information needs to be
+ // propagated to all contexts that analyze the file, so that all contexts
+ // will be able to do incremental resolution of the file. See
+ // dartbug.com/22209.
Map<AnalysisContext, List<Source>> sourceMap =
new HashMap<AnalysisContext, List<Source>>();
List<String> unanalyzed = new List<String>();
files.forEach((file) {
- AnalysisContext analysisContext = getAnalysisContext(file);
- if (analysisContext == null) {
- unanalyzed.add(file);
- } else {
- List<Source> sourceList = sourceMap[analysisContext];
- if (sourceList == null) {
- sourceList = <Source>[];
- sourceMap[analysisContext] = sourceList;
+ AnalysisContext preferredContext = getAnalysisContext(file);
+ Source source = getSource(file);
+ bool contextFound = false;
+ for (AnalysisContext context in folderMap.values) {
+ if (context == preferredContext ||
+ context.getKindOf(source) != SourceKind.UNKNOWN) {
scheglov 2015/01/29 23:22:16 It seems that if analysis isn't complete yet, and
Paul Berry 2015/01/30 00:19:45 Aha, you're right! I'd forgotten that we'd change
+ sourceMap.putIfAbsent(context, () => <Source>[]).add(source);
+ contextFound = true;
}
- sourceList.add(getSource(file));
+ }
+ if (!contextFound) {
+ unanalyzed.add(file);
}
});
if (unanalyzed.isNotEmpty) {
@@ -864,6 +870,9 @@ class AnalysisServer {
sourceList = Source.EMPTY_ARRAY;
}
context.analysisPriorityOrder = sourceList;
+ // Schedule the context for analysis so that it has the opportunity to
+ // cache the AST's for the priority sources as soon as possible.
+ schedulePerformAnalysisOperation(context);
scheglov 2015/01/29 23:22:16 I'm not sure we need this. AFAIK we don't schedul
Paul Berry 2015/01/30 00:19:45 Hmm, I tried the CL without this line at first, an
scheglov 2015/01/30 00:25:49 You are right, _getNextAnalysisTaskForSource handl
});
operationQueue.reschedule();
Source firstSource = files.length > 0 ? getSource(files[0]) : null;
« 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