OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library analyzer.src.context.context; | 5 library analyzer.src.context.context; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/src/cancelable_future.dart'; | 10 import 'package:analyzer/src/cancelable_future.dart'; |
(...skipping 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1817 * does not match the modification time of the source associated with the | 1817 * does not match the modification time of the source associated with the |
1818 * entry). Invalid entries will be marked as invalid so that the source will | 1818 * entry). Invalid entries will be marked as invalid so that the source will |
1819 * be re-analyzed. Return `true` if at least one entry was invalid. | 1819 * be re-analyzed. Return `true` if at least one entry was invalid. |
1820 */ | 1820 */ |
1821 bool _validateCacheConsistency() { | 1821 bool _validateCacheConsistency() { |
1822 int consistencyCheckStart = JavaSystem.nanoTime(); | 1822 int consistencyCheckStart = JavaSystem.nanoTime(); |
1823 HashSet<Source> changedSources = new HashSet<Source>(); | 1823 HashSet<Source> changedSources = new HashSet<Source>(); |
1824 HashSet<Source> missingSources = new HashSet<Source>(); | 1824 HashSet<Source> missingSources = new HashSet<Source>(); |
1825 MapIterator<AnalysisTarget, CacheEntry> iterator = _cache.iterator(); | 1825 MapIterator<AnalysisTarget, CacheEntry> iterator = _cache.iterator(); |
1826 while (iterator.moveNext()) { | 1826 while (iterator.moveNext()) { |
1827 Source source = iterator.key.source; | 1827 AnalysisTarget target = iterator.key; |
1828 if (source != null) { | 1828 if (target is Source) { |
1829 Source source = target; | |
Brian Wilkerson
2015/05/12 01:03:22
Or just use 'target' in the then block...
| |
1829 CacheEntry entry = iterator.value; | 1830 CacheEntry entry = iterator.value; |
1830 int sourceTime = getModificationStamp(source); | 1831 int sourceTime = getModificationStamp(source); |
1831 if (sourceTime != entry.modificationTime) { | 1832 if (sourceTime != entry.modificationTime) { |
1832 changedSources.add(source); | 1833 changedSources.add(source); |
1833 } | 1834 } |
1834 if (entry.exception != null) { | 1835 if (entry.exception != null) { |
1835 if (!exists(source)) { | 1836 if (!exists(source)) { |
1836 missingSources.add(source); | 1837 missingSources.add(source); |
1837 } | 1838 } |
1838 } | 1839 } |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2032 PendingFuture pendingFuture = | 2033 PendingFuture pendingFuture = |
2033 new PendingFuture<T>(_context, target, computeValue); | 2034 new PendingFuture<T>(_context, target, computeValue); |
2034 if (!pendingFuture.evaluate(entry)) { | 2035 if (!pendingFuture.evaluate(entry)) { |
2035 _context._pendingFutureTargets | 2036 _context._pendingFutureTargets |
2036 .putIfAbsent(target, () => <PendingFuture>[]) | 2037 .putIfAbsent(target, () => <PendingFuture>[]) |
2037 .add(pendingFuture); | 2038 .add(pendingFuture); |
2038 } | 2039 } |
2039 return pendingFuture.future; | 2040 return pendingFuture.future; |
2040 } | 2041 } |
2041 } | 2042 } |
OLD | NEW |