| Index: pkg/analyzer/lib/src/generated/engine.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
|
| index 3c63b7cf90c96fd15d116b5dee6aa3e910095341..259c4d8fb25af8e44c8eca4db0de2c3a1888728c 100644
|
| --- a/pkg/analyzer/lib/src/generated/engine.dart
|
| +++ b/pkg/analyzer/lib/src/generated/engine.dart
|
| @@ -863,6 +863,14 @@ abstract class AnalysisContext {
|
| * so that the default contents will be returned.
|
| */
|
| void setContents(Source source, String contents);
|
| +
|
| + /**
|
| + * Check the cache for any invalid entries (entries whose modification time
|
| + * does not match the modification time of the source associated with the
|
| + * entry). Invalid entries will be marked as invalid so that the source will
|
| + * be re-analyzed. Return `true` if at least one entry was invalid.
|
| + */
|
| + bool validateCacheConsistency();
|
| }
|
|
|
| /**
|
| @@ -2270,9 +2278,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
| AnalysisTask task = PerformanceStatistics.nextTask
|
| .makeCurrentWhile(() => nextAnalysisTask);
|
| int getEnd = JavaSystem.currentTimeMillis();
|
| - if (task == null && _validateCacheConsistency()) {
|
| - task = nextAnalysisTask;
|
| - }
|
| if (task == null) {
|
| _validateLastIncrementalResolutionResult();
|
| if (_performAnalysisTaskStopwatch != null) {
|
| @@ -2567,6 +2572,60 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
| }
|
|
|
| @override
|
| + bool validateCacheConsistency() {
|
| + int consistencyCheckStart = JavaSystem.nanoTime();
|
| + List<Source> changedSources = new List<Source>();
|
| + List<Source> missingSources = new List<Source>();
|
| + MapIterator<Source, SourceEntry> iterator = _cache.iterator();
|
| + while (iterator.moveNext()) {
|
| + Source source = iterator.key;
|
| + SourceEntry sourceEntry = iterator.value;
|
| + int sourceTime = getModificationStamp(source);
|
| + if (sourceTime != sourceEntry.modificationTime) {
|
| + changedSources.add(source);
|
| + }
|
| + if (sourceEntry.exception != null) {
|
| + if (!exists(source)) {
|
| + missingSources.add(source);
|
| + }
|
| + }
|
| + }
|
| + int count = changedSources.length;
|
| + for (int i = 0; i < count; i++) {
|
| + _sourceChanged(changedSources[i]);
|
| + }
|
| + int removalCount = 0;
|
| + for (Source source in missingSources) {
|
| + if (getLibrariesContaining(source).isEmpty &&
|
| + getLibrariesDependingOn(source).isEmpty) {
|
| + _cache.remove(source);
|
| + removalCount++;
|
| + }
|
| + }
|
| + int consistencyCheckEnd = JavaSystem.nanoTime();
|
| + if (changedSources.length > 0 || missingSources.length > 0) {
|
| + StringBuffer buffer = new StringBuffer();
|
| + buffer.write("Consistency check took ");
|
| + buffer.write((consistencyCheckEnd - consistencyCheckStart) / 1000000.0);
|
| + buffer.writeln(" ms and found");
|
| + buffer.write(" ");
|
| + buffer.write(changedSources.length);
|
| + buffer.writeln(" inconsistent entries");
|
| + buffer.write(" ");
|
| + buffer.write(missingSources.length);
|
| + buffer.write(" missing sources (");
|
| + buffer.write(removalCount);
|
| + buffer.writeln(" removed");
|
| + for (Source source in missingSources) {
|
| + buffer.write(" ");
|
| + buffer.writeln(source.fullName);
|
| + }
|
| + _logInformation(buffer.toString());
|
| + }
|
| + return changedSources.length > 0;
|
| + }
|
| +
|
| + @override
|
| void visitCacheItems(void callback(Source source, SourceEntry dartEntry,
|
| DataDescriptor rowDesc, CacheState state)) {
|
| bool hintsEnabled = _options.hint;
|
| @@ -4033,16 +4092,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
| AnalysisEngine.instance.logger.logInformation(message);
|
| }
|
|
|
| - /**
|
| - * Notify all of the analysis listeners that a task is about to be performed.
|
| - */
|
| - void _notifyAboutToPerformTask(String taskDescription) {
|
| - int count = _listeners.length;
|
| - for (int i = 0; i < count; i++) {
|
| - _listeners[i].aboutToPerformTask(this, taskDescription);
|
| - }
|
| - }
|
| -
|
| // /**
|
| // * Notify all of the analysis listeners that the given source is no longer included in the set of
|
| // * sources that are being analyzed.
|
| @@ -4122,6 +4171,16 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
| // }
|
|
|
| /**
|
| + * Notify all of the analysis listeners that a task is about to be performed.
|
| + */
|
| + void _notifyAboutToPerformTask(String taskDescription) {
|
| + int count = _listeners.length;
|
| + for (int i = 0; i < count; i++) {
|
| + _listeners[i].aboutToPerformTask(this, taskDescription);
|
| + }
|
| + }
|
| +
|
| + /**
|
| * Notify all of the analysis listeners that the errors associated with the
|
| * given [source] has been updated to the given [errors].
|
| */
|
| @@ -4732,65 +4791,6 @@ class AnalysisContextImpl implements InternalAnalysisContext {
|
| });
|
| }
|
|
|
| - /**
|
| - * Check the cache for any invalid entries (entries whose modification time
|
| - * does not match the modification time of the source associated with the
|
| - * entry). Invalid entries will be marked as invalid so that the source will
|
| - * be re-analyzed. Return `true` if at least one entry was invalid.
|
| - */
|
| - bool _validateCacheConsistency() {
|
| - int consistencyCheckStart = JavaSystem.nanoTime();
|
| - List<Source> changedSources = new List<Source>();
|
| - List<Source> missingSources = new List<Source>();
|
| - MapIterator<Source, SourceEntry> iterator = _cache.iterator();
|
| - while (iterator.moveNext()) {
|
| - Source source = iterator.key;
|
| - SourceEntry sourceEntry = iterator.value;
|
| - int sourceTime = getModificationStamp(source);
|
| - if (sourceTime != sourceEntry.modificationTime) {
|
| - changedSources.add(source);
|
| - }
|
| - if (sourceEntry.exception != null) {
|
| - if (!exists(source)) {
|
| - missingSources.add(source);
|
| - }
|
| - }
|
| - }
|
| - int count = changedSources.length;
|
| - for (int i = 0; i < count; i++) {
|
| - _sourceChanged(changedSources[i]);
|
| - }
|
| - int removalCount = 0;
|
| - for (Source source in missingSources) {
|
| - if (getLibrariesContaining(source).isEmpty &&
|
| - getLibrariesDependingOn(source).isEmpty) {
|
| - _cache.remove(source);
|
| - removalCount++;
|
| - }
|
| - }
|
| - int consistencyCheckEnd = JavaSystem.nanoTime();
|
| - if (changedSources.length > 0 || missingSources.length > 0) {
|
| - StringBuffer buffer = new StringBuffer();
|
| - buffer.write("Consistency check took ");
|
| - buffer.write((consistencyCheckEnd - consistencyCheckStart) / 1000000.0);
|
| - buffer.writeln(" ms and found");
|
| - buffer.write(" ");
|
| - buffer.write(changedSources.length);
|
| - buffer.writeln(" inconsistent entries");
|
| - buffer.write(" ");
|
| - buffer.write(missingSources.length);
|
| - buffer.write(" missing sources (");
|
| - buffer.write(removalCount);
|
| - buffer.writeln(" removed");
|
| - for (Source source in missingSources) {
|
| - buffer.write(" ");
|
| - buffer.writeln(source.fullName);
|
| - }
|
| - _logInformation(buffer.toString());
|
| - }
|
| - return changedSources.length > 0;
|
| - }
|
| -
|
| void _validateLastIncrementalResolutionResult() {
|
| if (incrementalResolutionValidation_lastUnitSource == null ||
|
| incrementalResolutionValidation_lastLibrarySource == null ||
|
|
|