Move DartWorkManager notification to _sourceChanged().

This fixes scheduling analysis after overlay changes.

R=brianwilkerson@google.com
BUG=

Review URL: https://codereview.chromium.org//1126233008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45797 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
scheglov@google.com 2015-05-14 21:51:38 +00:00
parent 05d7eb5dfa
commit dd451d1424
2 changed files with 19 additions and 2 deletions

View file

@ -1171,8 +1171,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
@override
void setContents(Source source, String contents) {
_contentsChanged(source, contents, true);
dartWorkManager.applyChange(
Source.EMPTY_LIST, <Source>[source], Source.EMPTY_LIST);
}
@override
@ -1693,6 +1691,8 @@ class AnalysisContextImpl implements InternalAnalysisContext {
}
// We need to invalidate the cache.
entry.setState(CONTENT, CacheState.INVALID);
dartWorkManager.applyChange(
Source.EMPTY_LIST, <Source>[source], Source.EMPTY_LIST);
}
/**

View file

@ -1664,6 +1664,23 @@ main() {}''');
// assertLength(0, statistics.getSources());
}
void test_handleContentsChanged() {
ContentCache contentCache = new ContentCache();
context.contentCache = contentCache;
String oldContents = 'foo() {}';
String newContents = 'bar() {}';
// old contents
Source source = addSource("/test.dart", oldContents);
_analyzeAll_assertFinished();
expect(context.getResolvedCompilationUnit2(source, source), isNotNull);
// new contents
contentCache.setContents(source, newContents);
context.handleContentsChanged(source, oldContents, newContents, true);
// there is some work to do
AnalysisResult analysisResult = context.performAnalysisTask();
expect(analysisResult.changeNotices, isNotNull);
}
void test_isClientLibrary_dart() {
Source source = addSource("/test.dart", r'''
import 'dart:html';