Revert "Create new AnalysisSession instance on changes."
This reverts commit 8eb9f3db80801e755a379ef139701daec3ea1fd7.
New sessions, and corresponding InconsistentAnalysisException, cause
breakages in dartwing and pageloader3.
I plan restoring this in a week from now.
R=brianwilkerson@google.com
Change-Id: I88cbb0b6a50138fabed6798aa844c29f0e2a7b24
Reviewed-on: https://dart-review.googlesource.com/47901
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 43a1d47..5c6e63d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -326,6 +326,9 @@
/**
* The current analysis session.
+ *
+ * TODO(brianwilkerson) Create a new session when the current session might
+ * produce inconsistent results.
*/
AnalysisSessionImpl _currentSession;
@@ -353,7 +356,7 @@
_sourceFactory = sourceFactory.clone(),
_sdkBundle = sdkBundle,
_externalSummaries = externalSummaries {
- _createNewSession();
+ _currentSession = new AnalysisSessionImpl(this);
_onResults = _resultController.stream.asBroadcastStream();
_testView = new AnalysisDriverTestView(this);
_createFileTracker();
@@ -1119,7 +1122,6 @@
* of state.
*/
void _changeHook() {
- _createNewSession();
_priorityResults.clear();
_scheduler.notify(this);
}
@@ -1385,13 +1387,6 @@
}
/**
- * Create a new analysis session, so invalidating the current one.
- */
- void _createNewSession() {
- _currentSession = new AnalysisSessionImpl(this);
- }
-
- /**
* Fill [_salt] with data.
*/
void _fillSalt() {
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index 32df76a..6d12d04 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -6725,26 +6725,6 @@
expect(x.constantValue.toIntValue(), 1);
}
- test_currentSession() async {
- var a = _p('/a.dart');
-
- provider.newFile(a, 'var V = 1;');
- await driver.getResult(a);
-
- var session1 = driver.currentSession;
- expect(session1, isNotNull);
-
- provider.updateFile(a, 'var V = 2;');
- driver.changeFile(a);
- await driver.getResult(a);
-
- var session2 = driver.currentSession;
- expect(session2, isNotNull);
-
- // We get a new session.
- expect(session2, isNot(session1));
- }
-
test_errors_uriDoesNotExist_export() async {
addTestFile(r'''
export 'foo.dart';