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

Unified Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 1218573003: Try to use incremental resolution after removing overlays. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
Index: pkg/analyzer/test/src/context/context_test.dart
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart
index af84f24c6b3a9bbd4e66eecb185f0b5780f50e23..37c5939f1001f3dfcbfcf73e429adc2a315feaf1 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -6,6 +6,7 @@ library test.src.context.context_test;
import 'dart:async';
+import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/src/cancelable_future.dart';
import 'package:analyzer/src/context/cache.dart';
import 'package:analyzer/src/context/context.dart';
@@ -277,6 +278,40 @@ import 'libB.dart';''';
});
}
+ /**
+ * IDEA uses the following scenarion:
+ * 1. Add overlay.
+ * 2. Change overlay.
+ * 3. If the contents of the document buffer is the same as the contents
+ * of the file, remove overlay.
+ * So, we need to try to use incremental resolution for removing overlays too.
+ */
+ void test_applyChanges_remove_incremental() {
+ MemoryResourceProvider resourceProvider = new MemoryResourceProvider();
+ Source source = resourceProvider.newFile('/test.dart', r'''
+main() {
+ print(1);
+}
+''').createSource();
+ context.analysisOptions = new AnalysisOptionsImpl()..incremental = true;
+ context.applyChanges(new ChangeSet()..addedSource(source));
+ // remember compilation unit
+ _analyzeAll_assertFinished();
+ CompilationUnit unit = context.getResolvedCompilationUnit2(source, source);
+ // add overlay
+ context.setContents(source, r'''
+main() {
+ print(12);
+}
+''');
+ _analyzeAll_assertFinished();
+ expect(context.getResolvedCompilationUnit2(source, source), unit);
+ // remove overlay
+ context.setContents(source, null);
+ _analyzeAll_assertFinished();
+ expect(context.getResolvedCompilationUnit2(source, source), unit);
+ }
+
Future test_applyChanges_removeContainer() {
SourcesChangedListener listener = new SourcesChangedListener();
context.onSourcesChanged.listen(listener.onData);
« pkg/analyzer/test/generated/engine_test.dart ('K') | « pkg/analyzer/test/generated/engine_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698