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

Unified Diff: pkg/analyzer/lib/src/context/context.dart

Issue 1448173002: Add ApplyChangesStatus to AnalysisContext.applyChanges() and use it in DAS. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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 | « pkg/analysis_server/test/analysis_server_test.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/context/context.dart
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart
index feb1f789bf7b33a5aef62633e8e0dc2a23a00f0f..c34ca7be8f7593253be84d137d1f76de2db0b149 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -522,15 +522,14 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
@override
- void applyChanges(ChangeSet changeSet) {
+ ApplyChangesStatus applyChanges(ChangeSet changeSet) {
if (changeSet.isEmpty) {
- return;
+ return new ApplyChangesStatus(false);
}
//
// First, compute the list of sources that have been removed.
//
- List<Source> removedSources =
- new List<Source>.from(changeSet.removedSources);
+ List<Source> removedSources = changeSet.removedSources.toList();
for (SourceContainer container in changeSet.removedContainers) {
_addSourcesInContainer(removedSources, container);
}
@@ -540,13 +539,13 @@ class AnalysisContextImpl implements InternalAnalysisContext {
for (Source source in changeSet.addedSources) {
_sourceAvailable(source);
}
- for (Source source in changeSet.changedSources) {
- if (_contentCache.getContents(source) != null) {
- // This source is overridden in the content cache, so the change will
- // have no effect. Just ignore it to avoid wasting time doing
- // re-analysis.
- continue;
- }
+ // Exclude sources that are overridden in the content cache, so the change
+ // will have no effect. Just ignore it to avoid wasting time doing
+ // re-analysis.
+ List<Source> changedSources = changeSet.changedSources
+ .where((s) => _contentCache.getContents(s) == null)
+ .toList();
+ for (Source source in changedSources) {
Brian Wilkerson 2015/11/16 23:19:32 I don't see why this is better. It creates more ob
_sourceChanged(source);
}
changeSet.changedContents.forEach((Source key, String value) {
@@ -565,9 +564,14 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
for (WorkManager workManager in workManagers) {
workManager.applyChange(
- changeSet.addedSources, changeSet.changedSources, removedSources);
+ changeSet.addedSources, changedSources, removedSources);
}
_onSourcesChangedController.add(new SourcesChangedEvent(changeSet));
+ return new ApplyChangesStatus(changeSet.addedSources.isNotEmpty ||
+ changeSet.changedContents.isNotEmpty ||
+ changeSet.deletedSources.isNotEmpty ||
+ changedSources.isNotEmpty ||
+ removedSources.isNotEmpty);
}
@override
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698