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 92d552fd8d2c08489febea6ab0e1f0d88be6bde7..bdc1e92f932b909ab01f435651af73bd89f62671 100644 |
--- a/pkg/analyzer/test/src/context/context_test.dart |
+++ b/pkg/analyzer/test/src/context/context_test.dart |
@@ -24,6 +24,7 @@ import 'package:analyzer/src/generated/engine.dart' |
AnalysisOptions, |
AnalysisOptionsImpl, |
AnalysisResult, |
+ CacheState, |
ChangeNotice, |
ChangeSet, |
IncrementalAnalysisCache, |
@@ -578,8 +579,7 @@ import 'libB.dart';'''; |
// Complete all pending analysis tasks and flush the AST so that it won't |
// be available immediately. |
_performPendingAnalysisTasks(); |
- CacheEntry entry = _context.getReadableSourceEntryOrNull(source); |
- entry.flushAstStructures(); |
+ _flushAst(source); |
CancelableFuture<CompilationUnit> future = |
_context.computeResolvedCompilationUnitAsync(source, source); |
bool completed = false; |
@@ -1652,8 +1652,7 @@ main() {}'''); |
// Complete all pending analysis tasks and flush the AST so that it won't |
// be available immediately. |
_performPendingAnalysisTasks(); |
- CacheEntry entry = _context.getReadableSourceEntryOrNull(source); |
- entry.flushAstStructures(); |
+ _flushAst(source); |
// Dispose of the context. |
_context.dispose(); |
// Any attempt to start an asynchronous computation should return a future |
@@ -2116,17 +2115,6 @@ main() {}'''); |
expect(errorInfo.errors, hasLength(0)); |
} |
-// void test_resolveCompilationUnit_sourceChangeDuringResolution() { |
-// _context = new _AnalysisContext_sourceChangeDuringResolution(); |
-// AnalysisContextFactory.initContextWithCore(_context); |
-// _sourceFactory = _context.sourceFactory; |
-// Source source = _addSource("/lib.dart", "library lib;"); |
-// CompilationUnit compilationUnit = |
-// _context.resolveCompilationUnit2(source, source); |
-// expect(compilationUnit, isNotNull); |
-// expect(_context.getLineInfo(source), isNotNull); |
-// } |
- |
void test_parseCompilationUnit_nonExistentSource() { |
Source source = |
new FileBasedSource.con1(FileUtilities2.createFile("/test.dart")); |
@@ -2138,6 +2126,17 @@ main() {}'''); |
} |
} |
+// void test_resolveCompilationUnit_sourceChangeDuringResolution() { |
+// _context = new _AnalysisContext_sourceChangeDuringResolution(); |
+// AnalysisContextFactory.initContextWithCore(_context); |
+// _sourceFactory = _context.sourceFactory; |
+// Source source = _addSource("/lib.dart", "library lib;"); |
+// CompilationUnit compilationUnit = |
+// _context.resolveCompilationUnit2(source, source); |
+// expect(compilationUnit, isNotNull); |
+// expect(_context.getLineInfo(source), isNotNull); |
+// } |
+ |
void test_performAnalysisTask_modifiedAfterParse() { |
// TODO(scheglov) no threads in Dart |
// Source source = _addSource("/test.dart", "library lib;"); |
@@ -2300,8 +2299,7 @@ int a = 0;'''); |
// Complete all pending analysis tasks and flush the AST so that it won't |
// be available immediately. |
_performPendingAnalysisTasks(); |
- CacheEntry entry = _context.getReadableSourceEntryOrNull(source); |
- entry.flushAstStructures(); |
+ _flushAst(source); |
bool completed = false; |
_context |
.computeResolvedCompilationUnitAsync(source, source) |
@@ -2324,8 +2322,7 @@ int a = 0;'''); |
// Complete all pending analysis tasks and flush the AST so that it won't |
// be available immediately. |
_performPendingAnalysisTasks(); |
- CacheEntry entry = _context.getReadableSourceEntryOrNull(source); |
- entry.flushAstStructures(); |
+ _flushAst(source); |
CancelableFuture<CompilationUnit> future = |
_context.computeResolvedCompilationUnitAsync(source, source); |
bool completed = false; |
@@ -2444,6 +2441,11 @@ int a = 0;'''); |
return null; |
} |
+ void _flushAst(Source source) { |
+ CacheEntry entry = _context.getReadableSourceEntryOrNull(source); |
+ entry.setState(RESOLVED_UNIT, CacheState.FLUSHED); |
+ } |
+ |
IncrementalAnalysisCache _getIncrementalAnalysisCache( |
AnalysisContextImpl context2) { |
return context2.test_incrementalAnalysisCache; |