| Index: pkg/analyzer/lib/src/dart/analysis/driver.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
|
| index fdb01cb6064e6b4f71caba5eb3cde3f22f10c069..06b6b89b4c08235566bafc442bfbf0e42f93d056 100644
|
| --- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
|
| +++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
|
| @@ -1313,17 +1313,18 @@ class AnalysisDriver implements AnalysisDriverGeneric {
|
| }
|
|
|
| /**
|
| - * Tests need a reliable way to simulate file changes during analysis.
|
| + * Runs any asynchronous work that was injected as part of a test using
|
| + * [AnalysisDriverTestView.workToWaitAfterComputingResult].
|
| *
|
| - * When a change happens, the driver must make sure that [getResult] produces
|
| - * results that include these changes. It is OK for the [results] stream
|
| - * to produce stale results as long as it eventually produces results that
|
| - * also include the changes.
|
| + * If the test view indicates that there is work to do, performs the work
|
| + * and returns a [Future] that will be signaled when the work completes.
|
| + *
|
| + * This gives tests a reliable way to simulate file changes during analysis.
|
| */
|
| Future _runTestAsyncWorkDuringAnalysis(String path) {
|
| var work = _testView.workToWaitAfterComputingResult;
|
| _testView.workToWaitAfterComputingResult = null;
|
| - return work != null ? work(path) : null;
|
| + return work != null ? work(path) : new Future.value();
|
| }
|
|
|
| /**
|
| @@ -1675,6 +1676,12 @@ class AnalysisDriverTestView {
|
|
|
| int numOfAnalyzedLibraries = 0;
|
|
|
| + /**
|
| + * If non-null, a function that should be executed asynchronously after
|
| + * the next result is computed.
|
| + *
|
| + * This can be used by a test to simulate file changes during analysis.
|
| + */
|
| Future<Null> Function(String path) workToWaitAfterComputingResult;
|
|
|
| AnalysisDriverTestView(this.driver);
|
|
|