mirror of
https://github.com/dart-lang/sdk
synced 2024-10-03 04:31:45 +00:00
Fixed bug in implicit analysis notification and renamed tests
R=scheglov@google.com Review URL: https://codereview.chromium.org//1236013003 .
This commit is contained in:
parent
cb5335dc4a
commit
d37ac8d4d0
|
@ -1659,7 +1659,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
|||
|
||||
void _removeFromCache(Source source) {
|
||||
CacheEntry entry = _cache.remove(source);
|
||||
if (entry != null && entry.explicitlyAdded) {
|
||||
if (entry != null && !entry.explicitlyAdded) {
|
||||
_implicitAnalysisEventsController
|
||||
.add(new ImplicitAnalysisEvent(source, false));
|
||||
}
|
||||
|
|
|
@ -4599,7 +4599,7 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
|||
|
||||
void _removeFromCache(Source source) {
|
||||
SourceEntry entry = _cache.remove(source);
|
||||
if (entry != null && entry.explicitlyAdded) {
|
||||
if (entry != null && !entry.explicitlyAdded) {
|
||||
_implicitAnalysisEventsController
|
||||
.add(new ImplicitAnalysisEvent(source, false));
|
||||
}
|
||||
|
|
|
@ -245,21 +245,6 @@ class AnalysisContextImplTest extends EngineTestCase {
|
|||
super.tearDown();
|
||||
}
|
||||
|
||||
Future test_analyzedSources_added() async {
|
||||
AnalyzedSourcesListener listener = new AnalyzedSourcesListener();
|
||||
_context.implicitAnalysisEvents.listen(listener.onData);
|
||||
//
|
||||
// Create a file that references an file that is not explicitly being
|
||||
// analyzed and fully analyze it. Ensure that the listener is told about
|
||||
// the implicitly analyzed file.
|
||||
//
|
||||
Source sourceA = _addSource('/a.dart', "library a; import 'b.dart';");
|
||||
Source sourceB = _createSource('/b.dart', "library b;");
|
||||
_context.computeErrors(sourceA);
|
||||
await pumpEventQueue();
|
||||
listener.expectAnalyzed(sourceB);
|
||||
}
|
||||
|
||||
Future test_applyChanges_add() {
|
||||
SourcesChangedListener listener = new SourcesChangedListener();
|
||||
_context.onSourcesChanged.listen(listener.onData);
|
||||
|
@ -1348,6 +1333,21 @@ main() {}''');
|
|||
// assertLength(0, statistics.getSources());
|
||||
}
|
||||
|
||||
Future test_implicitAnalysisEvents_added() async {
|
||||
AnalyzedSourcesListener listener = new AnalyzedSourcesListener();
|
||||
_context.implicitAnalysisEvents.listen(listener.onData);
|
||||
//
|
||||
// Create a file that references an file that is not explicitly being
|
||||
// analyzed and fully analyze it. Ensure that the listener is told about
|
||||
// the implicitly analyzed file.
|
||||
//
|
||||
Source sourceA = _addSource('/a.dart', "library a; import 'b.dart';");
|
||||
Source sourceB = _createSource('/b.dart', "library b;");
|
||||
_context.computeErrors(sourceA);
|
||||
await pumpEventQueue();
|
||||
listener.expectAnalyzed(sourceB);
|
||||
}
|
||||
|
||||
void test_isClientLibrary_dart() {
|
||||
_context = AnalysisContextFactory.oldContextWithCore();
|
||||
_sourceFactory = _context.sourceFactory;
|
||||
|
|
|
@ -55,7 +55,7 @@ main() {
|
|||
|
||||
@reflectiveTest
|
||||
class AnalysisContextImplTest extends AbstractContextTest {
|
||||
Future fail_analyzedSources_removed() async {
|
||||
Future fail_implicitAnalysisEvents_removed() async {
|
||||
AnalyzedSourcesListener listener = new AnalyzedSourcesListener();
|
||||
context.implicitAnalysisEvents.listen(listener.onData);
|
||||
//
|
||||
|
@ -116,24 +116,6 @@ class AnalysisContextImplTest extends AbstractContextTest {
|
|||
super.tearDown();
|
||||
}
|
||||
|
||||
Future test_analyzedSources_added() async {
|
||||
AnalyzedSourcesListener listener = new AnalyzedSourcesListener();
|
||||
context.implicitAnalysisEvents.listen(listener.onData);
|
||||
//
|
||||
// Create a file that references an file that is not explicitly being
|
||||
// analyzed and fully analyze it. Ensure that the listener is told about
|
||||
// the implicitly analyzed file.
|
||||
//
|
||||
Source sourceA = newSource('/a.dart', "library a; import 'b.dart';");
|
||||
Source sourceB = newSource('/b.dart', "library b;");
|
||||
ChangeSet changeSet = new ChangeSet();
|
||||
changeSet.addedSource(sourceA);
|
||||
context.applyChanges(changeSet);
|
||||
context.computeErrors(sourceA);
|
||||
await pumpEventQueue();
|
||||
listener.expectAnalyzed(sourceB);
|
||||
}
|
||||
|
||||
Future test_applyChanges_add() {
|
||||
SourcesChangedListener listener = new SourcesChangedListener();
|
||||
context.onSourcesChanged.listen(listener.onData);
|
||||
|
@ -1250,6 +1232,24 @@ main() {}''');
|
|||
expect(analysisResult.changeNotices, isNotNull);
|
||||
}
|
||||
|
||||
Future test_implicitAnalysisEvents_added() async {
|
||||
AnalyzedSourcesListener listener = new AnalyzedSourcesListener();
|
||||
context.implicitAnalysisEvents.listen(listener.onData);
|
||||
//
|
||||
// Create a file that references an file that is not explicitly being
|
||||
// analyzed and fully analyze it. Ensure that the listener is told about
|
||||
// the implicitly analyzed file.
|
||||
//
|
||||
Source sourceA = newSource('/a.dart', "library a; import 'b.dart';");
|
||||
Source sourceB = newSource('/b.dart', "library b;");
|
||||
ChangeSet changeSet = new ChangeSet();
|
||||
changeSet.addedSource(sourceA);
|
||||
context.applyChanges(changeSet);
|
||||
context.computeErrors(sourceA);
|
||||
await pumpEventQueue();
|
||||
listener.expectAnalyzed(sourceB);
|
||||
}
|
||||
|
||||
void test_isClientLibrary_dart() {
|
||||
Source source = addSource("/test.dart", r'''
|
||||
import 'dart:html';
|
||||
|
|
Loading…
Reference in a new issue