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

Unified Diff: pkg/analyzer/test/generated/engine_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
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/engine_test.dart
diff --git a/pkg/analyzer/test/generated/engine_test.dart b/pkg/analyzer/test/generated/engine_test.dart
index eb87ea7897f9da7254f200b760a922b99de0e40c..4d2007cf8148fdbc3a8bffc5aeb74559fbbb9cb2 100644
--- a/pkg/analyzer/test/generated/engine_test.dart
+++ b/pkg/analyzer/test/generated/engine_test.dart
@@ -10,6 +10,7 @@ library engine.engine_test;
import 'dart:async';
import 'dart:collection';
+import 'package:analyzer/file_system/memory_file_system.dart';
import 'package:analyzer/src/cancelable_future.dart';
import 'package:analyzer/src/context/cache.dart' show CacheEntry;
import 'package:analyzer/src/generated/ast.dart';
@@ -447,6 +448,41 @@ import 'libB.dart';''';
});
}
+ /**
+ * IDEA uses the following scenarion:
Brian Wilkerson 2015/07/06 16:14:41 "scenarion" --> "scenario"
+ * 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 = AnalysisContextFactory.oldContextWithCore();
+ _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() {
_context = AnalysisContextFactory.oldContextWithCore();
SourcesChangedListener listener = new SourcesChangedListener();
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/src/context/context_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698