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

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

Issue 1350993002: Reset AnalysisDriver on priority sources changes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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/task/model.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 acfb596b846f43f5bf5d8cab4af6ce24492aedd6..ab4df6447dd1f1552de56db080282e648c1f8fca 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -1795,7 +1795,7 @@ void g() { f(null); }''');
// TODO(scheglov) no threads in Dart
// Source source = _addSource("/test.dart", "library lib;");
// int initialTime = _context.getModificationStamp(source);
-// List<Source> sources = new List<Source>();
+// List<Source> sources = <Source>[];
// sources.add(source);
// _context.analysisPriorityOrder = sources;
// _context.parseCompilationUnit(source);
@@ -1910,7 +1910,7 @@ void g() { f(null); }''');
void test_setAnalysisPriorityOrder() {
int priorityCount = 4;
- List<Source> sources = new List<Source>();
+ List<Source> sources = <Source>[];
for (int index = 0; index < priorityCount; index++) {
sources.add(addSource("/lib.dart$index", ""));
}
@@ -1919,15 +1919,28 @@ void g() { f(null); }''');
}
void test_setAnalysisPriorityOrder_empty() {
- context.analysisPriorityOrder = new List<Source>();
+ context.analysisPriorityOrder = <Source>[];
}
void test_setAnalysisPriorityOrder_nonEmpty() {
- List<Source> sources = new List<Source>();
+ List<Source> sources = <Source>[];
sources.add(addSource("/lib.dart", "library lib;"));
context.analysisPriorityOrder = sources;
}
+ void test_setAnalysisPriorityOrder_resetAnalysisDriver() {
+ Source source = addSource('/lib.dart', 'library lib;');
+ // start analysis
+ context.performAnalysisTask();
+ expect(context.driver.currentWorkOrder, isNotNull);
+ // set priority sources, AnalysisDriver is reset
+ context.analysisPriorityOrder = <Source>[source];
+ expect(context.driver.currentWorkOrder, isNull);
+ // analysis continues
+ context.performAnalysisTask();
+ expect(context.driver.currentWorkOrder, isNotNull);
+ }
+
Future test_setChangedContents_libraryWithPart() {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.incremental = true;
@@ -2067,7 +2080,7 @@ int a = 0;''');
options.cacheSize = maxCacheSize;
context.analysisOptions = options;
int sourceCount = maxCacheSize + 2;
- List<Source> sources = new List<Source>();
+ List<Source> sources = <Source>[];
ChangeSet changeSet = new ChangeSet();
for (int i = 0; i < sourceCount; i++) {
Source source = addSource("/lib$i.dart", "library lib$i;");
@@ -2146,8 +2159,8 @@ int a = 0;''');
entry.setState(RESOLVED_UNIT, CacheState.FLUSHED);
}
- List<Source> _getPriorityOrder(AnalysisContextImpl context2) {
- return context2.test_priorityOrder;
+ List<Source> _getPriorityOrder(AnalysisContextImpl context) {
+ return context.test_priorityOrder;
}
void _performPendingAnalysisTasks([int maxTasks = 512]) {
« no previous file with comments | « pkg/analyzer/lib/task/model.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698