| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine; | 8 library engine; |
| 9 | 9 |
| 10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 int count = _partitions.length; | 67 int count = _partitions.length; |
| 68 for (int i = 0; i < count; i++) { | 68 for (int i = 0; i < count; i++) { |
| 69 if (_partitions[i].contains(source)) { | 69 if (_partitions[i].contains(source)) { |
| 70 return _partitions[i].get(source); | 70 return _partitions[i].get(source); |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 return null; | 73 return null; |
| 74 } | 74 } |
| 75 | 75 |
| 76 /** | 76 /** |
| 77 * Return the number of entries in this cache that have an AST associated with
them. |
| 78 * |
| 79 * @return the number of entries in this cache that have an AST associated wit
h them |
| 80 */ |
| 81 int get astSize => _partitions[_partitions.length - 1].astSize; |
| 82 |
| 83 /** |
| 84 * Return information about each of the partitions in this cache. |
| 85 * |
| 86 * @return information about each of the partitions in this cache |
| 87 */ |
| 88 List<AnalysisContextStatistics_PartitionData> get partitionData { |
| 89 int count = _partitions.length; |
| 90 List<AnalysisContextStatistics_PartitionData> data = new List<AnalysisContex
tStatistics_PartitionData>(count); |
| 91 for (int i = 0; i < count; i++) { |
| 92 CachePartition partition = _partitions[i]; |
| 93 data[i] = new AnalysisContextStatisticsImpl_PartitionDataImpl(partition.as
tSize, partition.map.length); |
| 94 } |
| 95 return data; |
| 96 } |
| 97 |
| 98 /** |
| 77 * Return an iterator returning all of the map entries mapping sources to cach
e entries. | 99 * Return an iterator returning all of the map entries mapping sources to cach
e entries. |
| 78 * | 100 * |
| 79 * @return an iterator returning all of the map entries mapping sources to cac
he entries | 101 * @return an iterator returning all of the map entries mapping sources to cac
he entries |
| 80 */ | 102 */ |
| 81 MapIterator<Source, SourceEntry> iterator() { | 103 MapIterator<Source, SourceEntry> iterator() { |
| 82 int count = _partitions.length; | 104 int count = _partitions.length; |
| 83 List<Map<Source, SourceEntry>> maps = new List<Map>(count); | 105 List<Map<Source, SourceEntry>> maps = new List<Map>(count); |
| 84 for (int i = 0; i < count; i++) { | 106 for (int i = 0; i < count; i++) { |
| 85 maps[i] = _partitions[i].map; | 107 maps[i] = _partitions[i].map; |
| 86 } | 108 } |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 for (int i = 0; i < count; i++) { | 180 for (int i = 0; i < count; i++) { |
| 159 if (_partitions[i].contains(source)) { | 181 if (_partitions[i].contains(source)) { |
| 160 _partitions[i].storedAst(source); | 182 _partitions[i].storedAst(source); |
| 161 return; | 183 return; |
| 162 } | 184 } |
| 163 } | 185 } |
| 164 } | 186 } |
| 165 } | 187 } |
| 166 | 188 |
| 167 /** | 189 /** |
| 168 * Container with statistics about the [AnalysisContext]. | |
| 169 */ | |
| 170 abstract class AnalysisContentStatistics { | |
| 171 /** | |
| 172 * Return the statistics for each kind of cached data. | |
| 173 * | |
| 174 * @return the statistics for each kind of cached data | |
| 175 */ | |
| 176 List<AnalysisContentStatistics_CacheRow> get cacheRows; | |
| 177 | |
| 178 /** | |
| 179 * Return the exceptions that caused some entries to have a state of [CacheSta
te#ERROR]. | |
| 180 * | |
| 181 * @return the exceptions that caused some entries to have a state of [CacheSt
ate#ERROR] | |
| 182 */ | |
| 183 List<AnalysisException> get exceptions; | |
| 184 | |
| 185 /** | |
| 186 * Return an array containing all of the sources in the cache. | |
| 187 * | |
| 188 * @return an array containing all of the sources in the cache | |
| 189 */ | |
| 190 List<Source> get sources; | |
| 191 } | |
| 192 | |
| 193 /** | |
| 194 * Implementation of the [AnalysisContentStatistics]. | |
| 195 */ | |
| 196 class AnalysisContentStatisticsImpl implements AnalysisContentStatistics { | |
| 197 Map<String, AnalysisContentStatistics_CacheRow> _dataMap = new Map<String, Ana
lysisContentStatistics_CacheRow>(); | |
| 198 | |
| 199 List<Source> _sources = new List<Source>(); | |
| 200 | |
| 201 Set<AnalysisException> _exceptions = new Set<AnalysisException>(); | |
| 202 | |
| 203 void addSource(Source source) { | |
| 204 _sources.add(source); | |
| 205 } | |
| 206 | |
| 207 @override | |
| 208 List<AnalysisContentStatistics_CacheRow> get cacheRows { | |
| 209 Iterable<AnalysisContentStatistics_CacheRow> items = _dataMap.values; | |
| 210 return new List.from(items); | |
| 211 } | |
| 212 | |
| 213 @override | |
| 214 List<AnalysisException> get exceptions => new List.from(_exceptions); | |
| 215 | |
| 216 @override | |
| 217 List<Source> get sources => new List.from(_sources); | |
| 218 | |
| 219 void putCacheItem(SourceEntry dartEntry, DataDescriptor descriptor) { | |
| 220 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getState(descriptor))
; | |
| 221 } | |
| 222 | |
| 223 void putCacheItemInLibrary(DartEntry dartEntry, Source librarySource, DataDesc
riptor descriptor) { | |
| 224 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getStateInLibrary(des
criptor, librarySource)); | |
| 225 } | |
| 226 | |
| 227 void _internalPutCacheItem(SourceEntry dartEntry, DataDescriptor rowDesc, Cach
eState state) { | |
| 228 String rowName = rowDesc.toString(); | |
| 229 AnalysisContentStatisticsImpl_CacheRowImpl row = _dataMap[rowName] as Analys
isContentStatisticsImpl_CacheRowImpl; | |
| 230 if (row == null) { | |
| 231 row = new AnalysisContentStatisticsImpl_CacheRowImpl(rowName); | |
| 232 _dataMap[rowName] = row; | |
| 233 } | |
| 234 row._incState(state); | |
| 235 if (state == CacheState.ERROR) { | |
| 236 AnalysisException exception = dartEntry.exception; | |
| 237 if (exception != null) { | |
| 238 _exceptions.add(exception); | |
| 239 } | |
| 240 } | |
| 241 } | |
| 242 } | |
| 243 | |
| 244 class AnalysisContentStatisticsImpl_CacheRowImpl implements AnalysisContentStati
stics_CacheRow { | |
| 245 final String name; | |
| 246 | |
| 247 int _errorCount = 0; | |
| 248 | |
| 249 int _flushedCount = 0; | |
| 250 | |
| 251 int _inProcessCount = 0; | |
| 252 | |
| 253 int _invalidCount = 0; | |
| 254 | |
| 255 int _validCount = 0; | |
| 256 | |
| 257 AnalysisContentStatisticsImpl_CacheRowImpl(this.name); | |
| 258 | |
| 259 @override | |
| 260 bool operator ==(Object obj) => obj is AnalysisContentStatisticsImpl_CacheRowI
mpl && obj.name == name; | |
| 261 | |
| 262 @override | |
| 263 int get errorCount => _errorCount; | |
| 264 | |
| 265 @override | |
| 266 int get flushedCount => _flushedCount; | |
| 267 | |
| 268 @override | |
| 269 int get inProcessCount => _inProcessCount; | |
| 270 | |
| 271 @override | |
| 272 int get invalidCount => _invalidCount; | |
| 273 | |
| 274 @override | |
| 275 int get validCount => _validCount; | |
| 276 | |
| 277 @override | |
| 278 int get hashCode => name.hashCode; | |
| 279 | |
| 280 void _incState(CacheState state) { | |
| 281 if (state == CacheState.ERROR) { | |
| 282 _errorCount++; | |
| 283 } | |
| 284 if (state == CacheState.FLUSHED) { | |
| 285 _flushedCount++; | |
| 286 } | |
| 287 if (state == CacheState.IN_PROCESS) { | |
| 288 _inProcessCount++; | |
| 289 } | |
| 290 if (state == CacheState.INVALID) { | |
| 291 _invalidCount++; | |
| 292 } | |
| 293 if (state == CacheState.VALID) { | |
| 294 _validCount++; | |
| 295 } | |
| 296 } | |
| 297 } | |
| 298 | |
| 299 /** | |
| 300 * Information about single item in the cache. | |
| 301 */ | |
| 302 abstract class AnalysisContentStatistics_CacheRow { | |
| 303 int get errorCount; | |
| 304 | |
| 305 int get flushedCount; | |
| 306 | |
| 307 int get inProcessCount; | |
| 308 | |
| 309 int get invalidCount; | |
| 310 | |
| 311 String get name; | |
| 312 | |
| 313 int get validCount; | |
| 314 } | |
| 315 | |
| 316 /** | |
| 317 * The interface `AnalysisContext` defines the behavior of objects that represen
t a context in | 190 * The interface `AnalysisContext` defines the behavior of objects that represen
t a context in |
| 318 * which a single analysis can be performed and incrementally maintained. The co
ntext includes such | 191 * which a single analysis can be performed and incrementally maintained. The co
ntext includes such |
| 319 * information as the version of the SDK being analyzed against as well as the p
ackage-root used to | 192 * information as the version of the SDK being analyzed against as well as the p
ackage-root used to |
| 320 * resolve 'package:' URI's. (Both of which are known indirectly through the [So
urceFactory | 193 * resolve 'package:' URI's. (Both of which are known indirectly through the [So
urceFactory |
| 321 ].) | 194 ].) |
| 322 * | 195 * |
| 323 * An analysis context also represents the state of the analysis, which includes
knowing which | 196 * An analysis context also represents the state of the analysis, which includes
knowing which |
| 324 * sources have been included in the analysis (either directly or indirectly) an
d the results of the | 197 * sources have been included in the analysis (either directly or indirectly) an
d the results of the |
| 325 * analysis. Sources must be added and removed from the context using the method | 198 * analysis. Sources must be added and removed from the context using the method |
| 326 * [applyChanges], which is also used to notify the context when sources have be
en | 199 * [applyChanges], which is also used to notify the context when sources have be
en |
| (...skipping 15 matching lines...) Expand all Loading... |
| 342 * needed analysis and get notified of the consequent changes to the analysis re
sults. This | 215 * needed analysis and get notified of the consequent changes to the analysis re
sults. This |
| 343 * mechanism is realized by the method [performAnalysisTask]. | 216 * mechanism is realized by the method [performAnalysisTask]. |
| 344 * | 217 * |
| 345 * Analysis engine allows for having more than one context. This can be used, fo
r example, to | 218 * Analysis engine allows for having more than one context. This can be used, fo
r example, to |
| 346 * perform one analysis based on the state of files on disk and a separate analy
sis based on the | 219 * perform one analysis based on the state of files on disk and a separate analy
sis based on the |
| 347 * state of those files in open editors. It can also be used to perform an analy
sis based on a | 220 * state of those files in open editors. It can also be used to perform an analy
sis based on a |
| 348 * proposed future state, such as the state after a refactoring. | 221 * proposed future state, such as the state after a refactoring. |
| 349 */ | 222 */ |
| 350 abstract class AnalysisContext { | 223 abstract class AnalysisContext { |
| 351 /** | 224 /** |
| 225 * Apply the given delta to change the level of analysis that will be performe
d for the sources |
| 226 * known to this context. |
| 227 * |
| 228 * @param delta a description of the level of analysis that should be performe
d for some sources |
| 229 */ |
| 230 void applyAnalysisDelta(AnalysisDelta delta); |
| 231 |
| 232 /** |
| 352 * Apply the changes specified by the given change set to this context. Any an
alysis results that | 233 * Apply the changes specified by the given change set to this context. Any an
alysis results that |
| 353 * have been invalidated by these changes will be removed. | 234 * have been invalidated by these changes will be removed. |
| 354 * | 235 * |
| 355 * @param changeSet a description of the changes that are to be applied | 236 * @param changeSet a description of the changes that are to be applied |
| 356 */ | 237 */ |
| 357 void applyChanges(ChangeSet changeSet); | 238 void applyChanges(ChangeSet changeSet); |
| 358 | 239 |
| 359 /** | 240 /** |
| 360 * Return the documentation comment for the given element as it appears in the
original source | 241 * Return the documentation comment for the given element as it appears in the
original source |
| 361 * (complete with the beginning and ending delimiters), or `null` if the eleme
nt does not | 242 * (complete with the beginning and ending delimiters), or `null` if the eleme
nt does not |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1015 * The set of [AngularApplication] in this context. | 896 * The set of [AngularApplication] in this context. |
| 1016 */ | 897 */ |
| 1017 Set<AngularApplication> _angularApplications = new Set(); | 898 Set<AngularApplication> _angularApplications = new Set(); |
| 1018 | 899 |
| 1019 /** | 900 /** |
| 1020 * Initialize a newly created analysis context. | 901 * Initialize a newly created analysis context. |
| 1021 */ | 902 */ |
| 1022 AnalysisContextImpl() : super() { | 903 AnalysisContextImpl() : super() { |
| 1023 _resultRecorder = new AnalysisContextImpl_AnalysisTaskResultRecorder(this); | 904 _resultRecorder = new AnalysisContextImpl_AnalysisTaskResultRecorder(this); |
| 1024 _privatePartition = new UniversalCachePartition(AnalysisOptionsImpl.DEFAULT_
CACHE_SIZE, new AnalysisContextImpl_ContextRetentionPolicy(this)); | 905 _privatePartition = new UniversalCachePartition(AnalysisOptionsImpl.DEFAULT_
CACHE_SIZE, new AnalysisContextImpl_ContextRetentionPolicy(this)); |
| 1025 _cache = _createCacheFromSourceFactory(null); | 906 _cache = createCacheFromSourceFactory(null); |
| 1026 } | 907 } |
| 1027 | 908 |
| 1028 @override | 909 @override |
| 1029 void addSourceInfo(Source source, SourceEntry info) { | 910 void addSourceInfo(Source source, SourceEntry info) { |
| 1030 // This implementation assumes that the access to the cache does not need to
be synchronized | 911 // This implementation assumes that the access to the cache does not need to
be synchronized |
| 1031 // because no other object can have access to this context while this method
is being invoked. | 912 // because no other object can have access to this context while this method
is being invoked. |
| 1032 _cache.put(source, info); | 913 _cache.put(source, info); |
| 1033 } | 914 } |
| 1034 | 915 |
| 1035 @override | 916 @override |
| 917 void applyAnalysisDelta(AnalysisDelta delta) { |
| 918 ChangeSet changeSet = new ChangeSet(); |
| 919 for (MapEntry<Source, AnalysisLevel> entry in getMapEntrySet(delta.analysisL
evels)) { |
| 920 Source source = entry.getKey(); |
| 921 if (entry.getValue() == AnalysisLevel.NONE) { |
| 922 changeSet.removedSource(source); |
| 923 } else { |
| 924 changeSet.addedSource(source); |
| 925 } |
| 926 } |
| 927 applyChanges(changeSet); |
| 928 } |
| 929 |
| 930 @override |
| 1036 void applyChanges(ChangeSet changeSet) { | 931 void applyChanges(ChangeSet changeSet) { |
| 1037 if (changeSet.isEmpty) { | 932 if (changeSet.isEmpty) { |
| 1038 return; | 933 return; |
| 1039 } | 934 } |
| 1040 _recentTasks.clear(); | 935 _recentTasks.clear(); |
| 1041 // | 936 // |
| 1042 // First, compute the list of sources that have been removed. | 937 // First, compute the list of sources that have been removed. |
| 1043 // | 938 // |
| 1044 List<Source> removedSources = new List<Source>.from(changeSet.removedSources
); | 939 List<Source> removedSources = new List<Source>.from(changeSet.removedSources
); |
| 1045 for (SourceContainer container in changeSet.removedContainers) { | 940 for (SourceContainer container in changeSet.removedContainers) { |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1622 // Look for non-priority sources that need to be analyzed. | 1517 // Look for non-priority sources that need to be analyzed. |
| 1623 // | 1518 // |
| 1624 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); | 1519 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); |
| 1625 while (iterator.moveNext()) { | 1520 while (iterator.moveNext()) { |
| 1626 _getSourcesNeedingProcessing(iterator.key, iterator.value, false, hintsEna
bled, sources); | 1521 _getSourcesNeedingProcessing(iterator.key, iterator.value, false, hintsEna
bled, sources); |
| 1627 } | 1522 } |
| 1628 return new List<Source>.from(sources); | 1523 return new List<Source>.from(sources); |
| 1629 } | 1524 } |
| 1630 | 1525 |
| 1631 @override | 1526 @override |
| 1632 AnalysisContentStatistics get statistics { | 1527 AnalysisContextStatistics get statistics { |
| 1633 bool hintsEnabled = _options.hint; | 1528 bool hintsEnabled = _options.hint; |
| 1634 AnalysisContentStatisticsImpl statistics = new AnalysisContentStatisticsImpl
(); | 1529 AnalysisContextStatisticsImpl statistics = new AnalysisContextStatisticsImpl
(); |
| 1635 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); | 1530 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); |
| 1636 while (iterator.moveNext()) { | 1531 while (iterator.moveNext()) { |
| 1637 SourceEntry sourceEntry = iterator.value; | 1532 SourceEntry sourceEntry = iterator.value; |
| 1638 if (sourceEntry is DartEntry) { | 1533 if (sourceEntry is DartEntry) { |
| 1639 Source source = iterator.key; | 1534 Source source = iterator.key; |
| 1640 DartEntry dartEntry = sourceEntry; | 1535 DartEntry dartEntry = sourceEntry; |
| 1641 SourceKind kind = dartEntry.getValue(DartEntry.SOURCE_KIND); | 1536 SourceKind kind = dartEntry.getValue(DartEntry.SOURCE_KIND); |
| 1642 // get library independent values | 1537 // get library independent values |
| 1643 statistics.putCacheItem(dartEntry, SourceEntry.LINE_INFO); | 1538 statistics.putCacheItem(dartEntry, SourceEntry.LINE_INFO); |
| 1644 statistics.putCacheItem(dartEntry, DartEntry.PARSE_ERRORS); | 1539 statistics.putCacheItem(dartEntry, DartEntry.PARSE_ERRORS); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1666 } | 1561 } |
| 1667 } else if (sourceEntry is HtmlEntry) { | 1562 } else if (sourceEntry is HtmlEntry) { |
| 1668 HtmlEntry htmlEntry = sourceEntry; | 1563 HtmlEntry htmlEntry = sourceEntry; |
| 1669 statistics.putCacheItem(htmlEntry, SourceEntry.LINE_INFO); | 1564 statistics.putCacheItem(htmlEntry, SourceEntry.LINE_INFO); |
| 1670 statistics.putCacheItem(htmlEntry, HtmlEntry.PARSE_ERRORS); | 1565 statistics.putCacheItem(htmlEntry, HtmlEntry.PARSE_ERRORS); |
| 1671 statistics.putCacheItem(htmlEntry, HtmlEntry.PARSED_UNIT); | 1566 statistics.putCacheItem(htmlEntry, HtmlEntry.PARSED_UNIT); |
| 1672 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLUTION_ERRORS); | 1567 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLUTION_ERRORS); |
| 1673 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLVED_UNIT); | 1568 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLVED_UNIT); |
| 1674 } | 1569 } |
| 1675 } | 1570 } |
| 1571 statistics.partitionData = _cache.partitionData; |
| 1676 return statistics; | 1572 return statistics; |
| 1677 } | 1573 } |
| 1678 | 1574 |
| 1679 @override | 1575 @override |
| 1680 TypeProvider get typeProvider { | 1576 TypeProvider get typeProvider { |
| 1681 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); | 1577 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); |
| 1682 if (coreSource == null) { | 1578 if (coreSource == null) { |
| 1683 throw new AnalysisException.con1("Could not create a source for dart:core"
); | 1579 throw new AnalysisException.con1("Could not create a source for dart:core"
); |
| 1684 } | 1580 } |
| 1685 LibraryElement coreElement = computeLibraryElement(coreSource); | 1581 LibraryElement coreElement = computeLibraryElement(coreSource); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1930 return; | 1826 return; |
| 1931 } else if (factory.context != null) { | 1827 } else if (factory.context != null) { |
| 1932 throw new IllegalStateException("Source factories cannot be shared between
contexts"); | 1828 throw new IllegalStateException("Source factories cannot be shared between
contexts"); |
| 1933 } | 1829 } |
| 1934 if (_sourceFactory != null) { | 1830 if (_sourceFactory != null) { |
| 1935 _sourceFactory.context = null; | 1831 _sourceFactory.context = null; |
| 1936 } | 1832 } |
| 1937 factory.context = this; | 1833 factory.context = this; |
| 1938 _sourceFactory = factory; | 1834 _sourceFactory = factory; |
| 1939 _coreLibrarySource = _sourceFactory.forUri(DartSdk.DART_CORE); | 1835 _coreLibrarySource = _sourceFactory.forUri(DartSdk.DART_CORE); |
| 1940 _cache = _createCacheFromSourceFactory(factory); | 1836 _cache = createCacheFromSourceFactory(factory); |
| 1941 _invalidateAllLocalResolutionInformation(); | 1837 _invalidateAllLocalResolutionInformation(); |
| 1942 } | 1838 } |
| 1943 | 1839 |
| 1944 /** | 1840 /** |
| 1841 * Create an analysis cache based on the given source factory. |
| 1842 * |
| 1843 * @param factory the source factory containing the information needed to crea
te the cache |
| 1844 * @return the cache that was created |
| 1845 */ |
| 1846 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { |
| 1847 if (factory == null) { |
| 1848 return new AnalysisCache(<CachePartition> [_privatePartition]); |
| 1849 } |
| 1850 DartSdk sdk = factory.dartSdk; |
| 1851 if (sdk == null) { |
| 1852 return new AnalysisCache(<CachePartition> [_privatePartition]); |
| 1853 } |
| 1854 return new AnalysisCache(<CachePartition> [ |
| 1855 AnalysisEngine.instance.partitionManager.forSdk(sdk), |
| 1856 _privatePartition]); |
| 1857 } |
| 1858 |
| 1859 /** |
| 1945 * Record the results produced by performing a [ResolveDartLibraryCycleTask].
If the results | 1860 * Record the results produced by performing a [ResolveDartLibraryCycleTask].
If the results |
| 1946 * were computed from data that is now out-of-date, then the results will not
be recorded. | 1861 * were computed from data that is now out-of-date, then the results will not
be recorded. |
| 1947 * | 1862 * |
| 1948 * @param task the task that was performed | 1863 * @param task the task that was performed |
| 1949 * @return an entry containing the computed results | 1864 * @return an entry containing the computed results |
| 1950 * @throws AnalysisException if the results could not be recorded | 1865 * @throws AnalysisException if the results could not be recorded |
| 1951 */ | 1866 */ |
| 1952 DartEntry recordResolveDartLibraryCycleTaskResults(ResolveDartLibraryCycleTask
task) { | 1867 DartEntry recordResolveDartLibraryCycleTaskResults(ResolveDartLibraryCycleTask
task) { |
| 1953 LibraryResolver2 resolver = task.libraryResolver; | 1868 LibraryResolver2 resolver = task.libraryResolver; |
| 1954 AnalysisException thrownException = task.exception; | 1869 AnalysisException thrownException = task.exception; |
| 1955 DartEntry unitEntry = null; | 1870 DartEntry unitEntry = null; |
| 1956 Source unitSource = task.unitSource; | 1871 Source unitSource = task.unitSource; |
| 1957 if (resolver != null) { | 1872 if (resolver != null) { |
| 1958 // | 1873 // |
| 1959 // The resolver should only be null if an exception was thrown before (or
while) it was | 1874 // The resolver should only be null if an exception was thrown before (or
while) it was |
| 1960 // being created. | 1875 // being created. |
| 1961 // | 1876 // |
| 1962 List<ResolvableLibrary> resolvedLibraries = resolver.resolvedLibraries; | 1877 List<ResolvableLibrary> resolvedLibraries = resolver.resolvedLibraries; |
| 1963 if (resolvedLibraries == null) { | 1878 if (resolvedLibraries == null) { |
| 1964 // | 1879 // |
| 1965 // The resolved libraries should only be null if an exception was thrown
during resolution. | 1880 // The resolved libraries should only be null if an exception was thrown
during resolution. |
| 1966 // | 1881 // |
| 1967 unitEntry = _getReadableDartEntry(unitSource); | 1882 unitEntry = _getReadableDartEntry(unitSource); |
| 1968 if (unitEntry == null) { | 1883 if (unitEntry == null) { |
| 1969 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${unitSource.fullName}"); | 1884 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${unitSource.fullName}"); |
| 1970 } | 1885 } |
| 1971 DartEntryImpl dartCopy = unitEntry.writableCopy; | 1886 DartEntryImpl dartCopy = unitEntry.writableCopy; |
| 1972 dartCopy.recordResolutionError(); | 1887 if (thrownException == null) { |
| 1973 dartCopy.exception = thrownException; | 1888 dartCopy.recordResolutionError(new AnalysisException.con1("In recordRe
solveDartLibraryCycleTaskResults, resolvedLibraries was null and there was no th
rown exception")); |
| 1889 } else { |
| 1890 dartCopy.recordResolutionError(thrownException); |
| 1891 } |
| 1974 _cache.put(unitSource, dartCopy); | 1892 _cache.put(unitSource, dartCopy); |
| 1975 _cache.remove(unitSource); | 1893 _cache.remove(unitSource); |
| 1976 if (thrownException != null) { | 1894 if (thrownException != null) { |
| 1977 throw thrownException; | 1895 throw thrownException; |
| 1978 } | 1896 } |
| 1979 return dartCopy; | 1897 return dartCopy; |
| 1980 } | 1898 } |
| 1981 if (_allModificationTimesMatch(resolvedLibraries)) { | 1899 if (_allModificationTimesMatch(resolvedLibraries)) { |
| 1982 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); | 1900 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); |
| 1983 RecordingErrorListener errorListener = resolver.errorListener; | 1901 RecordingErrorListener errorListener = resolver.errorListener; |
| 1984 for (ResolvableLibrary library in resolvedLibraries) { | 1902 for (ResolvableLibrary library in resolvedLibraries) { |
| 1985 Source librarySource = library.librarySource; | 1903 Source librarySource = library.librarySource; |
| 1986 for (Source source in library.compilationUnitSources) { | 1904 for (Source source in library.compilationUnitSources) { |
| 1987 CompilationUnit unit = library.getAST(source); | 1905 CompilationUnit unit = library.getAST(source); |
| 1988 List<AnalysisError> errors = errorListener.getErrorsForSource(source
); | 1906 List<AnalysisError> errors = errorListener.getErrorsForSource(source
); |
| 1989 LineInfo lineInfo = getLineInfo(source); | 1907 LineInfo lineInfo = getLineInfo(source); |
| 1990 DartEntryImpl dartCopy = _cache.get(source).writableCopy as DartEntr
yImpl; | 1908 DartEntryImpl dartCopy = _cache.get(source).writableCopy as DartEntr
yImpl; |
| 1991 if (thrownException == null) { | 1909 if (thrownException == null) { |
| 1992 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); | 1910 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); |
| 1993 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource,
unit); | 1911 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource,
unit); |
| 1994 dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySou
rce, errors); | 1912 dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySou
rce, errors); |
| 1995 if (source == librarySource) { | 1913 if (source == librarySource) { |
| 1996 _recordElementData(dartCopy, library.libraryElement, librarySour
ce, htmlSource); | 1914 _recordElementData(dartCopy, library.libraryElement, librarySour
ce, htmlSource); |
| 1997 } | 1915 } |
| 1998 _cache.storedAst(source); | 1916 _cache.storedAst(source); |
| 1999 } else { | 1917 } else { |
| 2000 dartCopy.recordResolutionError(); | 1918 dartCopy.recordResolutionErrorInLibrary(librarySource, thrownExcep
tion); |
| 2001 _cache.remove(source); | 1919 _cache.remove(source); |
| 2002 } | 1920 } |
| 2003 dartCopy.exception = thrownException; | |
| 2004 _cache.put(source, dartCopy); | 1921 _cache.put(source, dartCopy); |
| 2005 if (source != librarySource) { | 1922 if (source != librarySource) { |
| 2006 _workManager.add(source, SourcePriority.PRIORITY_PART); | 1923 _workManager.add(source, SourcePriority.PRIORITY_PART); |
| 2007 } | 1924 } |
| 2008 if (source == unitSource) { | 1925 if (source == unitSource) { |
| 2009 unitEntry = dartCopy; | 1926 unitEntry = dartCopy; |
| 2010 } | 1927 } |
| 2011 ChangeNoticeImpl notice = _getNotice(source); | 1928 ChangeNoticeImpl notice = _getNotice(source); |
| 2012 notice.compilationUnit = unit; | 1929 notice.compilationUnit = unit; |
| 2013 notice.setErrors(dartCopy.allErrors, lineInfo); | 1930 notice.setErrors(dartCopy.allErrors, lineInfo); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2028 // The analysis was performed on out-of-date sources. Mark the c
ache so that the | 1945 // The analysis was performed on out-of-date sources. Mark the c
ache so that the |
| 2029 // sources will be re-analyzed using the up-to-date sources. | 1946 // sources will be re-analyzed using the up-to-date sources. |
| 2030 // | 1947 // |
| 2031 dartCopy.recordResolutionNotInProcess(); | 1948 dartCopy.recordResolutionNotInProcess(); |
| 2032 } else { | 1949 } else { |
| 2033 // | 1950 // |
| 2034 // We could not determine whether the sources were up-to-date or
out-of-date. Mark | 1951 // We could not determine whether the sources were up-to-date or
out-of-date. Mark |
| 2035 // the cache so that we won't attempt to re-analyze the sources
until there's a | 1952 // the cache so that we won't attempt to re-analyze the sources
until there's a |
| 2036 // good chance that we'll be able to do so without error. | 1953 // good chance that we'll be able to do so without error. |
| 2037 // | 1954 // |
| 2038 dartCopy.recordResolutionError(); | 1955 dartCopy.recordResolutionError(thrownException); |
| 2039 _cache.remove(source); | 1956 _cache.remove(source); |
| 2040 } | 1957 } |
| 2041 dartCopy.exception = thrownException; | |
| 2042 _cache.put(source, dartCopy); | 1958 _cache.put(source, dartCopy); |
| 2043 if (source == unitSource) { | 1959 if (source == unitSource) { |
| 2044 unitEntry = dartCopy; | 1960 unitEntry = dartCopy; |
| 2045 } | 1961 } |
| 2046 } else { | 1962 } else { |
| 2047 writer.println(" ${_debuggingString(source)}; sourceTime = ${getM
odificationStamp(source)}, no entry"); | 1963 writer.println(" ${_debuggingString(source)}; sourceTime = ${getM
odificationStamp(source)}, no entry"); |
| 2048 } | 1964 } |
| 2049 } | 1965 } |
| 2050 } | 1966 } |
| 2051 _logInformation(writer.toString()); | 1967 _logInformation(writer.toString()); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 2076 Set<Library> resolvedLibraries = resolver.resolvedLibraries; | 1992 Set<Library> resolvedLibraries = resolver.resolvedLibraries; |
| 2077 if (resolvedLibraries == null) { | 1993 if (resolvedLibraries == null) { |
| 2078 // | 1994 // |
| 2079 // The resolved libraries should only be null if an exception was thrown
during resolution. | 1995 // The resolved libraries should only be null if an exception was thrown
during resolution. |
| 2080 // | 1996 // |
| 2081 unitEntry = _getReadableDartEntry(unitSource); | 1997 unitEntry = _getReadableDartEntry(unitSource); |
| 2082 if (unitEntry == null) { | 1998 if (unitEntry == null) { |
| 2083 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${unitSource.fullName}"); | 1999 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${unitSource.fullName}"); |
| 2084 } | 2000 } |
| 2085 DartEntryImpl dartCopy = unitEntry.writableCopy; | 2001 DartEntryImpl dartCopy = unitEntry.writableCopy; |
| 2086 dartCopy.recordResolutionError(); | 2002 if (thrownException == null) { |
| 2087 dartCopy.exception = thrownException; | 2003 dartCopy.recordResolutionError(new AnalysisException.con1("In recordRe
solveDartLibraryTaskResults, resolvedLibraries was null and there was no thrown
exception")); |
| 2004 } else { |
| 2005 dartCopy.recordResolutionError(thrownException); |
| 2006 } |
| 2088 _cache.put(unitSource, dartCopy); | 2007 _cache.put(unitSource, dartCopy); |
| 2089 _cache.remove(unitSource); | 2008 _cache.remove(unitSource); |
| 2090 if (thrownException != null) { | 2009 if (thrownException != null) { |
| 2091 throw thrownException; | 2010 throw thrownException; |
| 2092 } | 2011 } |
| 2093 return dartCopy; | 2012 return dartCopy; |
| 2094 } | 2013 } |
| 2095 if (_allModificationTimesMatch2(resolvedLibraries)) { | 2014 if (_allModificationTimesMatch2(resolvedLibraries)) { |
| 2096 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); | 2015 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); |
| 2097 RecordingErrorListener errorListener = resolver.errorListener; | 2016 RecordingErrorListener errorListener = resolver.errorListener; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 2115 if (thrownException == null) { | 2034 if (thrownException == null) { |
| 2116 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo); | 2035 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo); |
| 2117 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); | 2036 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); |
| 2118 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource,
unit); | 2037 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource,
unit); |
| 2119 dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySou
rce, errors); | 2038 dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySou
rce, errors); |
| 2120 if (source == librarySource) { | 2039 if (source == librarySource) { |
| 2121 _recordElementData(dartCopy, library.libraryElement, librarySour
ce, htmlSource); | 2040 _recordElementData(dartCopy, library.libraryElement, librarySour
ce, htmlSource); |
| 2122 } | 2041 } |
| 2123 _cache.storedAst(source); | 2042 _cache.storedAst(source); |
| 2124 } else { | 2043 } else { |
| 2125 dartCopy.recordResolutionError(); | 2044 dartCopy.recordResolutionErrorInLibrary(librarySource, thrownExcep
tion); |
| 2126 _cache.remove(source); | 2045 _cache.remove(source); |
| 2127 } | 2046 } |
| 2128 dartCopy.exception = thrownException; | |
| 2129 _cache.put(source, dartCopy); | 2047 _cache.put(source, dartCopy); |
| 2130 if (source != librarySource) { | 2048 if (source != librarySource) { |
| 2131 _workManager.add(source, SourcePriority.PRIORITY_PART); | 2049 _workManager.add(source, SourcePriority.PRIORITY_PART); |
| 2132 } | 2050 } |
| 2133 if (source == unitSource) { | 2051 if (source == unitSource) { |
| 2134 unitEntry = dartCopy; | 2052 unitEntry = dartCopy; |
| 2135 } | 2053 } |
| 2136 ChangeNoticeImpl notice = _getNotice(source); | 2054 ChangeNoticeImpl notice = _getNotice(source); |
| 2137 notice.compilationUnit = unit; | 2055 notice.compilationUnit = unit; |
| 2138 notice.setErrors(dartCopy.allErrors, lineInfo); | 2056 notice.setErrors(dartCopy.allErrors, lineInfo); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2153 // The analysis was performed on out-of-date sources. Mark the c
ache so that the | 2071 // The analysis was performed on out-of-date sources. Mark the c
ache so that the |
| 2154 // sources will be re-analyzed using the up-to-date sources. | 2072 // sources will be re-analyzed using the up-to-date sources. |
| 2155 // | 2073 // |
| 2156 dartCopy.recordResolutionNotInProcess(); | 2074 dartCopy.recordResolutionNotInProcess(); |
| 2157 } else { | 2075 } else { |
| 2158 // | 2076 // |
| 2159 // We could not determine whether the sources were up-to-date or
out-of-date. Mark | 2077 // We could not determine whether the sources were up-to-date or
out-of-date. Mark |
| 2160 // the cache so that we won't attempt to re-analyze the sources
until there's a | 2078 // the cache so that we won't attempt to re-analyze the sources
until there's a |
| 2161 // good chance that we'll be able to do so without error. | 2079 // good chance that we'll be able to do so without error. |
| 2162 // | 2080 // |
| 2163 dartCopy.recordResolutionError(); | 2081 dartCopy.recordResolutionError(thrownException); |
| 2164 _cache.remove(source); | 2082 _cache.remove(source); |
| 2165 } | 2083 } |
| 2166 dartCopy.exception = thrownException; | |
| 2167 _cache.put(source, dartCopy); | 2084 _cache.put(source, dartCopy); |
| 2168 if (source == unitSource) { | 2085 if (source == unitSource) { |
| 2169 unitEntry = dartCopy; | 2086 unitEntry = dartCopy; |
| 2170 } | 2087 } |
| 2171 } else { | 2088 } else { |
| 2172 writer.println(" ${_debuggingString(source)}; sourceTime = ${getM
odificationStamp(source)}, no entry"); | 2089 writer.println(" ${_debuggingString(source)}; sourceTime = ${getM
odificationStamp(source)}, no entry"); |
| 2173 } | 2090 } |
| 2174 } | 2091 } |
| 2175 } | 2092 } |
| 2176 _logInformation(writer.toString()); | 2093 _logInformation(writer.toString()); |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2618 AnalysisContextImpl_TaskData taskData = builder.taskData; | 2535 AnalysisContextImpl_TaskData taskData = builder.taskData; |
| 2619 if (taskData != null) { | 2536 if (taskData != null) { |
| 2620 return taskData; | 2537 return taskData; |
| 2621 } | 2538 } |
| 2622 DartEntryImpl dartCopy = dartEntry.writableCopy; | 2539 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 2623 dartCopy.setStateInLibrary(DartEntry.BUILT_UNIT, source, CacheState.IN_PRO
CESS); | 2540 dartCopy.setStateInLibrary(DartEntry.BUILT_UNIT, source, CacheState.IN_PRO
CESS); |
| 2624 _cache.put(source, dartCopy); | 2541 _cache.put(source, dartCopy); |
| 2625 return new AnalysisContextImpl_TaskData(new BuildDartElementModelTask(this
, source, builder.librariesInCycle), false); | 2542 return new AnalysisContextImpl_TaskData(new BuildDartElementModelTask(this
, source, builder.librariesInCycle), false); |
| 2626 } on AnalysisException catch (exception) { | 2543 } on AnalysisException catch (exception) { |
| 2627 DartEntryImpl dartCopy = dartEntry.writableCopy; | 2544 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 2628 dartCopy.recordBuildElementError(); | 2545 dartCopy.recordBuildElementErrorInLibrary(source, exception); |
| 2629 dartCopy.exception = exception; | |
| 2630 _cache.put(source, dartCopy); | 2546 _cache.put(source, dartCopy); |
| 2631 AnalysisEngine.instance.logger.logError2("Internal error trying to compute
the next analysis task", exception); | 2547 AnalysisEngine.instance.logger.logError2("Internal error trying to compute
the next analysis task", exception); |
| 2632 } | 2548 } |
| 2633 return new AnalysisContextImpl_TaskData(null, false); | 2549 return new AnalysisContextImpl_TaskData(null, false); |
| 2634 } | 2550 } |
| 2635 | 2551 |
| 2636 /** | 2552 /** |
| 2637 * Create an analysis cache based on the given source factory. | |
| 2638 * | |
| 2639 * @param factory the source factory containing the information needed to crea
te the cache | |
| 2640 * @return the cache that was created | |
| 2641 */ | |
| 2642 AnalysisCache _createCacheFromSourceFactory(SourceFactory factory) { | |
| 2643 if (factory == null) { | |
| 2644 return new AnalysisCache(<CachePartition> [_privatePartition]); | |
| 2645 } | |
| 2646 DartSdk sdk = factory.dartSdk; | |
| 2647 if (sdk == null) { | |
| 2648 return new AnalysisCache(<CachePartition> [_privatePartition]); | |
| 2649 } | |
| 2650 return new AnalysisCache(<CachePartition> [ | |
| 2651 AnalysisEngine.instance.partitionManager.forSdk(sdk), | |
| 2652 _privatePartition]); | |
| 2653 } | |
| 2654 | |
| 2655 /** | |
| 2656 * Create a [GenerateDartErrorsTask] for the given source, marking the verific
ation errors | 2553 * Create a [GenerateDartErrorsTask] for the given source, marking the verific
ation errors |
| 2657 * as being in-process. The compilation unit and the library can be the same i
f the compilation | 2554 * as being in-process. The compilation unit and the library can be the same i
f the compilation |
| 2658 * unit is the defining compilation unit of the library. | 2555 * unit is the defining compilation unit of the library. |
| 2659 * | 2556 * |
| 2660 * @param unitSource the source for the compilation unit to be verified | 2557 * @param unitSource the source for the compilation unit to be verified |
| 2661 * @param unitEntry the entry for the compilation unit | 2558 * @param unitEntry the entry for the compilation unit |
| 2662 * @param librarySource the source for the library containing the compilation
unit | 2559 * @param librarySource the source for the library containing the compilation
unit |
| 2663 * @param libraryEntry the entry for the library | 2560 * @param libraryEntry the entry for the library |
| 2664 * @return task data representing the created task | 2561 * @return task data representing the created task |
| 2665 */ | 2562 */ |
| 2666 AnalysisContextImpl_TaskData _createGenerateDartErrorsTask(Source unitSource,
DartEntry unitEntry, Source librarySource, DartEntry libraryEntry) { | 2563 AnalysisContextImpl_TaskData _createGenerateDartErrorsTask(Source unitSource,
DartEntry unitEntry, Source librarySource, DartEntry libraryEntry) { |
| 2667 if (unitEntry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource) != C
acheState.VALID || libraryEntry.getState(DartEntry.ELEMENT) != CacheState.VALID)
{ | 2564 if (unitEntry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource) != C
acheState.VALID || libraryEntry.getState(DartEntry.ELEMENT) != CacheState.VALID)
{ |
| 2668 return _createResolveDartLibraryTask(librarySource, libraryEntry); | 2565 return _createResolveDartLibraryTask(librarySource, libraryEntry); |
| 2669 } | 2566 } |
| 2670 CompilationUnit unit = unitEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT,
librarySource); | 2567 CompilationUnit unit = unitEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT,
librarySource); |
| 2671 if (unit == null) { | 2568 if (unit == null) { |
| 2672 AnalysisEngine.instance.logger.logInformation2("Entry has VALID state for
RESOLVED_UNIT but null value for ${unitSource.fullName} in ${librarySource.fullN
ame}", new AnalysisException()); | 2569 AnalysisException exception = new AnalysisException.con1("Entry has VALID
state for RESOLVED_UNIT but null value for ${unitSource.fullName} in ${librarySo
urce.fullName}"); |
| 2570 AnalysisEngine.instance.logger.logInformation2(exception.toString(), excep
tion); |
| 2673 DartEntryImpl dartCopy = unitEntry.writableCopy; | 2571 DartEntryImpl dartCopy = unitEntry.writableCopy; |
| 2674 dartCopy.recordResolutionError(); | 2572 dartCopy.recordResolutionError(exception); |
| 2675 _cache.put(unitSource, dartCopy); | 2573 _cache.put(unitSource, dartCopy); |
| 2676 return new AnalysisContextImpl_TaskData(null, false); | 2574 return new AnalysisContextImpl_TaskData(null, false); |
| 2677 } | 2575 } |
| 2678 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT); | 2576 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT); |
| 2679 DartEntryImpl dartCopy = unitEntry.writableCopy; | 2577 DartEntryImpl dartCopy = unitEntry.writableCopy; |
| 2680 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, Cac
heState.IN_PROCESS); | 2578 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, Cac
heState.IN_PROCESS); |
| 2681 _cache.put(unitSource, dartCopy); | 2579 _cache.put(unitSource, dartCopy); |
| 2682 return new AnalysisContextImpl_TaskData(new GenerateDartErrorsTask(this, uni
tSource, dartCopy.modificationTime, unit, libraryElement), false); | 2580 return new AnalysisContextImpl_TaskData(new GenerateDartErrorsTask(this, uni
tSource, dartCopy.modificationTime, unit, libraryElement), false); |
| 2683 } | 2581 } |
| 2684 | 2582 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2859 try { | 2757 try { |
| 2860 AnalysisContextImpl_CycleBuilder builder = new AnalysisContextImpl_CycleBu
ilder(this); | 2758 AnalysisContextImpl_CycleBuilder builder = new AnalysisContextImpl_CycleBu
ilder(this); |
| 2861 builder.computeCycleContaining(source); | 2759 builder.computeCycleContaining(source); |
| 2862 AnalysisContextImpl_TaskData taskData = builder.taskData; | 2760 AnalysisContextImpl_TaskData taskData = builder.taskData; |
| 2863 if (taskData != null) { | 2761 if (taskData != null) { |
| 2864 return taskData; | 2762 return taskData; |
| 2865 } | 2763 } |
| 2866 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryCycleTask(th
is, source, source, builder.librariesInCycle), false); | 2764 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryCycleTask(th
is, source, source, builder.librariesInCycle), false); |
| 2867 } on AnalysisException catch (exception) { | 2765 } on AnalysisException catch (exception) { |
| 2868 DartEntryImpl dartCopy = dartEntry.writableCopy; | 2766 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 2869 dartCopy.recordResolutionError(); | 2767 dartCopy.recordResolutionError(exception); |
| 2870 dartCopy.exception = exception; | |
| 2871 _cache.put(source, dartCopy); | 2768 _cache.put(source, dartCopy); |
| 2872 AnalysisEngine.instance.logger.logError2("Internal error trying to compute
the next analysis task", exception); | 2769 AnalysisEngine.instance.logger.logError2("Internal error trying to create
a ResolveDartLibraryTask", exception); |
| 2873 } | 2770 } |
| 2874 return new AnalysisContextImpl_TaskData(null, false); | 2771 return new AnalysisContextImpl_TaskData(null, false); |
| 2875 } | 2772 } |
| 2876 | 2773 |
| 2877 /** | 2774 /** |
| 2878 * Create a [ResolveHtmlTask] for the given source, marking the resolved unit
as being | 2775 * Create a [ResolveHtmlTask] for the given source, marking the resolved unit
as being |
| 2879 * in-process. | 2776 * in-process. |
| 2880 * | 2777 * |
| 2881 * @param source the source whose content is to be resolved | 2778 * @param source the source whose content is to be resolved |
| 2882 * @param htmlEntry the entry for the source | 2779 * @param htmlEntry the entry for the source |
| (...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3951 if (thrownException == null) { | 3848 if (thrownException == null) { |
| 3952 dartCopy.setValueInLibrary(DartEntry.BUILD_ELEMENT_ERRORS, librarySo
urce, errors); | 3849 dartCopy.setValueInLibrary(DartEntry.BUILD_ELEMENT_ERRORS, librarySo
urce, errors); |
| 3953 dartCopy.setValueInLibrary(DartEntry.BUILT_UNIT, librarySource, unit
); | 3850 dartCopy.setValueInLibrary(DartEntry.BUILT_UNIT, librarySource, unit
); |
| 3954 if (source == librarySource) { | 3851 if (source == librarySource) { |
| 3955 LibraryElementImpl libraryElement = library.libraryElement; | 3852 LibraryElementImpl libraryElement = library.libraryElement; |
| 3956 dartCopy.setValue(DartEntry.ELEMENT, libraryElement); | 3853 dartCopy.setValue(DartEntry.ELEMENT, libraryElement); |
| 3957 dartCopy.setValue(DartEntry.IS_LAUNCHABLE, libraryElement.entryPoi
nt != null); | 3854 dartCopy.setValue(DartEntry.IS_LAUNCHABLE, libraryElement.entryPoi
nt != null); |
| 3958 dartCopy.setValue(DartEntry.IS_CLIENT, _isClient(libraryElement, h
tmlSource, new Set<LibraryElement>())); | 3855 dartCopy.setValue(DartEntry.IS_CLIENT, _isClient(libraryElement, h
tmlSource, new Set<LibraryElement>())); |
| 3959 } | 3856 } |
| 3960 } else { | 3857 } else { |
| 3961 dartCopy.recordBuildElementError(); | 3858 dartCopy.recordBuildElementErrorInLibrary(librarySource, thrownExcep
tion); |
| 3962 _cache.remove(source); | 3859 _cache.remove(source); |
| 3963 } | 3860 } |
| 3964 dartCopy.exception = thrownException; | |
| 3965 _cache.put(source, dartCopy); | 3861 _cache.put(source, dartCopy); |
| 3966 if (source != librarySource) { | 3862 if (source != librarySource) { |
| 3967 _workManager.add(librarySource, SourcePriority.PRIORITY_PART); | 3863 _workManager.add(librarySource, SourcePriority.PRIORITY_PART); |
| 3968 } | 3864 } |
| 3969 if (source == targetLibrary) { | 3865 if (source == targetLibrary) { |
| 3970 targetEntry = dartCopy; | 3866 targetEntry = dartCopy; |
| 3971 } | 3867 } |
| 3972 ChangeNoticeImpl notice = _getNotice(source); | 3868 ChangeNoticeImpl notice = _getNotice(source); |
| 3973 notice.compilationUnit = unit; | 3869 notice.compilationUnit = unit; |
| 3974 notice.setErrors(dartCopy.allErrors, lineInfo); | 3870 notice.setErrors(dartCopy.allErrors, lineInfo); |
| 3975 } | 3871 } |
| 3976 } | 3872 } |
| 3977 } else { | 3873 } else { |
| 3978 PrintStringWriter writer = new PrintStringWriter(); | 3874 PrintStringWriter writer = new PrintStringWriter(); |
| 3979 writer.println("Build element model results discarded for"); | 3875 writer.println("Build element model results discarded for"); |
| 3980 for (ResolvableLibrary library in builtLibraries) { | 3876 for (ResolvableLibrary library in builtLibraries) { |
| 3877 Source librarySource = library.librarySource; |
| 3981 for (Source source in library.compilationUnitSources) { | 3878 for (Source source in library.compilationUnitSources) { |
| 3982 DartEntry dartEntry = _getReadableDartEntry(source); | 3879 DartEntry dartEntry = _getReadableDartEntry(source); |
| 3983 if (dartEntry != null) { | 3880 if (dartEntry != null) { |
| 3984 int resultTime = library.getModificationTime(source); | 3881 int resultTime = library.getModificationTime(source); |
| 3985 writer.println(" ${_debuggingString(source)}; sourceTime = ${getMod
ificationStamp(source)}, resultTime = ${resultTime}, cacheTime = ${dartEntry.mod
ificationTime}"); | 3882 writer.println(" ${_debuggingString(source)}; sourceTime = ${getMod
ificationStamp(source)}, resultTime = ${resultTime}, cacheTime = ${dartEntry.mod
ificationTime}"); |
| 3986 DartEntryImpl dartCopy = dartEntry.writableCopy; | 3883 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 3987 if (thrownException == null || resultTime >= 0) { | 3884 if (thrownException == null || resultTime >= 0) { |
| 3988 // | 3885 // |
| 3989 // The analysis was performed on out-of-date sources. Mark the cac
he so that the | 3886 // The analysis was performed on out-of-date sources. Mark the cac
he so that the |
| 3990 // sources will be re-analyzed using the up-to-date sources. | 3887 // sources will be re-analyzed using the up-to-date sources. |
| 3991 // | 3888 // |
| 3992 dartCopy.recordBuildElementNotInProcess(); | 3889 dartCopy.recordBuildElementNotInProcess(); |
| 3993 } else { | 3890 } else { |
| 3994 // | 3891 // |
| 3995 // We could not determine whether the sources were up-to-date or o
ut-of-date. Mark | 3892 // We could not determine whether the sources were up-to-date or o
ut-of-date. Mark |
| 3996 // the cache so that we won't attempt to re-analyze the sources un
til there's a | 3893 // the cache so that we won't attempt to re-analyze the sources un
til there's a |
| 3997 // good chance that we'll be able to do so without error. | 3894 // good chance that we'll be able to do so without error. |
| 3998 // | 3895 // |
| 3999 dartCopy.recordBuildElementError(); | 3896 dartCopy.recordBuildElementErrorInLibrary(librarySource, thrownExc
eption); |
| 4000 _cache.remove(source); | 3897 _cache.remove(source); |
| 4001 } | 3898 } |
| 4002 dartCopy.exception = thrownException; | |
| 4003 _cache.put(source, dartCopy); | 3899 _cache.put(source, dartCopy); |
| 4004 if (source == targetLibrary) { | 3900 if (source == targetLibrary) { |
| 4005 targetEntry = dartCopy; | 3901 targetEntry = dartCopy; |
| 4006 } | 3902 } |
| 4007 } else { | 3903 } else { |
| 4008 writer.println(" ${_debuggingString(source)}; sourceTime = ${getMod
ificationStamp(source)}, no entry"); | 3904 writer.println(" ${_debuggingString(source)}; sourceTime = ${getMod
ificationStamp(source)}, no entry"); |
| 4009 } | 3905 } |
| 4010 } | 3906 } |
| 4011 } | 3907 } |
| 4012 _logInformation(writer.toString()); | 3908 _logInformation(writer.toString()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4070 if (dartEntry == null) { | 3966 if (dartEntry == null) { |
| 4071 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${source.fullName}"); | 3967 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${source.fullName}"); |
| 4072 } | 3968 } |
| 4073 } | 3969 } |
| 4074 DartEntryImpl dartCopy = dartEntry.writableCopy; | 3970 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4075 if (thrownException == null) { | 3971 if (thrownException == null) { |
| 4076 dartCopy.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource,
task.errors); | 3972 dartCopy.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource,
task.errors); |
| 4077 ChangeNoticeImpl notice = _getNotice(source); | 3973 ChangeNoticeImpl notice = _getNotice(source); |
| 4078 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LINE_
INFO)); | 3974 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LINE_
INFO)); |
| 4079 } else { | 3975 } else { |
| 4080 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource,
CacheState.ERROR); | 3976 dartCopy.recordVerificationErrorInLibrary(librarySource, thrownException
); |
| 4081 } | 3977 } |
| 4082 dartCopy.exception = thrownException; | |
| 4083 _cache.put(source, dartCopy); | 3978 _cache.put(source, dartCopy); |
| 4084 dartEntry = dartCopy; | 3979 dartEntry = dartCopy; |
| 4085 } else { | 3980 } else { |
| 4086 _logInformation2("Generated errors discarded for ${_debuggingString(source
)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEn
try.modificationTime}", thrownException); | 3981 _logInformation2("Generated errors discarded for ${_debuggingString(source
)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEn
try.modificationTime}", thrownException); |
| 4087 DartEntryImpl dartCopy = dartEntry.writableCopy; | 3982 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4088 if (thrownException == null || resultTime >= 0) { | 3983 if (thrownException == null || resultTime >= 0) { |
| 4089 // | 3984 // |
| 4090 // The analysis was performed on out-of-date sources. Mark the cache so
that the source | 3985 // The analysis was performed on out-of-date sources. Mark the cache so
that the source |
| 4091 // will be re-verified using the up-to-date sources. | 3986 // will be re-verified using the up-to-date sources. |
| 4092 // | 3987 // |
| 4093 // dartCopy.setState(DartEntry.VERIFICATION_ERRORS, librarySour
ce, CacheState.INVALID); | 3988 // dartCopy.setState(DartEntry.VERIFICATION_ERRORS, librarySour
ce, CacheState.INVALID); |
| 4094 _removeFromParts(source, dartEntry); | 3989 _removeFromParts(source, dartEntry); |
| 4095 dartCopy.invalidateAllInformation(); | 3990 dartCopy.invalidateAllInformation(); |
| 4096 dartCopy.modificationTime = sourceTime; | 3991 dartCopy.modificationTime = sourceTime; |
| 4097 _cache.removedAst(source); | 3992 _cache.removedAst(source); |
| 4098 _workManager.add(source, SourcePriority.UNKNOWN); | 3993 _workManager.add(source, SourcePriority.UNKNOWN); |
| 4099 } else { | 3994 } else { |
| 4100 // | 3995 // |
| 4101 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the | 3996 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the |
| 4102 // cache so that we won't attempt to re-verify the source until there's
a good chance | 3997 // cache so that we won't attempt to re-verify the source until there's
a good chance |
| 4103 // that we'll be able to do so without error. | 3998 // that we'll be able to do so without error. |
| 4104 // | 3999 // |
| 4105 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource,
CacheState.ERROR); | 4000 dartCopy.recordVerificationErrorInLibrary(librarySource, thrownException
); |
| 4106 } | 4001 } |
| 4107 dartCopy.exception = thrownException; | |
| 4108 _cache.put(source, dartCopy); | 4002 _cache.put(source, dartCopy); |
| 4109 dartEntry = dartCopy; | 4003 dartEntry = dartCopy; |
| 4110 } | 4004 } |
| 4111 if (thrownException != null) { | 4005 if (thrownException != null) { |
| 4112 throw thrownException; | 4006 throw thrownException; |
| 4113 } | 4007 } |
| 4114 return dartEntry; | 4008 return dartEntry; |
| 4115 } | 4009 } |
| 4116 | 4010 |
| 4117 /** | 4011 /** |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4135 throw new ObsoleteSourceAnalysisException(librarySource); | 4029 throw new ObsoleteSourceAnalysisException(librarySource); |
| 4136 } else if (sourceEntry is! DartEntry) { | 4030 } else if (sourceEntry is! DartEntry) { |
| 4137 // This shouldn't be possible because we should never have performed the
task if the source | 4031 // This shouldn't be possible because we should never have performed the
task if the source |
| 4138 // didn't represent a Dart file, but check to be safe. | 4032 // didn't represent a Dart file, but check to be safe. |
| 4139 throw new AnalysisException.con1("Internal error: attempting to generate
hints for non-Dart file as a Dart file: ${librarySource.fullName}"); | 4033 throw new AnalysisException.con1("Internal error: attempting to generate
hints for non-Dart file as a Dart file: ${librarySource.fullName}"); |
| 4140 } | 4034 } |
| 4141 if (thrownException == null) { | 4035 if (thrownException == null) { |
| 4142 thrownException = new AnalysisException.con1("GenerateDartHintsTask retu
rned a null hint map without throwing an exception: ${librarySource.fullName}"); | 4036 thrownException = new AnalysisException.con1("GenerateDartHintsTask retu
rned a null hint map without throwing an exception: ${librarySource.fullName}"); |
| 4143 } | 4037 } |
| 4144 DartEntryImpl dartCopy = (sourceEntry as DartEntry).writableCopy; | 4038 DartEntryImpl dartCopy = (sourceEntry as DartEntry).writableCopy; |
| 4145 dartCopy.setStateInLibrary(DartEntry.HINTS, librarySource, CacheState.ERRO
R); | 4039 dartCopy.recordHintErrorInLibrary(librarySource, thrownException); |
| 4146 dartCopy.exception = thrownException; | |
| 4147 _cache.put(librarySource, dartCopy); | 4040 _cache.put(librarySource, dartCopy); |
| 4148 throw thrownException; | 4041 throw thrownException; |
| 4149 } | 4042 } |
| 4150 for (MapEntry<Source, TimestampedData<List<AnalysisError>>> entry in getMapE
ntrySet(hintMap)) { | 4043 for (MapEntry<Source, TimestampedData<List<AnalysisError>>> entry in getMapE
ntrySet(hintMap)) { |
| 4151 Source unitSource = entry.getKey(); | 4044 Source unitSource = entry.getKey(); |
| 4152 TimestampedData<List<AnalysisError>> results = entry.getValue(); | 4045 TimestampedData<List<AnalysisError>> results = entry.getValue(); |
| 4153 SourceEntry sourceEntry = _cache.get(unitSource); | 4046 SourceEntry sourceEntry = _cache.get(unitSource); |
| 4154 if (sourceEntry is! DartEntry) { | 4047 if (sourceEntry is! DartEntry) { |
| 4155 // This shouldn't be possible because we should never have performed the
task if the source | 4048 // This shouldn't be possible because we should never have performed the
task if the source |
| 4156 // didn't represent a Dart file, but check to be safe. | 4049 // didn't represent a Dart file, but check to be safe. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4170 if (dartEntry == null) { | 4063 if (dartEntry == null) { |
| 4171 throw new AnalysisException.con1("A Dart file became a non-Dart file
: ${unitSource.fullName}"); | 4064 throw new AnalysisException.con1("A Dart file became a non-Dart file
: ${unitSource.fullName}"); |
| 4172 } | 4065 } |
| 4173 } | 4066 } |
| 4174 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4067 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4175 if (thrownException == null) { | 4068 if (thrownException == null) { |
| 4176 dartCopy.setValueInLibrary(DartEntry.HINTS, librarySource, results.dat
a); | 4069 dartCopy.setValueInLibrary(DartEntry.HINTS, librarySource, results.dat
a); |
| 4177 ChangeNoticeImpl notice = _getNotice(unitSource); | 4070 ChangeNoticeImpl notice = _getNotice(unitSource); |
| 4178 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LIN
E_INFO)); | 4071 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LIN
E_INFO)); |
| 4179 } else { | 4072 } else { |
| 4180 dartCopy.setStateInLibrary(DartEntry.HINTS, librarySource, CacheState.
ERROR); | 4073 dartCopy.recordHintErrorInLibrary(librarySource, thrownException); |
| 4181 } | 4074 } |
| 4182 dartCopy.exception = thrownException; | |
| 4183 _cache.put(unitSource, dartCopy); | 4075 _cache.put(unitSource, dartCopy); |
| 4184 dartEntry = dartCopy; | 4076 dartEntry = dartCopy; |
| 4185 } else { | 4077 } else { |
| 4186 _logInformation2("Generated hints discarded for ${_debuggingString(unitS
ource)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${d
artEntry.modificationTime}", thrownException); | 4078 _logInformation2("Generated hints discarded for ${_debuggingString(unitS
ource)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${d
artEntry.modificationTime}", thrownException); |
| 4187 if (dartEntry.getStateInLibrary(DartEntry.HINTS, librarySource) == Cache
State.IN_PROCESS) { | 4079 if (dartEntry.getStateInLibrary(DartEntry.HINTS, librarySource) == Cache
State.IN_PROCESS) { |
| 4188 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4080 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4189 if (thrownException == null || resultTime >= 0) { | 4081 if (thrownException == null || resultTime >= 0) { |
| 4190 // | 4082 // |
| 4191 // The analysis was performed on out-of-date sources. Mark the cache
so that the sources | 4083 // The analysis was performed on out-of-date sources. Mark the cache
so that the sources |
| 4192 // will be re-analyzed using the up-to-date sources. | 4084 // will be re-analyzed using the up-to-date sources. |
| 4193 // | 4085 // |
| 4194 // dartCopy.setState(DartEntry.HINTS, librarySource, Ca
cheState.INVALID); | 4086 // dartCopy.setState(DartEntry.HINTS, librarySource, Ca
cheState.INVALID); |
| 4195 _removeFromParts(unitSource, dartEntry); | 4087 _removeFromParts(unitSource, dartEntry); |
| 4196 dartCopy.invalidateAllInformation(); | 4088 dartCopy.invalidateAllInformation(); |
| 4197 dartCopy.modificationTime = sourceTime; | 4089 dartCopy.modificationTime = sourceTime; |
| 4198 _cache.removedAst(unitSource); | 4090 _cache.removedAst(unitSource); |
| 4199 _workManager.add(unitSource, SourcePriority.UNKNOWN); | 4091 _workManager.add(unitSource, SourcePriority.UNKNOWN); |
| 4200 } else { | 4092 } else { |
| 4201 // | 4093 // |
| 4202 // We could not determine whether the sources were up-to-date or out
-of-date. Mark the | 4094 // We could not determine whether the sources were up-to-date or out
-of-date. Mark the |
| 4203 // cache so that we won't attempt to re-analyze the sources until th
ere's a good chance | 4095 // cache so that we won't attempt to re-analyze the sources until th
ere's a good chance |
| 4204 // that we'll be able to do so without error. | 4096 // that we'll be able to do so without error. |
| 4205 // | 4097 // |
| 4206 dartCopy.setStateInLibrary(DartEntry.HINTS, librarySource, CacheStat
e.ERROR); | 4098 dartCopy.recordHintErrorInLibrary(librarySource, thrownException); |
| 4207 } | 4099 } |
| 4208 dartCopy.exception = thrownException; | |
| 4209 _cache.put(unitSource, dartCopy); | 4100 _cache.put(unitSource, dartCopy); |
| 4210 dartEntry = dartCopy; | 4101 dartEntry = dartCopy; |
| 4211 } | 4102 } |
| 4212 } | 4103 } |
| 4213 } | 4104 } |
| 4214 if (thrownException != null) { | 4105 if (thrownException != null) { |
| 4215 throw thrownException; | 4106 throw thrownException; |
| 4216 } | 4107 } |
| 4217 return libraryEntry; | 4108 return libraryEntry; |
| 4218 } | 4109 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 4233 SourceEntry sourceEntry = null; | 4124 SourceEntry sourceEntry = null; |
| 4234 sourceEntry = _cache.get(source); | 4125 sourceEntry = _cache.get(source); |
| 4235 if (sourceEntry == null) { | 4126 if (sourceEntry == null) { |
| 4236 throw new ObsoleteSourceAnalysisException(source); | 4127 throw new ObsoleteSourceAnalysisException(source); |
| 4237 } | 4128 } |
| 4238 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; | 4129 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; |
| 4239 if (thrownException == null) { | 4130 if (thrownException == null) { |
| 4240 sourceCopy.modificationTime = task.modificationTime; | 4131 sourceCopy.modificationTime = task.modificationTime; |
| 4241 sourceCopy.setValue(SourceEntry.CONTENT, task.content); | 4132 sourceCopy.setValue(SourceEntry.CONTENT, task.content); |
| 4242 } else { | 4133 } else { |
| 4243 sourceCopy.exception = thrownException; | 4134 sourceCopy.recordContentError(thrownException); |
| 4244 sourceCopy.recordContentError(); | |
| 4245 _workManager.remove(source); | 4135 _workManager.remove(source); |
| 4246 } | 4136 } |
| 4247 _cache.put(source, sourceCopy); | 4137 _cache.put(source, sourceCopy); |
| 4248 sourceEntry = sourceCopy; | 4138 sourceEntry = sourceCopy; |
| 4249 if (thrownException != null) { | 4139 if (thrownException != null) { |
| 4250 throw thrownException; | 4140 throw thrownException; |
| 4251 } | 4141 } |
| 4252 return sourceEntry; | 4142 return sourceEntry; |
| 4253 } | 4143 } |
| 4254 | 4144 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4343 dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources); | 4233 dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources); |
| 4344 dartCopy.setValue(DartEntry.INCLUDED_PARTS, newParts); | 4234 dartCopy.setValue(DartEntry.INCLUDED_PARTS, newParts); |
| 4345 _cache.storedAst(source); | 4235 _cache.storedAst(source); |
| 4346 ChangeNoticeImpl notice = _getNotice(source); | 4236 ChangeNoticeImpl notice = _getNotice(source); |
| 4347 notice.setErrors(dartCopy.allErrors, task.lineInfo); | 4237 notice.setErrors(dartCopy.allErrors, task.lineInfo); |
| 4348 // Verify that the incrementally parsed and resolved unit in the increme
ntal cache | 4238 // Verify that the incrementally parsed and resolved unit in the increme
ntal cache |
| 4349 // is structurally equivalent to the fully parsed unit | 4239 // is structurally equivalent to the fully parsed unit |
| 4350 _incrementalAnalysisCache = IncrementalAnalysisCache.verifyStructure(_in
crementalAnalysisCache, source, task.compilationUnit); | 4240 _incrementalAnalysisCache = IncrementalAnalysisCache.verifyStructure(_in
crementalAnalysisCache, source, task.compilationUnit); |
| 4351 } else { | 4241 } else { |
| 4352 _removeFromParts(source, dartEntry); | 4242 _removeFromParts(source, dartEntry); |
| 4353 dartCopy.recordParseError(); | 4243 dartCopy.recordParseError(thrownException); |
| 4354 _cache.removedAst(source); | 4244 _cache.removedAst(source); |
| 4355 } | 4245 } |
| 4356 dartCopy.exception = thrownException; | |
| 4357 _cache.put(source, dartCopy); | 4246 _cache.put(source, dartCopy); |
| 4358 dartEntry = dartCopy; | 4247 dartEntry = dartCopy; |
| 4359 } else { | 4248 } else { |
| 4360 _logInformation2("Parse results discarded for ${_debuggingString(source)};
sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEntry
.modificationTime}", thrownException); | 4249 _logInformation2("Parse results discarded for ${_debuggingString(source)};
sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEntry
.modificationTime}", thrownException); |
| 4361 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4250 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4362 if (thrownException == null || resultTime >= 0) { | 4251 if (thrownException == null || resultTime >= 0) { |
| 4363 // | 4252 // |
| 4364 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources | 4253 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources |
| 4365 // will be re-analyzed using the up-to-date sources. | 4254 // will be re-analyzed using the up-to-date sources. |
| 4366 // | 4255 // |
| 4367 // dartCopy.recordParseNotInProcess(); | 4256 // dartCopy.recordParseNotInProcess(); |
| 4368 _removeFromParts(source, dartEntry); | 4257 _removeFromParts(source, dartEntry); |
| 4369 dartCopy.invalidateAllInformation(); | 4258 dartCopy.invalidateAllInformation(); |
| 4370 dartCopy.modificationTime = sourceTime; | 4259 dartCopy.modificationTime = sourceTime; |
| 4371 _cache.removedAst(source); | 4260 _cache.removedAst(source); |
| 4372 _workManager.add(source, SourcePriority.UNKNOWN); | 4261 _workManager.add(source, SourcePriority.UNKNOWN); |
| 4373 } else { | 4262 } else { |
| 4374 // | 4263 // |
| 4375 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the | 4264 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the |
| 4376 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance | 4265 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance |
| 4377 // that we'll be able to do so without error. | 4266 // that we'll be able to do so without error. |
| 4378 // | 4267 // |
| 4379 dartCopy.recordParseError(); | 4268 dartCopy.recordParseError(thrownException); |
| 4380 } | 4269 } |
| 4381 dartCopy.exception = thrownException; | |
| 4382 _cache.put(source, dartCopy); | 4270 _cache.put(source, dartCopy); |
| 4383 dartEntry = dartCopy; | 4271 dartEntry = dartCopy; |
| 4384 } | 4272 } |
| 4385 if (thrownException != null) { | 4273 if (thrownException != null) { |
| 4386 throw thrownException; | 4274 throw thrownException; |
| 4387 } | 4275 } |
| 4388 return dartEntry; | 4276 return dartEntry; |
| 4389 } | 4277 } |
| 4390 | 4278 |
| 4391 /** | 4279 /** |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4425 LineInfo lineInfo = task.lineInfo; | 4313 LineInfo lineInfo = task.lineInfo; |
| 4426 ht.HtmlUnit unit = task.htmlUnit; | 4314 ht.HtmlUnit unit = task.htmlUnit; |
| 4427 htmlCopy.setValue(SourceEntry.LINE_INFO, lineInfo); | 4315 htmlCopy.setValue(SourceEntry.LINE_INFO, lineInfo); |
| 4428 htmlCopy.setValue(HtmlEntry.PARSED_UNIT, unit); | 4316 htmlCopy.setValue(HtmlEntry.PARSED_UNIT, unit); |
| 4429 htmlCopy.setValue(HtmlEntry.PARSE_ERRORS, task.errors); | 4317 htmlCopy.setValue(HtmlEntry.PARSE_ERRORS, task.errors); |
| 4430 htmlCopy.setValue(HtmlEntry.REFERENCED_LIBRARIES, task.referencedLibrari
es); | 4318 htmlCopy.setValue(HtmlEntry.REFERENCED_LIBRARIES, task.referencedLibrari
es); |
| 4431 _cache.storedAst(source); | 4319 _cache.storedAst(source); |
| 4432 ChangeNoticeImpl notice = _getNotice(source); | 4320 ChangeNoticeImpl notice = _getNotice(source); |
| 4433 notice.setErrors(htmlCopy.allErrors, lineInfo); | 4321 notice.setErrors(htmlCopy.allErrors, lineInfo); |
| 4434 } else { | 4322 } else { |
| 4435 htmlCopy.recordParseError(); | 4323 htmlCopy.recordParseError(thrownException); |
| 4436 _cache.removedAst(source); | 4324 _cache.removedAst(source); |
| 4437 } | 4325 } |
| 4438 htmlCopy.exception = thrownException; | |
| 4439 _cache.put(source, htmlCopy); | 4326 _cache.put(source, htmlCopy); |
| 4440 htmlEntry = htmlCopy; | 4327 htmlEntry = htmlCopy; |
| 4441 } else { | 4328 } else { |
| 4442 _logInformation2("Parse results discarded for ${_debuggingString(source)};
sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${htmlEntry
.modificationTime}", thrownException); | 4329 _logInformation2("Parse results discarded for ${_debuggingString(source)};
sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${htmlEntry
.modificationTime}", thrownException); |
| 4443 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy; | 4330 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy; |
| 4444 if (thrownException == null || resultTime >= 0) { | 4331 if (thrownException == null || resultTime >= 0) { |
| 4445 // | 4332 // |
| 4446 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources | 4333 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources |
| 4447 // will be re-analyzed using the up-to-date sources. | 4334 // will be re-analyzed using the up-to-date sources. |
| 4448 // | 4335 // |
| 4449 // if (htmlCopy.getState(SourceEntry.LINE_INFO) == CacheState.I
N_PROCESS) { | 4336 // if (htmlCopy.getState(SourceEntry.LINE_INFO) == CacheState.I
N_PROCESS) { |
| 4450 // htmlCopy.setState(SourceEntry.LINE_INFO, CacheState.INVALI
D); | 4337 // htmlCopy.setState(SourceEntry.LINE_INFO, CacheState.INVALI
D); |
| 4451 // } | 4338 // } |
| 4452 // if (htmlCopy.getState(HtmlEntry.PARSED_UNIT) == CacheState.I
N_PROCESS) { | 4339 // if (htmlCopy.getState(HtmlEntry.PARSED_UNIT) == CacheState.I
N_PROCESS) { |
| 4453 // htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.INVALI
D); | 4340 // htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.INVALI
D); |
| 4454 // } | 4341 // } |
| 4455 // if (htmlCopy.getState(HtmlEntry.REFERENCED_LIBRARIES) == Cac
heState.IN_PROCESS) { | 4342 // if (htmlCopy.getState(HtmlEntry.REFERENCED_LIBRARIES) == Cac
heState.IN_PROCESS) { |
| 4456 // htmlCopy.setState(HtmlEntry.REFERENCED_LIBRARIES, CacheSta
te.INVALID); | 4343 // htmlCopy.setState(HtmlEntry.REFERENCED_LIBRARIES, CacheSta
te.INVALID); |
| 4457 // } | 4344 // } |
| 4458 htmlCopy.invalidateAllInformation(); | 4345 htmlCopy.invalidateAllInformation(); |
| 4459 htmlCopy.modificationTime = sourceTime; | 4346 htmlCopy.modificationTime = sourceTime; |
| 4460 _cache.removedAst(source); | 4347 _cache.removedAst(source); |
| 4461 } else { | 4348 } else { |
| 4462 // | 4349 // |
| 4463 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the | 4350 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the |
| 4464 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance | 4351 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance |
| 4465 // that we'll be able to do so without error. | 4352 // that we'll be able to do so without error. |
| 4466 // | 4353 // |
| 4467 htmlCopy.setState(SourceEntry.LINE_INFO, CacheState.ERROR); | 4354 htmlCopy.recordParseError(thrownException); |
| 4468 htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.ERROR); | |
| 4469 htmlCopy.setState(HtmlEntry.RESOLVED_UNIT, CacheState.ERROR); | |
| 4470 htmlCopy.setState(HtmlEntry.REFERENCED_LIBRARIES, CacheState.ERROR); | |
| 4471 } | 4355 } |
| 4472 htmlCopy.exception = thrownException; | |
| 4473 _cache.put(source, htmlCopy); | 4356 _cache.put(source, htmlCopy); |
| 4474 htmlEntry = htmlCopy; | 4357 htmlEntry = htmlCopy; |
| 4475 } | 4358 } |
| 4476 if (thrownException != null) { | 4359 if (thrownException != null) { |
| 4477 throw thrownException; | 4360 throw thrownException; |
| 4478 } | 4361 } |
| 4479 return htmlEntry; | 4362 return htmlEntry; |
| 4480 } | 4363 } |
| 4481 | 4364 |
| 4482 /** | 4365 /** |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4510 throw new AnalysisException.con1("An HTML file became a non-HTML file:
${source.fullName}"); | 4393 throw new AnalysisException.con1("An HTML file became a non-HTML file:
${source.fullName}"); |
| 4511 } | 4394 } |
| 4512 } | 4395 } |
| 4513 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4396 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4514 if (thrownException == null) { | 4397 if (thrownException == null) { |
| 4515 htmlCopy.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, task.errors); | 4398 htmlCopy.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, task.errors); |
| 4516 // notify about errors | 4399 // notify about errors |
| 4517 ChangeNoticeImpl notice = _getNotice(source); | 4400 ChangeNoticeImpl notice = _getNotice(source); |
| 4518 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); | 4401 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); |
| 4519 } else { | 4402 } else { |
| 4520 htmlCopy.recordResolutionError(); | 4403 htmlCopy.recordResolutionError(thrownException); |
| 4521 } | 4404 } |
| 4522 htmlCopy.exception = thrownException; | |
| 4523 _cache.put(source, htmlCopy); | 4405 _cache.put(source, htmlCopy); |
| 4524 htmlEntry = htmlCopy; | 4406 htmlEntry = htmlCopy; |
| 4525 } else { | 4407 } else { |
| 4526 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4408 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4527 if (thrownException == null || resultTime >= 0) { | 4409 if (thrownException == null || resultTime >= 0) { |
| 4528 // | 4410 // |
| 4529 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources | 4411 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources |
| 4530 // will be re-analyzed using the up-to-date sources. | 4412 // will be re-analyzed using the up-to-date sources. |
| 4531 // | 4413 // |
| 4532 htmlCopy.invalidateAllInformation(); | 4414 htmlCopy.invalidateAllInformation(); |
| 4533 htmlCopy.modificationTime = sourceTime; | 4415 htmlCopy.modificationTime = sourceTime; |
| 4534 _cache.removedAst(source); | 4416 _cache.removedAst(source); |
| 4535 } else { | 4417 } else { |
| 4536 // | 4418 // |
| 4537 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the | 4419 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the |
| 4538 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance | 4420 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance |
| 4539 // that we'll be able to do so without error. | 4421 // that we'll be able to do so without error. |
| 4540 // | 4422 // |
| 4541 htmlCopy.recordResolutionError(); | 4423 htmlCopy.recordResolutionError(thrownException); |
| 4542 } | 4424 } |
| 4543 htmlCopy.exception = thrownException; | |
| 4544 _cache.put(source, htmlCopy); | 4425 _cache.put(source, htmlCopy); |
| 4545 htmlEntry = htmlCopy; | 4426 htmlEntry = htmlCopy; |
| 4546 } | 4427 } |
| 4547 if (thrownException != null) { | 4428 if (thrownException != null) { |
| 4548 throw thrownException; | 4429 throw thrownException; |
| 4549 } | 4430 } |
| 4550 return htmlEntry; | 4431 return htmlEntry; |
| 4551 } | 4432 } |
| 4552 | 4433 |
| 4553 /** | 4434 /** |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4581 throw new AnalysisException.con1("An HTML file became a non-HTML file:
${source.fullName}"); | 4462 throw new AnalysisException.con1("An HTML file became a non-HTML file:
${source.fullName}"); |
| 4582 } | 4463 } |
| 4583 } | 4464 } |
| 4584 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4465 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4585 if (thrownException == null) { | 4466 if (thrownException == null) { |
| 4586 htmlCopy.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, task.errors); | 4467 htmlCopy.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, task.errors); |
| 4587 // notify about errors | 4468 // notify about errors |
| 4588 ChangeNoticeImpl notice = _getNotice(source); | 4469 ChangeNoticeImpl notice = _getNotice(source); |
| 4589 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); | 4470 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); |
| 4590 } else { | 4471 } else { |
| 4591 htmlCopy.recordResolutionError(); | 4472 htmlCopy.recordResolutionError(thrownException); |
| 4592 } | 4473 } |
| 4593 htmlCopy.exception = thrownException; | |
| 4594 _cache.put(source, htmlCopy); | 4474 _cache.put(source, htmlCopy); |
| 4595 htmlEntry = htmlCopy; | 4475 htmlEntry = htmlCopy; |
| 4596 } else { | 4476 } else { |
| 4597 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4477 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4598 if (thrownException == null || resultTime >= 0) { | 4478 if (thrownException == null || resultTime >= 0) { |
| 4599 // | 4479 // |
| 4600 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources | 4480 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources |
| 4601 // will be re-analyzed using the up-to-date sources. | 4481 // will be re-analyzed using the up-to-date sources. |
| 4602 // | 4482 // |
| 4603 htmlCopy.invalidateAllInformation(); | 4483 htmlCopy.invalidateAllInformation(); |
| 4604 htmlCopy.modificationTime = sourceTime; | 4484 htmlCopy.modificationTime = sourceTime; |
| 4605 _cache.removedAst(source); | 4485 _cache.removedAst(source); |
| 4606 } else { | 4486 } else { |
| 4607 // | 4487 // |
| 4608 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the | 4488 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the |
| 4609 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance | 4489 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance |
| 4610 // that we'll be able to do so without error. | 4490 // that we'll be able to do so without error. |
| 4611 // | 4491 // |
| 4612 htmlCopy.recordResolutionError(); | 4492 htmlCopy.recordResolutionError(thrownException); |
| 4613 } | 4493 } |
| 4614 htmlCopy.exception = thrownException; | |
| 4615 _cache.put(source, htmlCopy); | 4494 _cache.put(source, htmlCopy); |
| 4616 htmlEntry = htmlCopy; | 4495 htmlEntry = htmlCopy; |
| 4617 } | 4496 } |
| 4618 if (thrownException != null) { | 4497 if (thrownException != null) { |
| 4619 throw thrownException; | 4498 throw thrownException; |
| 4620 } | 4499 } |
| 4621 return htmlEntry; | 4500 return htmlEntry; |
| 4622 } | 4501 } |
| 4623 | 4502 |
| 4624 /** | 4503 /** |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4653 } | 4532 } |
| 4654 } | 4533 } |
| 4655 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4534 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4656 if (thrownException == null) { | 4535 if (thrownException == null) { |
| 4657 htmlCopy.setValue(HtmlEntry.ANGULAR_ERRORS, task.resolutionErrors); | 4536 htmlCopy.setValue(HtmlEntry.ANGULAR_ERRORS, task.resolutionErrors); |
| 4658 // notify about errors | 4537 // notify about errors |
| 4659 ChangeNoticeImpl notice = _getNotice(source); | 4538 ChangeNoticeImpl notice = _getNotice(source); |
| 4660 notice.htmlUnit = task.resolvedUnit; | 4539 notice.htmlUnit = task.resolvedUnit; |
| 4661 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); | 4540 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); |
| 4662 } else { | 4541 } else { |
| 4663 htmlCopy.recordResolutionError(); | 4542 htmlCopy.recordResolutionError(thrownException); |
| 4664 } | 4543 } |
| 4665 htmlCopy.exception = thrownException; | |
| 4666 _cache.put(source, htmlCopy); | 4544 _cache.put(source, htmlCopy); |
| 4667 htmlEntry = htmlCopy; | 4545 htmlEntry = htmlCopy; |
| 4668 } else { | 4546 } else { |
| 4669 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4547 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4670 if (thrownException == null || resultTime >= 0) { | 4548 if (thrownException == null || resultTime >= 0) { |
| 4671 // | 4549 // |
| 4672 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources | 4550 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources |
| 4673 // will be re-analyzed using the up-to-date sources. | 4551 // will be re-analyzed using the up-to-date sources. |
| 4674 // | 4552 // |
| 4675 // if (htmlCopy.getState(HtmlEntry.ANGULAR_ERRORS) == CacheStat
e.IN_PROCESS) { | 4553 // if (htmlCopy.getState(HtmlEntry.ANGULAR_ERRORS) == CacheStat
e.IN_PROCESS) { |
| 4676 // htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.INV
ALID); | 4554 // htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.INV
ALID); |
| 4677 // } | 4555 // } |
| 4678 // if (htmlCopy.getState(HtmlEntry.ELEMENT) == CacheState.IN_PR
OCESS) { | 4556 // if (htmlCopy.getState(HtmlEntry.ELEMENT) == CacheState.IN_PR
OCESS) { |
| 4679 // htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.INVALID); | 4557 // htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.INVALID); |
| 4680 // } | 4558 // } |
| 4681 // if (htmlCopy.getState(HtmlEntry.RESOLUTION_ERRORS) == CacheS
tate.IN_PROCESS) { | 4559 // if (htmlCopy.getState(HtmlEntry.RESOLUTION_ERRORS) == CacheS
tate.IN_PROCESS) { |
| 4682 // htmlCopy.setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.
INVALID); | 4560 // htmlCopy.setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.
INVALID); |
| 4683 // } | 4561 // } |
| 4684 htmlCopy.invalidateAllInformation(); | 4562 htmlCopy.invalidateAllInformation(); |
| 4685 htmlCopy.modificationTime = sourceTime; | 4563 htmlCopy.modificationTime = sourceTime; |
| 4686 _cache.removedAst(source); | 4564 _cache.removedAst(source); |
| 4687 } else { | 4565 } else { |
| 4688 // | 4566 // |
| 4689 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the | 4567 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the |
| 4690 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance | 4568 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance |
| 4691 // that we'll be able to do so without error. | 4569 // that we'll be able to do so without error. |
| 4692 // | 4570 // |
| 4693 htmlCopy.recordResolutionError(); | 4571 htmlCopy.recordResolutionError(thrownException); |
| 4694 } | 4572 } |
| 4695 htmlCopy.exception = thrownException; | |
| 4696 _cache.put(source, htmlCopy); | 4573 _cache.put(source, htmlCopy); |
| 4697 htmlEntry = htmlCopy; | 4574 htmlEntry = htmlCopy; |
| 4698 } | 4575 } |
| 4699 if (thrownException != null) { | 4576 if (thrownException != null) { |
| 4700 throw thrownException; | 4577 throw thrownException; |
| 4701 } | 4578 } |
| 4702 return htmlEntry; | 4579 return htmlEntry; |
| 4703 } | 4580 } |
| 4704 | 4581 |
| 4705 /** | 4582 /** |
| (...skipping 29 matching lines...) Expand all Loading... |
| 4735 } | 4612 } |
| 4736 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4613 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4737 if (thrownException == null) { | 4614 if (thrownException == null) { |
| 4738 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit); | 4615 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit); |
| 4739 _recordAngularEntryPoint(htmlCopy, task); | 4616 _recordAngularEntryPoint(htmlCopy, task); |
| 4740 _cache.storedAst(source); | 4617 _cache.storedAst(source); |
| 4741 ChangeNoticeImpl notice = _getNotice(source); | 4618 ChangeNoticeImpl notice = _getNotice(source); |
| 4742 notice.htmlUnit = task.resolvedUnit; | 4619 notice.htmlUnit = task.resolvedUnit; |
| 4743 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); | 4620 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); |
| 4744 } else { | 4621 } else { |
| 4745 htmlCopy.recordResolutionError(); | 4622 htmlCopy.recordResolutionError(thrownException); |
| 4746 } | 4623 } |
| 4747 htmlCopy.exception = thrownException; | |
| 4748 _cache.put(source, htmlCopy); | 4624 _cache.put(source, htmlCopy); |
| 4749 htmlEntry = htmlCopy; | 4625 htmlEntry = htmlCopy; |
| 4750 } else { | 4626 } else { |
| 4751 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4627 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4752 if (thrownException == null || resultTime >= 0) { | 4628 if (thrownException == null || resultTime >= 0) { |
| 4753 // | 4629 // |
| 4754 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources | 4630 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources |
| 4755 // will be re-analyzed using the up-to-date sources. | 4631 // will be re-analyzed using the up-to-date sources. |
| 4756 // | 4632 // |
| 4757 // if (htmlCopy.getState(HtmlEntry.ANGULAR_ERRORS) == CacheStat
e.IN_PROCESS) { | 4633 // if (htmlCopy.getState(HtmlEntry.ANGULAR_ERRORS) == CacheStat
e.IN_PROCESS) { |
| 4758 // htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.INV
ALID); | 4634 // htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.INV
ALID); |
| 4759 // } | 4635 // } |
| 4760 // if (htmlCopy.getState(HtmlEntry.ELEMENT) == CacheState.IN_PR
OCESS) { | 4636 // if (htmlCopy.getState(HtmlEntry.ELEMENT) == CacheState.IN_PR
OCESS) { |
| 4761 // htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.INVALID); | 4637 // htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.INVALID); |
| 4762 // } | 4638 // } |
| 4763 // if (htmlCopy.getState(HtmlEntry.RESOLUTION_ERRORS) == CacheS
tate.IN_PROCESS) { | 4639 // if (htmlCopy.getState(HtmlEntry.RESOLUTION_ERRORS) == CacheS
tate.IN_PROCESS) { |
| 4764 // htmlCopy.setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.
INVALID); | 4640 // htmlCopy.setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.
INVALID); |
| 4765 // } | 4641 // } |
| 4766 htmlCopy.invalidateAllInformation(); | 4642 htmlCopy.invalidateAllInformation(); |
| 4767 htmlCopy.modificationTime = sourceTime; | 4643 htmlCopy.modificationTime = sourceTime; |
| 4768 _cache.removedAst(source); | 4644 _cache.removedAst(source); |
| 4769 } else { | 4645 } else { |
| 4770 // | 4646 // |
| 4771 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the | 4647 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the |
| 4772 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance | 4648 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance |
| 4773 // that we'll be able to do so without error. | 4649 // that we'll be able to do so without error. |
| 4774 // | 4650 // |
| 4775 htmlCopy.recordResolutionError(); | 4651 htmlCopy.recordResolutionError(thrownException); |
| 4776 } | 4652 } |
| 4777 htmlCopy.exception = thrownException; | |
| 4778 _cache.put(source, htmlCopy); | 4653 _cache.put(source, htmlCopy); |
| 4779 htmlEntry = htmlCopy; | 4654 htmlEntry = htmlCopy; |
| 4780 } | 4655 } |
| 4781 if (thrownException != null) { | 4656 if (thrownException != null) { |
| 4782 throw thrownException; | 4657 throw thrownException; |
| 4783 } | 4658 } |
| 4784 return htmlEntry; | 4659 return htmlEntry; |
| 4785 } | 4660 } |
| 4786 | 4661 |
| 4787 /** | 4662 /** |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4815 dartEntry = _getReadableDartEntry(unitSource); | 4690 dartEntry = _getReadableDartEntry(unitSource); |
| 4816 if (dartEntry == null) { | 4691 if (dartEntry == null) { |
| 4817 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${unitSource.fullName}"); | 4692 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${unitSource.fullName}"); |
| 4818 } | 4693 } |
| 4819 } | 4694 } |
| 4820 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4695 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4821 if (thrownException == null) { | 4696 if (thrownException == null) { |
| 4822 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource, task.
resolvedUnit); | 4697 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource, task.
resolvedUnit); |
| 4823 _cache.storedAst(unitSource); | 4698 _cache.storedAst(unitSource); |
| 4824 } else { | 4699 } else { |
| 4825 dartCopy.setStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource, Cache
State.ERROR); | 4700 dartCopy.recordResolutionErrorInLibrary(librarySource, thrownException); |
| 4826 _cache.removedAst(unitSource); | 4701 _cache.removedAst(unitSource); |
| 4827 } | 4702 } |
| 4828 dartCopy.exception = thrownException; | |
| 4829 _cache.put(unitSource, dartCopy); | 4703 _cache.put(unitSource, dartCopy); |
| 4830 dartEntry = dartCopy; | 4704 dartEntry = dartCopy; |
| 4831 } else { | 4705 } else { |
| 4832 _logInformation2("Resolution results discarded for ${_debuggingString(unit
Source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${
dartEntry.modificationTime}", thrownException); | 4706 _logInformation2("Resolution results discarded for ${_debuggingString(unit
Source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${
dartEntry.modificationTime}", thrownException); |
| 4833 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4707 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4834 if (thrownException == null || resultTime >= 0) { | 4708 if (thrownException == null || resultTime >= 0) { |
| 4835 // | 4709 // |
| 4836 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources | 4710 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources |
| 4837 // will be re-analyzed using the up-to-date sources. | 4711 // will be re-analyzed using the up-to-date sources. |
| 4838 // | 4712 // |
| 4839 // if (dartCopy.getState(DartEntry.RESOLVED_UNIT) == CacheState
.IN_PROCESS) { | 4713 // if (dartCopy.getState(DartEntry.RESOLVED_UNIT) == CacheState
.IN_PROCESS) { |
| 4840 // dartCopy.setState(DartEntry.RESOLVED_UNIT, librarySource,
CacheState.INVALID); | 4714 // dartCopy.setState(DartEntry.RESOLVED_UNIT, librarySource,
CacheState.INVALID); |
| 4841 // } | 4715 // } |
| 4842 _removeFromParts(unitSource, dartEntry); | 4716 _removeFromParts(unitSource, dartEntry); |
| 4843 dartCopy.invalidateAllInformation(); | 4717 dartCopy.invalidateAllInformation(); |
| 4844 dartCopy.modificationTime = sourceTime; | 4718 dartCopy.modificationTime = sourceTime; |
| 4845 _cache.removedAst(unitSource); | 4719 _cache.removedAst(unitSource); |
| 4846 _workManager.add(unitSource, SourcePriority.UNKNOWN); | 4720 _workManager.add(unitSource, SourcePriority.UNKNOWN); |
| 4847 } else { | 4721 } else { |
| 4848 // | 4722 // |
| 4849 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the | 4723 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the |
| 4850 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance | 4724 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance |
| 4851 // that we'll be able to do so without error. | 4725 // that we'll be able to do so without error. |
| 4852 // | 4726 // |
| 4853 dartCopy.setStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource, Cache
State.ERROR); | 4727 dartCopy.recordResolutionErrorInLibrary(librarySource, thrownException); |
| 4854 } | 4728 } |
| 4855 dartCopy.exception = thrownException; | |
| 4856 _cache.put(unitSource, dartCopy); | 4729 _cache.put(unitSource, dartCopy); |
| 4857 dartEntry = dartCopy; | 4730 dartEntry = dartCopy; |
| 4858 } | 4731 } |
| 4859 if (thrownException != null) { | 4732 if (thrownException != null) { |
| 4860 throw thrownException; | 4733 throw thrownException; |
| 4861 } | 4734 } |
| 4862 return dartEntry; | 4735 return dartEntry; |
| 4863 } | 4736 } |
| 4864 | 4737 |
| 4865 /** | 4738 /** |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4898 if (thrownException == null) { | 4771 if (thrownException == null) { |
| 4899 htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.FLUSHED); | 4772 htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.FLUSHED); |
| 4900 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit); | 4773 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit); |
| 4901 htmlCopy.setValue(HtmlEntry.ELEMENT, task.element); | 4774 htmlCopy.setValue(HtmlEntry.ELEMENT, task.element); |
| 4902 htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors); | 4775 htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors); |
| 4903 _cache.storedAst(source); | 4776 _cache.storedAst(source); |
| 4904 ChangeNoticeImpl notice = _getNotice(source); | 4777 ChangeNoticeImpl notice = _getNotice(source); |
| 4905 notice.htmlUnit = task.resolvedUnit; | 4778 notice.htmlUnit = task.resolvedUnit; |
| 4906 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); | 4779 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); |
| 4907 } else { | 4780 } else { |
| 4908 htmlCopy.recordResolutionError(); | 4781 htmlCopy.recordResolutionError(thrownException); |
| 4909 _cache.removedAst(source); | 4782 _cache.removedAst(source); |
| 4910 } | 4783 } |
| 4911 htmlCopy.exception = thrownException; | |
| 4912 _cache.put(source, htmlCopy); | 4784 _cache.put(source, htmlCopy); |
| 4913 htmlEntry = htmlCopy; | 4785 htmlEntry = htmlCopy; |
| 4914 } else { | 4786 } else { |
| 4915 _logInformation2("Resolution results discarded for ${_debuggingString(sour
ce)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${html
Entry.modificationTime}", thrownException); | 4787 _logInformation2("Resolution results discarded for ${_debuggingString(sour
ce)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${html
Entry.modificationTime}", thrownException); |
| 4916 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4788 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 4917 if (thrownException == null || resultTime >= 0) { | 4789 if (thrownException == null || resultTime >= 0) { |
| 4918 // | 4790 // |
| 4919 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources | 4791 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources |
| 4920 // will be re-analyzed using the up-to-date sources. | 4792 // will be re-analyzed using the up-to-date sources. |
| 4921 // | 4793 // |
| 4922 // if (htmlCopy.getState(HtmlEntry.ELEMENT) == CacheState.IN_PR
OCESS) { | 4794 // if (htmlCopy.getState(HtmlEntry.ELEMENT) == CacheState.IN_PR
OCESS) { |
| 4923 // htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.INVALID); | 4795 // htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.INVALID); |
| 4924 // } | 4796 // } |
| 4925 // if (htmlCopy.getState(HtmlEntry.RESOLUTION_ERRORS) == CacheS
tate.IN_PROCESS) { | 4797 // if (htmlCopy.getState(HtmlEntry.RESOLUTION_ERRORS) == CacheS
tate.IN_PROCESS) { |
| 4926 // htmlCopy.setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.
INVALID); | 4798 // htmlCopy.setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.
INVALID); |
| 4927 // } | 4799 // } |
| 4928 htmlCopy.invalidateAllInformation(); | 4800 htmlCopy.invalidateAllInformation(); |
| 4929 htmlCopy.modificationTime = sourceTime; | 4801 htmlCopy.modificationTime = sourceTime; |
| 4930 _cache.removedAst(source); | 4802 _cache.removedAst(source); |
| 4931 } else { | 4803 } else { |
| 4932 // | 4804 // |
| 4933 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the | 4805 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the |
| 4934 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance | 4806 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance |
| 4935 // that we'll be able to do so without error. | 4807 // that we'll be able to do so without error. |
| 4936 // | 4808 // |
| 4937 htmlCopy.recordResolutionError(); | 4809 htmlCopy.recordResolutionError(thrownException); |
| 4938 } | 4810 } |
| 4939 htmlCopy.exception = thrownException; | |
| 4940 _cache.put(source, htmlCopy); | 4811 _cache.put(source, htmlCopy); |
| 4941 htmlEntry = htmlCopy; | 4812 htmlEntry = htmlCopy; |
| 4942 } | 4813 } |
| 4943 if (thrownException != null) { | 4814 if (thrownException != null) { |
| 4944 throw thrownException; | 4815 throw thrownException; |
| 4945 } | 4816 } |
| 4946 return htmlEntry; | 4817 return htmlEntry; |
| 4947 } | 4818 } |
| 4948 | 4819 |
| 4949 /** | 4820 /** |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4983 LineInfo lineInfo = task.lineInfo; | 4854 LineInfo lineInfo = task.lineInfo; |
| 4984 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo); | 4855 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo); |
| 4985 dartCopy.setValue(DartEntry.TOKEN_STREAM, task.tokenStream); | 4856 dartCopy.setValue(DartEntry.TOKEN_STREAM, task.tokenStream); |
| 4986 dartCopy.setValue(DartEntry.SCAN_ERRORS, task.errors); | 4857 dartCopy.setValue(DartEntry.SCAN_ERRORS, task.errors); |
| 4987 _cache.storedAst(source); | 4858 _cache.storedAst(source); |
| 4988 _workManager.add(source, SourcePriority.NORMAL_PART); | 4859 _workManager.add(source, SourcePriority.NORMAL_PART); |
| 4989 ChangeNoticeImpl notice = _getNotice(source); | 4860 ChangeNoticeImpl notice = _getNotice(source); |
| 4990 notice.setErrors(dartEntry.allErrors, lineInfo); | 4861 notice.setErrors(dartEntry.allErrors, lineInfo); |
| 4991 } else { | 4862 } else { |
| 4992 _removeFromParts(source, dartEntry); | 4863 _removeFromParts(source, dartEntry); |
| 4993 dartCopy.recordScanError(); | 4864 dartCopy.recordScanError(thrownException); |
| 4994 _cache.removedAst(source); | 4865 _cache.removedAst(source); |
| 4995 } | 4866 } |
| 4996 dartCopy.exception = thrownException; | |
| 4997 _cache.put(source, dartCopy); | 4867 _cache.put(source, dartCopy); |
| 4998 dartEntry = dartCopy; | 4868 dartEntry = dartCopy; |
| 4999 } else { | 4869 } else { |
| 5000 _logInformation2("Scan results discarded for ${_debuggingString(source)};
sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEntry.
modificationTime}", thrownException); | 4870 _logInformation2("Scan results discarded for ${_debuggingString(source)};
sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEntry.
modificationTime}", thrownException); |
| 5001 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4871 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 5002 if (thrownException == null || resultTime >= 0) { | 4872 if (thrownException == null || resultTime >= 0) { |
| 5003 // | 4873 // |
| 5004 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources | 4874 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources |
| 5005 // will be re-analyzed using the up-to-date sources. | 4875 // will be re-analyzed using the up-to-date sources. |
| 5006 // | 4876 // |
| 5007 // dartCopy.recordScanNotInProcess(); | 4877 // dartCopy.recordScanNotInProcess(); |
| 5008 _removeFromParts(source, dartEntry); | 4878 _removeFromParts(source, dartEntry); |
| 5009 dartCopy.invalidateAllInformation(); | 4879 dartCopy.invalidateAllInformation(); |
| 5010 dartCopy.modificationTime = sourceTime; | 4880 dartCopy.modificationTime = sourceTime; |
| 5011 _cache.removedAst(source); | 4881 _cache.removedAst(source); |
| 5012 _workManager.add(source, SourcePriority.UNKNOWN); | 4882 _workManager.add(source, SourcePriority.UNKNOWN); |
| 5013 } else { | 4883 } else { |
| 5014 // | 4884 // |
| 5015 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the | 4885 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the |
| 5016 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance | 4886 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance |
| 5017 // that we'll be able to do so without error. | 4887 // that we'll be able to do so without error. |
| 5018 // | 4888 // |
| 5019 dartCopy.recordScanError(); | 4889 dartCopy.recordScanError(thrownException); |
| 5020 } | 4890 } |
| 5021 dartCopy.exception = thrownException; | |
| 5022 _cache.put(source, dartCopy); | 4891 _cache.put(source, dartCopy); |
| 5023 dartEntry = dartCopy; | 4892 dartEntry = dartCopy; |
| 5024 } | 4893 } |
| 5025 if (thrownException != null) { | 4894 if (thrownException != null) { |
| 5026 throw thrownException; | 4895 throw thrownException; |
| 5027 } | 4896 } |
| 5028 return dartEntry; | 4897 return dartEntry; |
| 5029 } | 4898 } |
| 5030 | 4899 |
| 5031 /** | 4900 /** |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5174 /** | 5043 /** |
| 5175 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 5044 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 5176 * | 5045 * |
| 5177 * @param source the source that has been deleted | 5046 * @param source the source that has been deleted |
| 5178 */ | 5047 */ |
| 5179 void _sourceDeleted(Source source) { | 5048 void _sourceDeleted(Source source) { |
| 5180 SourceEntry sourceEntry = _cache.get(source); | 5049 SourceEntry sourceEntry = _cache.get(source); |
| 5181 if (sourceEntry is HtmlEntry) { | 5050 if (sourceEntry is HtmlEntry) { |
| 5182 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy; | 5051 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy; |
| 5183 _invalidateAngularResolution(htmlCopy); | 5052 _invalidateAngularResolution(htmlCopy); |
| 5184 htmlCopy.recordContentError(); | 5053 htmlCopy.recordContentError(new AnalysisException.con1("This source was ma
rked as being deleted")); |
| 5185 _cache.put(source, htmlCopy); | 5054 _cache.put(source, htmlCopy); |
| 5186 } else if (sourceEntry is DartEntry) { | 5055 } else if (sourceEntry is DartEntry) { |
| 5187 Set<Source> libraries = new Set<Source>(); | 5056 Set<Source> libraries = new Set<Source>(); |
| 5188 for (Source librarySource in getLibrariesContaining(source)) { | 5057 for (Source librarySource in getLibrariesContaining(source)) { |
| 5189 libraries.add(librarySource); | 5058 libraries.add(librarySource); |
| 5190 for (Source dependentLibrary in getLibrariesDependingOn(librarySource))
{ | 5059 for (Source dependentLibrary in getLibrariesDependingOn(librarySource))
{ |
| 5191 libraries.add(dependentLibrary); | 5060 libraries.add(dependentLibrary); |
| 5192 } | 5061 } |
| 5193 } | 5062 } |
| 5194 for (Source librarySource in libraries) { | 5063 for (Source librarySource in libraries) { |
| 5195 _invalidateLibraryResolution(librarySource); | 5064 _invalidateLibraryResolution(librarySource); |
| 5196 } | 5065 } |
| 5197 DartEntryImpl dartCopy = sourceEntry.writableCopy; | 5066 DartEntryImpl dartCopy = sourceEntry.writableCopy; |
| 5198 dartCopy.recordContentError(); | 5067 dartCopy.recordContentError(new AnalysisException.con1("This source was ma
rked as being deleted")); |
| 5199 _cache.put(source, dartCopy); | 5068 _cache.put(source, dartCopy); |
| 5200 } | 5069 } |
| 5201 _workManager.remove(source); | 5070 _workManager.remove(source); |
| 5202 _removeFromPriorityOrder(source); | 5071 _removeFromPriorityOrder(source); |
| 5203 } | 5072 } |
| 5204 | 5073 |
| 5205 /** | 5074 /** |
| 5206 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 5075 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 5207 * | 5076 * |
| 5208 * @param source the source that has been removed | 5077 * @param source the source that has been removed |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5865 | 5734 |
| 5866 @override | 5735 @override |
| 5867 String toString() { | 5736 String toString() { |
| 5868 if (task == null) { | 5737 if (task == null) { |
| 5869 return "blocked: ${_blocked}"; | 5738 return "blocked: ${_blocked}"; |
| 5870 } | 5739 } |
| 5871 return task.toString(); | 5740 return task.toString(); |
| 5872 } | 5741 } |
| 5873 } | 5742 } |
| 5874 | 5743 |
| 5744 /** |
| 5745 * The interface `AnalysisContextStatistics` defines access to statistics about
a single |
| 5746 * [AnalysisContext]. |
| 5747 */ |
| 5748 abstract class AnalysisContextStatistics { |
| 5749 /** |
| 5750 * Return the statistics for each kind of cached data. |
| 5751 */ |
| 5752 List<AnalysisContextStatistics_CacheRow> get cacheRows; |
| 5753 |
| 5754 /** |
| 5755 * Return the exceptions that caused some entries to have a state of [CacheSta
te#ERROR]. |
| 5756 */ |
| 5757 List<AnalysisException> get exceptions; |
| 5758 |
| 5759 /** |
| 5760 * Return information about each of the partitions in the cache. |
| 5761 */ |
| 5762 List<AnalysisContextStatistics_PartitionData> get partitionData; |
| 5763 |
| 5764 /** |
| 5765 * Return an array containing all of the sources in the cache. |
| 5766 */ |
| 5767 List<Source> get sources; |
| 5768 } |
| 5769 |
| 5770 /** |
| 5771 * Implementation of the [AnalysisContextStatistics]. |
| 5772 */ |
| 5773 class AnalysisContextStatisticsImpl implements AnalysisContextStatistics { |
| 5774 Map<String, AnalysisContextStatistics_CacheRow> _dataMap = new Map<String, Ana
lysisContextStatistics_CacheRow>(); |
| 5775 |
| 5776 List<Source> _sources = new List<Source>(); |
| 5777 |
| 5778 Set<AnalysisException> _exceptions = new Set<AnalysisException>(); |
| 5779 |
| 5780 List<AnalysisContextStatistics_PartitionData> _partitionData; |
| 5781 |
| 5782 void addSource(Source source) { |
| 5783 _sources.add(source); |
| 5784 } |
| 5785 |
| 5786 @override |
| 5787 List<AnalysisContextStatistics_CacheRow> get cacheRows { |
| 5788 Iterable<AnalysisContextStatistics_CacheRow> items = _dataMap.values; |
| 5789 return new List.from(items); |
| 5790 } |
| 5791 |
| 5792 @override |
| 5793 List<AnalysisException> get exceptions => new List.from(_exceptions); |
| 5794 |
| 5795 @override |
| 5796 List<AnalysisContextStatistics_PartitionData> get partitionData => _partitionD
ata; |
| 5797 |
| 5798 @override |
| 5799 List<Source> get sources => new List.from(_sources); |
| 5800 |
| 5801 void putCacheItem(SourceEntry dartEntry, DataDescriptor descriptor) { |
| 5802 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getState(descriptor))
; |
| 5803 } |
| 5804 |
| 5805 void putCacheItemInLibrary(DartEntry dartEntry, Source librarySource, DataDesc
riptor descriptor) { |
| 5806 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getStateInLibrary(des
criptor, librarySource)); |
| 5807 } |
| 5808 |
| 5809 /** |
| 5810 * Set the partition data returned by this object to the given data. |
| 5811 */ |
| 5812 void set partitionData(List<AnalysisContextStatistics_PartitionData> data) { |
| 5813 _partitionData = data; |
| 5814 } |
| 5815 |
| 5816 void _internalPutCacheItem(SourceEntry dartEntry, DataDescriptor rowDesc, Cach
eState state) { |
| 5817 String rowName = rowDesc.toString(); |
| 5818 AnalysisContextStatisticsImpl_CacheRowImpl row = _dataMap[rowName] as Analys
isContextStatisticsImpl_CacheRowImpl; |
| 5819 if (row == null) { |
| 5820 row = new AnalysisContextStatisticsImpl_CacheRowImpl(rowName); |
| 5821 _dataMap[rowName] = row; |
| 5822 } |
| 5823 row._incState(state); |
| 5824 if (state == CacheState.ERROR) { |
| 5825 AnalysisException exception = dartEntry.exception; |
| 5826 if (exception != null) { |
| 5827 _exceptions.add(exception); |
| 5828 } |
| 5829 } |
| 5830 } |
| 5831 } |
| 5832 |
| 5833 class AnalysisContextStatisticsImpl_CacheRowImpl implements AnalysisContextStati
stics_CacheRow { |
| 5834 final String name; |
| 5835 |
| 5836 int _errorCount = 0; |
| 5837 |
| 5838 int _flushedCount = 0; |
| 5839 |
| 5840 int _inProcessCount = 0; |
| 5841 |
| 5842 int _invalidCount = 0; |
| 5843 |
| 5844 int _validCount = 0; |
| 5845 |
| 5846 AnalysisContextStatisticsImpl_CacheRowImpl(this.name); |
| 5847 |
| 5848 @override |
| 5849 bool operator ==(Object obj) => obj is AnalysisContextStatisticsImpl_CacheRowI
mpl && obj.name == name; |
| 5850 |
| 5851 @override |
| 5852 int get errorCount => _errorCount; |
| 5853 |
| 5854 @override |
| 5855 int get flushedCount => _flushedCount; |
| 5856 |
| 5857 @override |
| 5858 int get inProcessCount => _inProcessCount; |
| 5859 |
| 5860 @override |
| 5861 int get invalidCount => _invalidCount; |
| 5862 |
| 5863 @override |
| 5864 int get validCount => _validCount; |
| 5865 |
| 5866 @override |
| 5867 int get hashCode => name.hashCode; |
| 5868 |
| 5869 void _incState(CacheState state) { |
| 5870 if (state == CacheState.ERROR) { |
| 5871 _errorCount++; |
| 5872 } |
| 5873 if (state == CacheState.FLUSHED) { |
| 5874 _flushedCount++; |
| 5875 } |
| 5876 if (state == CacheState.IN_PROCESS) { |
| 5877 _inProcessCount++; |
| 5878 } |
| 5879 if (state == CacheState.INVALID) { |
| 5880 _invalidCount++; |
| 5881 } |
| 5882 if (state == CacheState.VALID) { |
| 5883 _validCount++; |
| 5884 } |
| 5885 } |
| 5886 } |
| 5887 |
| 5888 class AnalysisContextStatisticsImpl_PartitionDataImpl implements AnalysisContext
Statistics_PartitionData { |
| 5889 final int astCount; |
| 5890 |
| 5891 final int totalCount; |
| 5892 |
| 5893 AnalysisContextStatisticsImpl_PartitionDataImpl(this.astCount, this.totalCount
); |
| 5894 } |
| 5895 |
| 5896 /** |
| 5897 * Information about single piece of data in the cache. |
| 5898 */ |
| 5899 abstract class AnalysisContextStatistics_CacheRow { |
| 5900 /** |
| 5901 * Return the number of entries whose state is [CacheState#ERROR]. |
| 5902 */ |
| 5903 int get errorCount; |
| 5904 |
| 5905 /** |
| 5906 * Return the number of entries whose state is [CacheState#FLUSHED]. |
| 5907 */ |
| 5908 int get flushedCount; |
| 5909 |
| 5910 /** |
| 5911 * Return the number of entries whose state is [CacheState#IN_PROCESS]. |
| 5912 */ |
| 5913 int get inProcessCount; |
| 5914 |
| 5915 /** |
| 5916 * Return the number of entries whose state is [CacheState#INVALID]. |
| 5917 */ |
| 5918 int get invalidCount; |
| 5919 |
| 5920 /** |
| 5921 * Return the name of the data represented by this object. |
| 5922 */ |
| 5923 String get name; |
| 5924 |
| 5925 /** |
| 5926 * Return the number of entries whose state is [CacheState#VALID]. |
| 5927 */ |
| 5928 int get validCount; |
| 5929 } |
| 5930 |
| 5931 /** |
| 5932 * Information about a single partition in the cache. |
| 5933 */ |
| 5934 abstract class AnalysisContextStatistics_PartitionData { |
| 5935 /** |
| 5936 * Return the number of entries in the partition that have an AST structure in
one state or |
| 5937 * another. |
| 5938 */ |
| 5939 int get astCount; |
| 5940 |
| 5941 /** |
| 5942 * Return the total number of entries in the partition. |
| 5943 */ |
| 5944 int get totalCount; |
| 5945 } |
| 5946 |
| 5947 /** |
| 5948 * Instances of the class `AnalysisDelta` indicate changes to the types of analy
sis that |
| 5949 * should be performed. |
| 5950 */ |
| 5951 class AnalysisDelta { |
| 5952 /** |
| 5953 * A mapping from source to what type of analysis should be performed on that
source. |
| 5954 */ |
| 5955 Map<Source, AnalysisLevel> _analysisMap = new Map<Source, AnalysisLevel>(); |
| 5956 |
| 5957 /** |
| 5958 * Return a collection of the sources that have been added. This is equivalent
to calling |
| 5959 * [getAnalysisLevels] and collecting all sources that do not have an analysis
level of |
| 5960 * [AnalysisLevel#NONE]. |
| 5961 * |
| 5962 * @return a collection of the sources |
| 5963 */ |
| 5964 Iterable<Source> get addedSources { |
| 5965 List<Source> result = new List<Source>(); |
| 5966 for (MapEntry<Source, AnalysisLevel> entry in getMapEntrySet(_analysisMap))
{ |
| 5967 if (entry.getValue() != AnalysisLevel.NONE) { |
| 5968 result.add(entry.getKey()); |
| 5969 } |
| 5970 } |
| 5971 return result; |
| 5972 } |
| 5973 |
| 5974 /** |
| 5975 * Return a mapping of sources to the level of analysis that should be perform
ed. |
| 5976 * |
| 5977 * @return the analysis map |
| 5978 */ |
| 5979 Map<Source, AnalysisLevel> get analysisLevels => _analysisMap; |
| 5980 |
| 5981 /** |
| 5982 * Record that the specified source should be analyzed at the specified level. |
| 5983 * |
| 5984 * @param source the source |
| 5985 * @param level the level at which the given source should be analyzed |
| 5986 */ |
| 5987 void setAnalysisLevel(Source source, AnalysisLevel level) { |
| 5988 _analysisMap[source] = level; |
| 5989 } |
| 5990 |
| 5991 @override |
| 5992 String toString() { |
| 5993 JavaStringBuilder builder = new JavaStringBuilder(); |
| 5994 bool needsSeparator = _appendSources(builder, false, AnalysisLevel.ALL); |
| 5995 needsSeparator = _appendSources(builder, needsSeparator, AnalysisLevel.RESOL
VED); |
| 5996 _appendSources(builder, needsSeparator, AnalysisLevel.NONE); |
| 5997 return builder.toString(); |
| 5998 } |
| 5999 |
| 6000 /** |
| 6001 * Append sources with the given analysis level, prefixed with a label and pos
sibly a separator. |
| 6002 * |
| 6003 * @param builder the builder to which the sources are to be appended |
| 6004 * @param needsSeparator `true` if a separator is needed before the label |
| 6005 * @param level the analysis level of the sources to be appended |
| 6006 * @return `true` if future lists of sources will need a separator |
| 6007 */ |
| 6008 bool _appendSources(JavaStringBuilder builder, bool needsSeparator, AnalysisLe
vel level) { |
| 6009 bool first = true; |
| 6010 for (MapEntry<Source, AnalysisLevel> entry in getMapEntrySet(_analysisMap))
{ |
| 6011 if (entry.getValue() == level) { |
| 6012 if (first) { |
| 6013 first = false; |
| 6014 if (needsSeparator) { |
| 6015 builder.append("; "); |
| 6016 } |
| 6017 builder.append(level); |
| 6018 builder.append(" "); |
| 6019 } else { |
| 6020 builder.append(", "); |
| 6021 } |
| 6022 builder.append(entry.getKey().fullName); |
| 6023 } |
| 6024 } |
| 6025 return needsSeparator || !first; |
| 6026 } |
| 6027 } |
| 6028 |
| 5875 /** | 6029 /** |
| 5876 * The unique instance of the class `AnalysisEngine` serves as the entry point f
or the | 6030 * The unique instance of the class `AnalysisEngine` serves as the entry point f
or the |
| 5877 * functionality provided by the analysis engine. | 6031 * functionality provided by the analysis engine. |
| 5878 */ | 6032 */ |
| 5879 class AnalysisEngine { | 6033 class AnalysisEngine { |
| 5880 /** | 6034 /** |
| 5881 * The suffix used for Dart source files. | 6035 * The suffix used for Dart source files. |
| 5882 */ | 6036 */ |
| 5883 static String SUFFIX_DART = "dart"; | 6037 static String SUFFIX_DART = "dart"; |
| 5884 | 6038 |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6047 | 6201 |
| 6048 /** | 6202 /** |
| 6049 * Initialize a newly created exception to have the given cause. | 6203 * Initialize a newly created exception to have the given cause. |
| 6050 * | 6204 * |
| 6051 * @param cause the underlying exception that caused this exception | 6205 * @param cause the underlying exception that caused this exception |
| 6052 */ | 6206 */ |
| 6053 AnalysisException.con3(Exception cause) : super.withCause(cause); | 6207 AnalysisException.con3(Exception cause) : super.withCause(cause); |
| 6054 } | 6208 } |
| 6055 | 6209 |
| 6056 /** | 6210 /** |
| 6211 * The enumeration `AnalysisLevel` encodes the different levels at which a sourc
e can be |
| 6212 * analyzed. |
| 6213 */ |
| 6214 class AnalysisLevel extends Enum<AnalysisLevel> { |
| 6215 /** |
| 6216 * Indicates a source should be fully analyzed. |
| 6217 */ |
| 6218 static const AnalysisLevel ALL = const AnalysisLevel('ALL', 0); |
| 6219 |
| 6220 /** |
| 6221 * Indicates a source should be resolved and that errors, warnings and hints a
re needed. |
| 6222 */ |
| 6223 static const AnalysisLevel ERRORS = const AnalysisLevel('ERRORS', 1); |
| 6224 |
| 6225 /** |
| 6226 * Indicates a source should be resolved, but that errors, warnings and hints
are not needed. |
| 6227 */ |
| 6228 static const AnalysisLevel RESOLVED = const AnalysisLevel('RESOLVED', 2); |
| 6229 |
| 6230 /** |
| 6231 * Indicates a source is not of interest to the client. |
| 6232 */ |
| 6233 static const AnalysisLevel NONE = const AnalysisLevel('NONE', 3); |
| 6234 |
| 6235 static const List<AnalysisLevel> values = const [ALL, ERRORS, RESOLVED, NONE]; |
| 6236 |
| 6237 const AnalysisLevel(String name, int ordinal) : super(name, ordinal); |
| 6238 } |
| 6239 |
| 6240 /** |
| 6057 * The interface `AnalysisOptions` defines the behavior of objects that provide
access to a | 6241 * The interface `AnalysisOptions` defines the behavior of objects that provide
access to a |
| 6058 * set of analysis options used to control the behavior of an analysis context. | 6242 * set of analysis options used to control the behavior of an analysis context. |
| 6059 */ | 6243 */ |
| 6060 abstract class AnalysisOptions { | 6244 abstract class AnalysisOptions { |
| 6061 /** | 6245 /** |
| 6062 * Return `true` if analysis is to analyze Angular. | 6246 * Return `true` if analysis is to analyze Angular. |
| 6063 * | 6247 * |
| 6064 * @return `true` if analysis is to analyze Angular | 6248 * @return `true` if analysis is to analyze Angular |
| 6065 */ | 6249 */ |
| 6066 bool get analyzeAngular; | 6250 bool get analyzeAngular; |
| (...skipping 1743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7810 | 7994 |
| 7811 /** | 7995 /** |
| 7812 * Return the entry associated with the given source. | 7996 * Return the entry associated with the given source. |
| 7813 * | 7997 * |
| 7814 * @param source the source whose entry is to be returned | 7998 * @param source the source whose entry is to be returned |
| 7815 * @return the entry associated with the given source | 7999 * @return the entry associated with the given source |
| 7816 */ | 8000 */ |
| 7817 SourceEntry get(Source source) => _sourceMap[source]; | 8001 SourceEntry get(Source source) => _sourceMap[source]; |
| 7818 | 8002 |
| 7819 /** | 8003 /** |
| 8004 * Return the number of entries in this partition that have an AST associated
with them. |
| 8005 * |
| 8006 * @return the number of entries in this partition that have an AST associated
with them |
| 8007 */ |
| 8008 int get astSize { |
| 8009 int astSize = 0; |
| 8010 int count = _recentlyUsed.length; |
| 8011 for (int i = 0; i < count; i++) { |
| 8012 Source source = _recentlyUsed[i]; |
| 8013 SourceEntry sourceEntry = _sourceMap[source]; |
| 8014 if (sourceEntry is DartEntry) { |
| 8015 if (sourceEntry.anyParsedCompilationUnit != null) { |
| 8016 astSize++; |
| 8017 } |
| 8018 } else if (sourceEntry is HtmlEntry) { |
| 8019 if (sourceEntry.anyParsedUnit != null) { |
| 8020 astSize++; |
| 8021 } |
| 8022 } |
| 8023 } |
| 8024 return astSize; |
| 8025 } |
| 8026 |
| 8027 /** |
| 7820 * Return a table mapping the sources known to the context to the information
known about the | 8028 * Return a table mapping the sources known to the context to the information
known about the |
| 7821 * source. | 8029 * source. |
| 7822 * | 8030 * |
| 7823 * <b>Note:</b> This method is only visible for use by [AnalysisCache] and sho
uld not be | 8031 * <b>Note:</b> This method is only visible for use by [AnalysisCache] and sho
uld not be |
| 7824 * used for any other purpose. | 8032 * used for any other purpose. |
| 7825 * | 8033 * |
| 7826 * @return a table mapping the sources known to the context to the information
known about the | 8034 * @return a table mapping the sources known to the context to the information
known about the |
| 7827 * source | 8035 * source |
| 7828 */ | 8036 */ |
| 7829 Map<Source, SourceEntry> get map => _sourceMap; | 8037 Map<Source, SourceEntry> get map => _sourceMap; |
| (...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8957 return state._verificationErrorsState; | 9165 return state._verificationErrorsState; |
| 8958 } else if (identical(descriptor, DartEntry.HINTS)) { | 9166 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 8959 return state._hintsState; | 9167 return state._hintsState; |
| 8960 } else { | 9168 } else { |
| 8961 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); | 9169 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); |
| 8962 } | 9170 } |
| 8963 } | 9171 } |
| 8964 state = state._nextState; | 9172 state = state._nextState; |
| 8965 } | 9173 } |
| 8966 ; | 9174 ; |
| 8967 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS) || identical(descr
iptor, DartEntry.RESOLUTION_ERRORS) || identical(descriptor, DartEntry.RESOLVED_
UNIT) || identical(descriptor, DartEntry.VERIFICATION_ERRORS) || identical(descr
iptor, DartEntry.HINTS)) { | 9175 if (identical(descriptor, DartEntry.BUILD_ELEMENT_ERRORS) || identical(descr
iptor, DartEntry.BUILT_UNIT) || identical(descriptor, DartEntry.RESOLUTION_ERROR
S) || identical(descriptor, DartEntry.RESOLVED_UNIT) || identical(descriptor, Da
rtEntry.VERIFICATION_ERRORS) || identical(descriptor, DartEntry.HINTS)) { |
| 8968 return CacheState.INVALID; | 9176 return CacheState.INVALID; |
| 8969 } else { | 9177 } else { |
| 8970 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 9178 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 8971 } | 9179 } |
| 8972 } | 9180 } |
| 8973 | 9181 |
| 8974 @override | 9182 @override |
| 8975 Object getValue(DataDescriptor descriptor) { | 9183 Object getValue(DataDescriptor descriptor) { |
| 8976 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { | 9184 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { |
| 8977 return _angularErrors; | 9185 return _angularErrors; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9168 } | 9376 } |
| 9169 state = state._nextState; | 9377 state = state._nextState; |
| 9170 } | 9378 } |
| 9171 return true; | 9379 return true; |
| 9172 } | 9380 } |
| 9173 | 9381 |
| 9174 /** | 9382 /** |
| 9175 * Record that an error occurred while attempting to build the element model f
or the source | 9383 * Record that an error occurred while attempting to build the element model f
or the source |
| 9176 * represented by this entry. This will set the state of all resolution-based
information as being | 9384 * represented by this entry. This will set the state of all resolution-based
information as being |
| 9177 * in error, but will not change the state of any parse results. | 9385 * in error, but will not change the state of any parse results. |
| 9386 * |
| 9387 * @param librarySource the source of the library in which the element model w
as being built |
| 9388 * @param exception the exception that shows where the error occurred |
| 9178 */ | 9389 */ |
| 9179 void recordBuildElementError() { | 9390 void recordBuildElementErrorInLibrary(Source librarySource, AnalysisException
exception) { |
| 9391 this.exception = exception; |
| 9180 _element = null; | 9392 _element = null; |
| 9181 _elementState = CacheState.ERROR; | 9393 _elementState = CacheState.ERROR; |
| 9182 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); | 9394 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); |
| 9183 _clientServerState = CacheState.ERROR; | 9395 _clientServerState = CacheState.ERROR; |
| 9184 _launchableState = CacheState.ERROR; | 9396 _launchableState = CacheState.ERROR; |
| 9185 recordResolutionError(); | 9397 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); |
| 9398 state.recordBuildElementError(); |
| 9186 } | 9399 } |
| 9187 | 9400 |
| 9188 /** | 9401 /** |
| 9189 * Record that an in-process model build has stopped without recording results
because the results | 9402 * Record that an in-process model build has stopped without recording results
because the results |
| 9190 * were invalidated before they could be recorded. | 9403 * were invalidated before they could be recorded. |
| 9191 */ | 9404 */ |
| 9192 void recordBuildElementNotInProcess() { | 9405 void recordBuildElementNotInProcess() { |
| 9193 if (_elementState == CacheState.IN_PROCESS) { | 9406 if (_elementState == CacheState.IN_PROCESS) { |
| 9194 _elementState = CacheState.INVALID; | 9407 _elementState = CacheState.INVALID; |
| 9195 } | 9408 } |
| 9196 if (_clientServerState == CacheState.IN_PROCESS) { | 9409 if (_clientServerState == CacheState.IN_PROCESS) { |
| 9197 _clientServerState = CacheState.INVALID; | 9410 _clientServerState = CacheState.INVALID; |
| 9198 } | 9411 } |
| 9199 if (_launchableState == CacheState.IN_PROCESS) { | 9412 if (_launchableState == CacheState.IN_PROCESS) { |
| 9200 _launchableState = CacheState.INVALID; | 9413 _launchableState = CacheState.INVALID; |
| 9201 } | 9414 } |
| 9202 } | 9415 } |
| 9203 | 9416 |
| 9204 @override | 9417 @override |
| 9205 void recordContentError() { | 9418 void recordContentError(AnalysisException exception) { |
| 9206 super.recordContentError(); | 9419 super.recordContentError(exception); |
| 9207 recordScanError(); | 9420 recordScanError(exception); |
| 9421 } |
| 9422 |
| 9423 /** |
| 9424 * Record that an error occurred while attempting to generate hints for the so
urce represented by |
| 9425 * this entry. This will set the state of all verification information as bein
g in error. |
| 9426 * |
| 9427 * @param librarySource the source of the library in which hints were being ge
nerated |
| 9428 * @param exception the exception that shows where the error occurred |
| 9429 */ |
| 9430 void recordHintErrorInLibrary(Source librarySource, AnalysisException exceptio
n) { |
| 9431 this.exception = exception; |
| 9432 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); |
| 9433 state.recordHintError(); |
| 9208 } | 9434 } |
| 9209 | 9435 |
| 9210 /** | 9436 /** |
| 9211 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 9437 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
| 9212 * entry. This will set the state of all information, including any resolution
-based information, | 9438 * entry. This will set the state of all information, including any resolution
-based information, |
| 9213 * as being in error. | 9439 * as being in error. |
| 9440 * |
| 9441 * @param exception the exception that shows where the error occurred |
| 9214 */ | 9442 */ |
| 9215 void recordParseError() { | 9443 void recordParseError(AnalysisException exception) { |
| 9216 _sourceKind = SourceKind.UNKNOWN; | 9444 _sourceKind = SourceKind.UNKNOWN; |
| 9217 _sourceKindState = CacheState.ERROR; | 9445 _sourceKindState = CacheState.ERROR; |
| 9218 _parseErrors = AnalysisError.NO_ERRORS; | 9446 _parseErrors = AnalysisError.NO_ERRORS; |
| 9219 _parseErrorsState = CacheState.ERROR; | 9447 _parseErrorsState = CacheState.ERROR; |
| 9220 _parsedUnit = null; | 9448 _parsedUnit = null; |
| 9221 _parsedUnitAccessed = false; | 9449 _parsedUnitAccessed = false; |
| 9222 _parsedUnitState = CacheState.ERROR; | 9450 _parsedUnitState = CacheState.ERROR; |
| 9223 _exportedLibraries = Source.EMPTY_ARRAY; | 9451 _exportedLibraries = Source.EMPTY_ARRAY; |
| 9224 _exportedLibrariesState = CacheState.ERROR; | 9452 _exportedLibrariesState = CacheState.ERROR; |
| 9225 _importedLibraries = Source.EMPTY_ARRAY; | 9453 _importedLibraries = Source.EMPTY_ARRAY; |
| 9226 _importedLibrariesState = CacheState.ERROR; | 9454 _importedLibrariesState = CacheState.ERROR; |
| 9227 _includedParts = Source.EMPTY_ARRAY; | 9455 _includedParts = Source.EMPTY_ARRAY; |
| 9228 _includedPartsState = CacheState.ERROR; | 9456 _includedPartsState = CacheState.ERROR; |
| 9229 recordResolutionError(); | 9457 recordResolutionError(exception); |
| 9230 } | 9458 } |
| 9231 | 9459 |
| 9232 /** | 9460 /** |
| 9233 * Record that the parse-related information for the associated source is abou
t to be computed by | 9461 * Record that the parse-related information for the associated source is abou
t to be computed by |
| 9234 * the current thread. | 9462 * the current thread. |
| 9235 */ | 9463 */ |
| 9236 void recordParseInProcess() { | 9464 void recordParseInProcess() { |
| 9237 if (_sourceKindState != CacheState.VALID) { | 9465 if (_sourceKindState != CacheState.VALID) { |
| 9238 _sourceKindState = CacheState.IN_PROCESS; | 9466 _sourceKindState = CacheState.IN_PROCESS; |
| 9239 } | 9467 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9279 } | 9507 } |
| 9280 if (_includedPartsState == CacheState.IN_PROCESS) { | 9508 if (_includedPartsState == CacheState.IN_PROCESS) { |
| 9281 _includedPartsState = CacheState.INVALID; | 9509 _includedPartsState = CacheState.INVALID; |
| 9282 } | 9510 } |
| 9283 } | 9511 } |
| 9284 | 9512 |
| 9285 /** | 9513 /** |
| 9286 * Record that an error occurred while attempting to resolve the source repres
ented by this entry. | 9514 * Record that an error occurred while attempting to resolve the source repres
ented by this entry. |
| 9287 * This will set the state of all resolution-based information as being in err
or, but will not | 9515 * This will set the state of all resolution-based information as being in err
or, but will not |
| 9288 * change the state of any parse results. | 9516 * change the state of any parse results. |
| 9517 * |
| 9518 * @param exception the exception that shows where the error occurred |
| 9289 */ | 9519 */ |
| 9290 void recordResolutionError() { | 9520 void recordResolutionError(AnalysisException exception) { |
| 9521 this.exception = exception; |
| 9291 _element = null; | 9522 _element = null; |
| 9292 _elementState = CacheState.ERROR; | 9523 _elementState = CacheState.ERROR; |
| 9293 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); | 9524 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); |
| 9525 _clientServerState = CacheState.ERROR; |
| 9526 _launchableState = CacheState.ERROR; |
| 9527 _publicNamespace = null; |
| 9528 _publicNamespaceState = CacheState.ERROR; |
| 9529 _resolutionState.recordResolutionErrorsInAllLibraries(); |
| 9530 } |
| 9531 |
| 9532 /** |
| 9533 * Record that an error occurred while attempting to resolve the source repres
ented by this entry. |
| 9534 * This will set the state of all resolution-based information as being in err
or, but will not |
| 9535 * change the state of any parse results. |
| 9536 * |
| 9537 * @param librarySource the source of the library in which resolution was bein
g performed |
| 9538 * @param exception the exception that shows where the error occurred |
| 9539 */ |
| 9540 void recordResolutionErrorInLibrary(Source librarySource, AnalysisException ex
ception) { |
| 9541 this.exception = exception; |
| 9542 _element = null; |
| 9543 _elementState = CacheState.ERROR; |
| 9544 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); |
| 9294 _clientServerState = CacheState.ERROR; | 9545 _clientServerState = CacheState.ERROR; |
| 9295 _launchableState = CacheState.ERROR; | 9546 _launchableState = CacheState.ERROR; |
| 9296 _publicNamespace = null; | 9547 _publicNamespace = null; |
| 9297 _publicNamespaceState = CacheState.ERROR; | 9548 _publicNamespaceState = CacheState.ERROR; |
| 9298 _resolutionState.recordResolutionError(); | 9549 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); |
| 9550 state.recordResolutionError(); |
| 9299 } | 9551 } |
| 9300 | 9552 |
| 9301 /** | 9553 /** |
| 9302 * Record that an in-process resolution has stopped without recording results
because the results | 9554 * Record that an in-process resolution has stopped without recording results
because the results |
| 9303 * were invalidated before they could be recorded. | 9555 * were invalidated before they could be recorded. |
| 9304 */ | 9556 */ |
| 9305 void recordResolutionNotInProcess() { | 9557 void recordResolutionNotInProcess() { |
| 9306 if (_elementState == CacheState.IN_PROCESS) { | 9558 if (_elementState == CacheState.IN_PROCESS) { |
| 9307 _elementState = CacheState.INVALID; | 9559 _elementState = CacheState.INVALID; |
| 9308 } | 9560 } |
| 9309 if (_clientServerState == CacheState.IN_PROCESS) { | 9561 if (_clientServerState == CacheState.IN_PROCESS) { |
| 9310 _clientServerState = CacheState.INVALID; | 9562 _clientServerState = CacheState.INVALID; |
| 9311 } | 9563 } |
| 9312 if (_launchableState == CacheState.IN_PROCESS) { | 9564 if (_launchableState == CacheState.IN_PROCESS) { |
| 9313 _launchableState = CacheState.INVALID; | 9565 _launchableState = CacheState.INVALID; |
| 9314 } | 9566 } |
| 9315 // TODO(brianwilkerson) Remove the code above this line after resolution and
element building | 9567 // TODO(brianwilkerson) Remove the code above this line after resolution and
element building |
| 9316 // are separated. | 9568 // are separated. |
| 9317 if (_publicNamespaceState == CacheState.IN_PROCESS) { | 9569 if (_publicNamespaceState == CacheState.IN_PROCESS) { |
| 9318 _publicNamespaceState = CacheState.INVALID; | 9570 _publicNamespaceState = CacheState.INVALID; |
| 9319 } | 9571 } |
| 9320 _resolutionState.recordResolutionNotInProcess(); | 9572 _resolutionState.recordResolutionNotInProcess(); |
| 9321 } | 9573 } |
| 9322 | 9574 |
| 9323 /** | 9575 /** |
| 9324 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 9576 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
| 9325 * entry. This will set the state of all information, including any resolution
-based information, | 9577 * entry. This will set the state of all information, including any resolution
-based information, |
| 9326 * as being in error. | 9578 * as being in error. |
| 9579 * |
| 9580 * @param exception the exception that shows where the error occurred |
| 9327 */ | 9581 */ |
| 9328 void recordScanError() { | 9582 @override |
| 9329 setState(SourceEntry.LINE_INFO, CacheState.ERROR); | 9583 void recordScanError(AnalysisException exception) { |
| 9584 super.recordScanError(exception); |
| 9330 _scanErrors = AnalysisError.NO_ERRORS; | 9585 _scanErrors = AnalysisError.NO_ERRORS; |
| 9331 _scanErrorsState = CacheState.ERROR; | 9586 _scanErrorsState = CacheState.ERROR; |
| 9332 _tokenStream = null; | 9587 _tokenStream = null; |
| 9333 _tokenStreamState = CacheState.ERROR; | 9588 _tokenStreamState = CacheState.ERROR; |
| 9334 recordParseError(); | 9589 recordParseError(exception); |
| 9335 } | 9590 } |
| 9336 | 9591 |
| 9337 /** | 9592 /** |
| 9338 * Record that the scan-related information for the associated source is about
to be computed by | 9593 * Record that the scan-related information for the associated source is about
to be computed by |
| 9339 * the current thread. | 9594 * the current thread. |
| 9340 */ | 9595 */ |
| 9341 void recordScanInProcess() { | 9596 void recordScanInProcess() { |
| 9342 if (getState(SourceEntry.LINE_INFO) != CacheState.VALID) { | 9597 if (getState(SourceEntry.LINE_INFO) != CacheState.VALID) { |
| 9343 setState(SourceEntry.LINE_INFO, CacheState.IN_PROCESS); | 9598 setState(SourceEntry.LINE_INFO, CacheState.IN_PROCESS); |
| 9344 } | 9599 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 9360 } | 9615 } |
| 9361 if (_scanErrorsState == CacheState.IN_PROCESS) { | 9616 if (_scanErrorsState == CacheState.IN_PROCESS) { |
| 9362 _scanErrorsState = CacheState.INVALID; | 9617 _scanErrorsState = CacheState.INVALID; |
| 9363 } | 9618 } |
| 9364 if (_tokenStreamState == CacheState.IN_PROCESS) { | 9619 if (_tokenStreamState == CacheState.IN_PROCESS) { |
| 9365 _tokenStreamState = CacheState.INVALID; | 9620 _tokenStreamState = CacheState.INVALID; |
| 9366 } | 9621 } |
| 9367 } | 9622 } |
| 9368 | 9623 |
| 9369 /** | 9624 /** |
| 9625 * Record that an error occurred while attempting to generate errors and warni
ngs for the source |
| 9626 * represented by this entry. This will set the state of all verification info
rmation as being in |
| 9627 * error. |
| 9628 * |
| 9629 * @param librarySource the source of the library in which verification was be
ing performed |
| 9630 * @param exception the exception that shows where the error occurred |
| 9631 */ |
| 9632 void recordVerificationErrorInLibrary(Source librarySource, AnalysisException
exception) { |
| 9633 this.exception = exception; |
| 9634 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); |
| 9635 state.recordVerificationError(); |
| 9636 } |
| 9637 |
| 9638 /** |
| 9370 * Remove the given library from the list of libraries that contain this part.
This method should | 9639 * Remove the given library from the list of libraries that contain this part.
This method should |
| 9371 * only be invoked on entries that represent a part. | 9640 * only be invoked on entries that represent a part. |
| 9372 * | 9641 * |
| 9373 * @param librarySource the source of the library to be removed | 9642 * @param librarySource the source of the library to be removed |
| 9374 */ | 9643 */ |
| 9375 void removeContainingLibrary(Source librarySource) { | 9644 void removeContainingLibrary(Source librarySource) { |
| 9376 _containingLibraries.remove(librarySource); | 9645 _containingLibraries.remove(librarySource); |
| 9377 } | 9646 } |
| 9378 | 9647 |
| 9379 /** | 9648 /** |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9845 _resolvedUnit = null; | 10114 _resolvedUnit = null; |
| 9846 _resolutionErrorsState = CacheState.INVALID; | 10115 _resolutionErrorsState = CacheState.INVALID; |
| 9847 _resolutionErrors = AnalysisError.NO_ERRORS; | 10116 _resolutionErrors = AnalysisError.NO_ERRORS; |
| 9848 _verificationErrorsState = CacheState.INVALID; | 10117 _verificationErrorsState = CacheState.INVALID; |
| 9849 _verificationErrors = AnalysisError.NO_ERRORS; | 10118 _verificationErrors = AnalysisError.NO_ERRORS; |
| 9850 _hintsState = CacheState.INVALID; | 10119 _hintsState = CacheState.INVALID; |
| 9851 _hints = AnalysisError.NO_ERRORS; | 10120 _hints = AnalysisError.NO_ERRORS; |
| 9852 } | 10121 } |
| 9853 | 10122 |
| 9854 /** | 10123 /** |
| 10124 * Record that an error occurred while attempting to build the element model f
or the source |
| 10125 * represented by this state. |
| 10126 */ |
| 10127 void recordBuildElementError() { |
| 10128 _builtUnitState = CacheState.ERROR; |
| 10129 _builtUnit = null; |
| 10130 _buildElementErrorsState = CacheState.ERROR; |
| 10131 _buildElementErrors = AnalysisError.NO_ERRORS; |
| 10132 recordResolutionError(); |
| 10133 } |
| 10134 |
| 10135 /** |
| 10136 * Record that an error occurred while attempting to generate hints for the so
urce represented |
| 10137 * by this entry. This will set the state of all verification information as b
eing in error. |
| 10138 */ |
| 10139 void recordHintError() { |
| 10140 _hints = AnalysisError.NO_ERRORS; |
| 10141 _hintsState = CacheState.ERROR; |
| 10142 } |
| 10143 |
| 10144 /** |
| 10145 * Record that an error occurred while attempting to resolve the source repres
ented by this |
| 10146 * state. |
| 10147 */ |
| 10148 void recordResolutionError() { |
| 10149 _resolvedUnitState = CacheState.ERROR; |
| 10150 _resolvedUnit = null; |
| 10151 _resolutionErrorsState = CacheState.ERROR; |
| 10152 _resolutionErrors = AnalysisError.NO_ERRORS; |
| 10153 recordVerificationError(); |
| 10154 } |
| 10155 |
| 10156 /** |
| 9855 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 10157 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
| 9856 * entry. This will set the state of all resolution-based information as being
in error, but | 10158 * entry. This will set the state of all resolution-based information as being
in error, but |
| 9857 * will not change the state of any parse results. | 10159 * will not change the state of any parse results. |
| 9858 */ | 10160 */ |
| 9859 void recordResolutionError() { | 10161 void recordResolutionErrorsInAllLibraries() { |
| 9860 _builtUnitState = CacheState.ERROR; | 10162 _builtUnitState = CacheState.ERROR; |
| 9861 _builtUnit = null; | 10163 _builtUnit = null; |
| 9862 _buildElementErrorsState = CacheState.ERROR; | 10164 _buildElementErrorsState = CacheState.ERROR; |
| 9863 _buildElementErrors = AnalysisError.NO_ERRORS; | 10165 _buildElementErrors = AnalysisError.NO_ERRORS; |
| 9864 _resolvedUnitState = CacheState.ERROR; | 10166 _resolvedUnitState = CacheState.ERROR; |
| 9865 _resolvedUnit = null; | 10167 _resolvedUnit = null; |
| 9866 _resolutionErrorsState = CacheState.ERROR; | 10168 _resolutionErrorsState = CacheState.ERROR; |
| 9867 _resolutionErrors = AnalysisError.NO_ERRORS; | 10169 _resolutionErrors = AnalysisError.NO_ERRORS; |
| 9868 _verificationErrorsState = CacheState.ERROR; | 10170 recordVerificationError(); |
| 9869 _verificationErrors = AnalysisError.NO_ERRORS; | |
| 9870 _hintsState = CacheState.ERROR; | |
| 9871 _hints = AnalysisError.NO_ERRORS; | |
| 9872 if (_nextState != null) { | 10171 if (_nextState != null) { |
| 9873 _nextState.recordResolutionError(); | 10172 _nextState.recordResolutionErrorsInAllLibraries(); |
| 9874 } | 10173 } |
| 9875 } | 10174 } |
| 9876 | 10175 |
| 9877 /** | 10176 /** |
| 9878 * Record that an in-process parse has stopped without recording results becau
se the results | 10177 * Record that an in-process parse has stopped without recording results becau
se the results |
| 9879 * were invalidated before they could be recorded. | 10178 * were invalidated before they could be recorded. |
| 9880 */ | 10179 */ |
| 9881 void recordResolutionNotInProcess() { | 10180 void recordResolutionNotInProcess() { |
| 9882 if (_resolvedUnitState == CacheState.IN_PROCESS) { | 10181 if (_resolvedUnitState == CacheState.IN_PROCESS) { |
| 9883 _resolvedUnitState = CacheState.INVALID; | 10182 _resolvedUnitState = CacheState.INVALID; |
| 9884 } | 10183 } |
| 9885 if (_resolutionErrorsState == CacheState.IN_PROCESS) { | 10184 if (_resolutionErrorsState == CacheState.IN_PROCESS) { |
| 9886 _resolutionErrorsState = CacheState.INVALID; | 10185 _resolutionErrorsState = CacheState.INVALID; |
| 9887 } | 10186 } |
| 9888 if (_verificationErrorsState == CacheState.IN_PROCESS) { | 10187 if (_verificationErrorsState == CacheState.IN_PROCESS) { |
| 9889 _verificationErrorsState = CacheState.INVALID; | 10188 _verificationErrorsState = CacheState.INVALID; |
| 9890 } | 10189 } |
| 9891 if (_hintsState == CacheState.IN_PROCESS) { | 10190 if (_hintsState == CacheState.IN_PROCESS) { |
| 9892 _hintsState = CacheState.INVALID; | 10191 _hintsState = CacheState.INVALID; |
| 9893 } | 10192 } |
| 9894 if (_nextState != null) { | 10193 if (_nextState != null) { |
| 9895 _nextState.recordResolutionNotInProcess(); | 10194 _nextState.recordResolutionNotInProcess(); |
| 9896 } | 10195 } |
| 9897 } | 10196 } |
| 9898 | 10197 |
| 9899 /** | 10198 /** |
| 10199 * Record that an error occurred while attempting to generate errors and warni
ngs for the source |
| 10200 * represented by this entry. This will set the state of all verification info
rmation as being |
| 10201 * in error. |
| 10202 */ |
| 10203 void recordVerificationError() { |
| 10204 _verificationErrors = AnalysisError.NO_ERRORS; |
| 10205 _verificationErrorsState = CacheState.ERROR; |
| 10206 recordHintError(); |
| 10207 } |
| 10208 |
| 10209 /** |
| 9900 * Write a textual representation of this state to the given builder. The resu
lt will only be | 10210 * Write a textual representation of this state to the given builder. The resu
lt will only be |
| 9901 * used for debugging purposes. | 10211 * used for debugging purposes. |
| 9902 * | 10212 * |
| 9903 * @param builder the builder to which the text should be written | 10213 * @param builder the builder to which the text should be written |
| 9904 */ | 10214 */ |
| 9905 void writeOn(JavaStringBuilder builder) { | 10215 void writeOn(JavaStringBuilder builder) { |
| 9906 if (_librarySource != null) { | 10216 if (_librarySource != null) { |
| 9907 builder.append("; builtUnit = "); | 10217 builder.append("; builtUnit = "); |
| 9908 builder.append(_builtUnitState); | 10218 builder.append(_builtUnitState); |
| 9909 builder.append("; buildElementErrors = "); | 10219 builder.append("; buildElementErrors = "); |
| (...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10716 _polymerResolutionErrorsState = CacheState.INVALID; | 11026 _polymerResolutionErrorsState = CacheState.INVALID; |
| 10717 _element = null; | 11027 _element = null; |
| 10718 _elementState = CacheState.INVALID; | 11028 _elementState = CacheState.INVALID; |
| 10719 _resolutionErrors = AnalysisError.NO_ERRORS; | 11029 _resolutionErrors = AnalysisError.NO_ERRORS; |
| 10720 _resolutionErrorsState = CacheState.INVALID; | 11030 _resolutionErrorsState = CacheState.INVALID; |
| 10721 _hints = AnalysisError.NO_ERRORS; | 11031 _hints = AnalysisError.NO_ERRORS; |
| 10722 _hintsState = CacheState.INVALID; | 11032 _hintsState = CacheState.INVALID; |
| 10723 } | 11033 } |
| 10724 | 11034 |
| 10725 @override | 11035 @override |
| 10726 void recordContentError() { | 11036 void recordContentError(AnalysisException exception) { |
| 10727 super.recordContentError(); | 11037 super.recordContentError(exception); |
| 10728 recordParseError(); | 11038 recordParseError(exception); |
| 10729 } | 11039 } |
| 10730 | 11040 |
| 10731 /** | 11041 /** |
| 10732 * Record that an error was encountered while attempting to parse the source a
ssociated with this | 11042 * Record that an error was encountered while attempting to parse the source a
ssociated with this |
| 10733 * entry. | 11043 * entry. |
| 11044 * |
| 11045 * @param exception the exception that shows where the error occurred |
| 10734 */ | 11046 */ |
| 10735 void recordParseError() { | 11047 void recordParseError(AnalysisException exception) { |
| 10736 setState(SourceEntry.LINE_INFO, CacheState.ERROR); | 11048 // If the scanning and parsing of HTML are separated, the following line can
be removed. |
| 10737 setState(HtmlEntry.PARSE_ERRORS, CacheState.ERROR); | 11049 recordScanError(exception); |
| 10738 setState(HtmlEntry.PARSED_UNIT, CacheState.ERROR); | 11050 _parseErrors = AnalysisError.NO_ERRORS; |
| 10739 setState(HtmlEntry.REFERENCED_LIBRARIES, CacheState.ERROR); | 11051 _parseErrorsState = CacheState.ERROR; |
| 10740 recordResolutionError(); | 11052 _parsedUnit = null; |
| 11053 _parsedUnitState = CacheState.ERROR; |
| 11054 _referencedLibraries = Source.EMPTY_ARRAY; |
| 11055 _referencedLibrariesState = CacheState.ERROR; |
| 11056 recordResolutionError(exception); |
| 10741 } | 11057 } |
| 10742 | 11058 |
| 10743 /** | 11059 /** |
| 10744 * Record that an error was encountered while attempting to resolve the source
associated with | 11060 * Record that an error was encountered while attempting to resolve the source
associated with |
| 10745 * this entry. | 11061 * this entry. |
| 11062 * |
| 11063 * @param exception the exception that shows where the error occurred |
| 10746 */ | 11064 */ |
| 10747 void recordResolutionError() { | 11065 void recordResolutionError(AnalysisException exception) { |
| 10748 setState(HtmlEntry.ANGULAR_ERRORS, CacheState.ERROR); | 11066 this.exception = exception; |
| 10749 setState(HtmlEntry.RESOLVED_UNIT, CacheState.ERROR); | 11067 _angularErrors = AnalysisError.NO_ERRORS; |
| 10750 setState(HtmlEntry.ELEMENT, CacheState.ERROR); | 11068 _angularErrorsState = CacheState.ERROR; |
| 10751 setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.ERROR); | 11069 _resolvedUnit = null; |
| 10752 setState(HtmlEntry.HINTS, CacheState.ERROR); | 11070 _resolvedUnitState = CacheState.ERROR; |
| 10753 setState(HtmlEntry.POLYMER_BUILD_ERRORS, CacheState.ERROR); | 11071 _element = null; |
| 10754 setState(HtmlEntry.POLYMER_RESOLUTION_ERRORS, CacheState.ERROR); | 11072 _elementState = CacheState.ERROR; |
| 11073 _resolutionErrors = AnalysisError.NO_ERRORS; |
| 11074 _resolutionErrorsState = CacheState.ERROR; |
| 11075 _hints = AnalysisError.NO_ERRORS; |
| 11076 _hintsState = CacheState.ERROR; |
| 11077 _polymerBuildErrors = AnalysisError.NO_ERRORS; |
| 11078 _polymerBuildErrorsState = CacheState.ERROR; |
| 11079 _polymerResolutionErrors = AnalysisError.NO_ERRORS; |
| 11080 _polymerResolutionErrorsState = CacheState.ERROR; |
| 10755 } | 11081 } |
| 10756 | 11082 |
| 10757 @override | 11083 @override |
| 10758 void setState(DataDescriptor descriptor, CacheState state) { | 11084 void setState(DataDescriptor descriptor, CacheState state) { |
| 10759 if (identical(descriptor, HtmlEntry.ANGULAR_APPLICATION)) { | 11085 if (identical(descriptor, HtmlEntry.ANGULAR_APPLICATION)) { |
| 10760 _angularApplication = updatedValue(state, _angularApplication, null); | 11086 _angularApplication = updatedValue(state, _angularApplication, null); |
| 10761 _angularApplicationState = state; | 11087 _angularApplicationState = state; |
| 10762 } else if (identical(descriptor, HtmlEntry.ANGULAR_COMPONENT)) { | 11088 } else if (identical(descriptor, HtmlEntry.ANGULAR_COMPONENT)) { |
| 10763 _angularComponent = updatedValue(state, _angularComponent, null); | 11089 _angularComponent = updatedValue(state, _angularComponent, null); |
| 10764 _angularComponentState = state; | 11090 _angularComponentState = state; |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11226 InstrumentedAnalysisContextImpl.con1(InternalAnalysisContext context) { | 11552 InstrumentedAnalysisContextImpl.con1(InternalAnalysisContext context) { |
| 11227 _basis = context; | 11553 _basis = context; |
| 11228 } | 11554 } |
| 11229 | 11555 |
| 11230 @override | 11556 @override |
| 11231 void addSourceInfo(Source source, SourceEntry info) { | 11557 void addSourceInfo(Source source, SourceEntry info) { |
| 11232 _basis.addSourceInfo(source, info); | 11558 _basis.addSourceInfo(source, info); |
| 11233 } | 11559 } |
| 11234 | 11560 |
| 11235 @override | 11561 @override |
| 11562 void applyAnalysisDelta(AnalysisDelta delta) { |
| 11563 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
updateAnalysis"); |
| 11564 _checkThread(instrumentation); |
| 11565 try { |
| 11566 instrumentation.metric3("contextId", _contextId); |
| 11567 _basis.applyAnalysisDelta(delta); |
| 11568 } finally { |
| 11569 instrumentation.log(); |
| 11570 } |
| 11571 } |
| 11572 |
| 11573 @override |
| 11236 void applyChanges(ChangeSet changeSet) { | 11574 void applyChanges(ChangeSet changeSet) { |
| 11237 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
applyChanges"); | 11575 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
applyChanges"); |
| 11238 _checkThread(instrumentation); | 11576 _checkThread(instrumentation); |
| 11239 try { | 11577 try { |
| 11240 instrumentation.metric3("contextId", _contextId); | 11578 instrumentation.metric3("contextId", _contextId); |
| 11241 _basis.applyChanges(changeSet); | 11579 _basis.applyChanges(changeSet); |
| 11242 } finally { | 11580 } finally { |
| 11243 instrumentation.log(); | 11581 instrumentation.log(); |
| 11244 } | 11582 } |
| 11245 } | 11583 } |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11689 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getSourceFactory"); | 12027 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getSourceFactory"); |
| 11690 try { | 12028 try { |
| 11691 instrumentation.metric3("contextId", _contextId); | 12029 instrumentation.metric3("contextId", _contextId); |
| 11692 return _basis.sourceFactory; | 12030 return _basis.sourceFactory; |
| 11693 } finally { | 12031 } finally { |
| 11694 instrumentation.log2(2); | 12032 instrumentation.log2(2); |
| 11695 } | 12033 } |
| 11696 } | 12034 } |
| 11697 | 12035 |
| 11698 @override | 12036 @override |
| 11699 AnalysisContentStatistics get statistics => _basis.statistics; | 12037 AnalysisContextStatistics get statistics => _basis.statistics; |
| 11700 | 12038 |
| 11701 @override | 12039 @override |
| 11702 TypeProvider get typeProvider => _basis.typeProvider; | 12040 TypeProvider get typeProvider => _basis.typeProvider; |
| 11703 | 12041 |
| 11704 @override | 12042 @override |
| 11705 bool isClientLibrary(Source librarySource) { | 12043 bool isClientLibrary(Source librarySource) { |
| 11706 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
isClientLibrary"); | 12044 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
isClientLibrary"); |
| 11707 _checkThread(instrumentation); | 12045 _checkThread(instrumentation); |
| 11708 try { | 12046 try { |
| 11709 instrumentation.metric3("contextId", _contextId); | 12047 instrumentation.metric3("contextId", _contextId); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11973 * library. | 12311 * library. |
| 11974 * | 12312 * |
| 11975 * @param library the library whose public namespace is to be returned | 12313 * @param library the library whose public namespace is to be returned |
| 11976 * @return the public namespace of the given library | 12314 * @return the public namespace of the given library |
| 11977 */ | 12315 */ |
| 11978 Namespace getPublicNamespace(LibraryElement library); | 12316 Namespace getPublicNamespace(LibraryElement library); |
| 11979 | 12317 |
| 11980 /** | 12318 /** |
| 11981 * Returns a statistics about this context. | 12319 * Returns a statistics about this context. |
| 11982 */ | 12320 */ |
| 11983 AnalysisContentStatistics get statistics; | 12321 AnalysisContextStatistics get statistics; |
| 11984 | 12322 |
| 11985 /** | 12323 /** |
| 11986 * Returns a type provider for this context or throws an exception if dart:cor
e cannot be | 12324 * Returns a type provider for this context or throws an exception if dart:cor
e cannot be |
| 11987 * resolved. | 12325 * resolved. |
| 11988 * | 12326 * |
| 11989 * @return the type provider (not `null`) | 12327 * @return the type provider (not `null`) |
| 11990 * @throws AnalysisException if dart:core cannot be resolved | 12328 * @throws AnalysisException if dart:core cannot be resolved |
| 11991 */ | 12329 */ |
| 11992 TypeProvider get typeProvider; | 12330 TypeProvider get typeProvider; |
| 11993 | 12331 |
| (...skipping 2295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14289 _errors = errorListener.getErrorsForSource(source); | 14627 _errors = errorListener.getErrorsForSource(source); |
| 14290 } on JavaException catch (exception) { | 14628 } on JavaException catch (exception) { |
| 14291 throw new AnalysisException.con3(exception); | 14629 throw new AnalysisException.con3(exception); |
| 14292 } finally { | 14630 } finally { |
| 14293 timeCounterScan.stop(); | 14631 timeCounterScan.stop(); |
| 14294 } | 14632 } |
| 14295 } | 14633 } |
| 14296 } | 14634 } |
| 14297 | 14635 |
| 14298 /** | 14636 /** |
| 14637 * Instances of the class `SdkAnalysisContext` implement an [AnalysisContext] th
at only |
| 14638 * contains sources for a Dart SDK. |
| 14639 */ |
| 14640 class SdkAnalysisContext extends AnalysisContextImpl { |
| 14641 @override |
| 14642 AnalysisCache createCacheFromSourceFactory(SourceFactory factory) { |
| 14643 if (factory == null) { |
| 14644 return super.createCacheFromSourceFactory(factory); |
| 14645 } |
| 14646 DartSdk sdk = factory.dartSdk; |
| 14647 if (sdk == null) { |
| 14648 throw new IllegalArgumentException("The source factory for an SDK analysis
context must have a DartUriResolver"); |
| 14649 } |
| 14650 return new AnalysisCache(<CachePartition> [AnalysisEngine.instance.partition
Manager.forSdk(sdk)]); |
| 14651 } |
| 14652 } |
| 14653 |
| 14654 /** |
| 14299 * Instances of the class `SdkCachePartition` implement a cache partition that c
ontains all of | 14655 * Instances of the class `SdkCachePartition` implement a cache partition that c
ontains all of |
| 14300 * the sources in the SDK. | 14656 * the sources in the SDK. |
| 14301 */ | 14657 */ |
| 14302 class SdkCachePartition extends CachePartition { | 14658 class SdkCachePartition extends CachePartition { |
| 14303 /** | 14659 /** |
| 14304 * Initialize a newly created partition. | 14660 * Initialize a newly created partition. |
| 14305 * | 14661 * |
| 14306 * @param maxCacheSize the maximum number of sources for which AST structures
should be kept in | 14662 * @param maxCacheSize the maximum number of sources for which AST structures
should be kept in |
| 14307 * the cache | 14663 * the cache |
| 14308 */ | 14664 */ |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14399 int _modificationTime = 0; | 14755 int _modificationTime = 0; |
| 14400 | 14756 |
| 14401 /** | 14757 /** |
| 14402 * A bit-encoding of boolean flags associated with this element. | 14758 * A bit-encoding of boolean flags associated with this element. |
| 14403 */ | 14759 */ |
| 14404 int _flags = 0; | 14760 int _flags = 0; |
| 14405 | 14761 |
| 14406 /** | 14762 /** |
| 14407 * The exception that caused one or more values to have a state of [CacheState
#ERROR]. | 14763 * The exception that caused one or more values to have a state of [CacheState
#ERROR]. |
| 14408 */ | 14764 */ |
| 14409 AnalysisException exception; | 14765 AnalysisException _exception; |
| 14410 | 14766 |
| 14411 /** | 14767 /** |
| 14412 * The state of the cached content. | 14768 * The state of the cached content. |
| 14413 */ | 14769 */ |
| 14414 CacheState _contentState = CacheState.INVALID; | 14770 CacheState _contentState = CacheState.INVALID; |
| 14415 | 14771 |
| 14416 /** | 14772 /** |
| 14417 * The content of the source, or `null` if the content is not currently cached
. | 14773 * The content of the source, or `null` if the content is not currently cached
. |
| 14418 */ | 14774 */ |
| 14419 String _content; | 14775 String _content; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 14433 * The index of the flag indicating whether the source was explicitly added to
the context or | 14789 * The index of the flag indicating whether the source was explicitly added to
the context or |
| 14434 * whether the source was implicitly added because it was referenced by anothe
r source. | 14790 * whether the source was implicitly added because it was referenced by anothe
r source. |
| 14435 */ | 14791 */ |
| 14436 static int _EXPLICITLY_ADDED_FLAG = 0; | 14792 static int _EXPLICITLY_ADDED_FLAG = 0; |
| 14437 | 14793 |
| 14438 /** | 14794 /** |
| 14439 * Fix the state of the [exception] to match the current state of the entry. | 14795 * Fix the state of the [exception] to match the current state of the entry. |
| 14440 */ | 14796 */ |
| 14441 void fixExceptionState() { | 14797 void fixExceptionState() { |
| 14442 if (hasErrorState) { | 14798 if (hasErrorState) { |
| 14443 if (exception == null) { | 14799 if (_exception == null) { |
| 14444 // | 14800 // |
| 14445 // This code should never be reached, but is a fail-safe in case an exce
ption is not | 14801 // This code should never be reached, but is a fail-safe in case an exce
ption is not |
| 14446 // recorded when it should be. | 14802 // recorded when it should be. |
| 14447 // | 14803 // |
| 14448 exception = new AnalysisException.con1("State set to ERROR without setti
ng an exception"); | 14804 _exception = new AnalysisException.con1("State set to ERROR without sett
ing an exception"); |
| 14449 } | 14805 } |
| 14450 } else { | 14806 } else { |
| 14451 exception = null; | 14807 _exception = null; |
| 14452 } | 14808 } |
| 14453 } | 14809 } |
| 14454 | 14810 |
| 14455 /** | 14811 /** |
| 14812 * Return the exception that caused one or more values to have a state of [Cac
heState#ERROR] |
| 14813 * . |
| 14814 * |
| 14815 * @return the exception that caused one or more values to be uncomputable |
| 14816 */ |
| 14817 @override |
| 14818 AnalysisException get exception => _exception; |
| 14819 |
| 14820 /** |
| 14456 * Return `true` if the source was explicitly added to the context or `false`
if the | 14821 * Return `true` if the source was explicitly added to the context or `false`
if the |
| 14457 * source was implicitly added because it was referenced by another source. | 14822 * source was implicitly added because it was referenced by another source. |
| 14458 * | 14823 * |
| 14459 * @return `true` if the source was explicitly added to the context | 14824 * @return `true` if the source was explicitly added to the context |
| 14460 */ | 14825 */ |
| 14461 @override | 14826 @override |
| 14462 bool get explicitlyAdded => getFlag(_EXPLICITLY_ADDED_FLAG); | 14827 bool get explicitlyAdded => getFlag(_EXPLICITLY_ADDED_FLAG); |
| 14463 | 14828 |
| 14464 @override | 14829 @override |
| 14465 int get modificationTime => _modificationTime; | 14830 int get modificationTime => _modificationTime; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 14493 _content = null; | 14858 _content = null; |
| 14494 _contentState = _checkContentState(CacheState.INVALID); | 14859 _contentState = _checkContentState(CacheState.INVALID); |
| 14495 _lineInfo = null; | 14860 _lineInfo = null; |
| 14496 _lineInfoState = CacheState.INVALID; | 14861 _lineInfoState = CacheState.INVALID; |
| 14497 } | 14862 } |
| 14498 | 14863 |
| 14499 /** | 14864 /** |
| 14500 * Record that an error occurred while attempting to get the contents of the s
ource represented by | 14865 * Record that an error occurred while attempting to get the contents of the s
ource represented by |
| 14501 * this entry. This will set the state of all information, including any resol
ution-based | 14866 * this entry. This will set the state of all information, including any resol
ution-based |
| 14502 * information, as being in error. | 14867 * information, as being in error. |
| 14868 * |
| 14869 * @param exception the exception that shows where the error occurred |
| 14503 */ | 14870 */ |
| 14504 void recordContentError() { | 14871 void recordContentError(AnalysisException exception) { |
| 14505 _content = null; | 14872 _content = null; |
| 14506 _contentState = CacheState.ERROR; | 14873 _contentState = CacheState.ERROR; |
| 14874 recordScanError(exception); |
| 14507 } | 14875 } |
| 14508 | 14876 |
| 14509 /** | 14877 /** |
| 14878 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
| 14879 * entry. This will set the state of all information, including any resolution
-based information, |
| 14880 * as being in error. |
| 14881 * |
| 14882 * @param exception the exception that shows where the error occurred |
| 14883 */ |
| 14884 void recordScanError(AnalysisException exception) { |
| 14885 this.exception = exception; |
| 14886 _lineInfo = null; |
| 14887 _lineInfoState = CacheState.ERROR; |
| 14888 } |
| 14889 |
| 14890 /** |
| 14510 * Set whether the source was explicitly added to the context to match the giv
en value. | 14891 * Set whether the source was explicitly added to the context to match the giv
en value. |
| 14511 * | 14892 * |
| 14512 * @param explicitlyAdded `true` if the source was explicitly added to the con
text | 14893 * @param explicitlyAdded `true` if the source was explicitly added to the con
text |
| 14513 */ | 14894 */ |
| 14514 void set explicitlyAdded(bool explicitlyAdded) { | 14895 void set explicitlyAdded(bool explicitlyAdded) { |
| 14515 setFlag(_EXPLICITLY_ADDED_FLAG, explicitlyAdded); | 14896 setFlag(_EXPLICITLY_ADDED_FLAG, explicitlyAdded); |
| 14516 } | 14897 } |
| 14517 | 14898 |
| 14518 /** | 14899 /** |
| 14519 * Set the most recent time at which the state of the source matched the state
represented by this | 14900 * Set the most recent time at which the state of the source matched the state
represented by this |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14580 } | 14961 } |
| 14581 | 14962 |
| 14582 /** | 14963 /** |
| 14583 * Copy the information from the given cache entry. | 14964 * Copy the information from the given cache entry. |
| 14584 * | 14965 * |
| 14585 * @param entry the cache entry from which information will be copied | 14966 * @param entry the cache entry from which information will be copied |
| 14586 */ | 14967 */ |
| 14587 void copyFrom(SourceEntryImpl entry) { | 14968 void copyFrom(SourceEntryImpl entry) { |
| 14588 _modificationTime = entry._modificationTime; | 14969 _modificationTime = entry._modificationTime; |
| 14589 _flags = entry._flags; | 14970 _flags = entry._flags; |
| 14590 exception = entry.exception; | 14971 _exception = entry._exception; |
| 14591 _contentState = entry._contentState; | 14972 _contentState = entry._contentState; |
| 14592 _content = entry._content; | 14973 _content = entry._content; |
| 14593 _lineInfoState = entry._lineInfoState; | 14974 _lineInfoState = entry._lineInfoState; |
| 14594 _lineInfo = entry._lineInfo; | 14975 _lineInfo = entry._lineInfo; |
| 14595 } | 14976 } |
| 14596 | 14977 |
| 14597 /** | 14978 /** |
| 14598 * Return the value of the flag with the given index. | 14979 * Return the value of the flag with the given index. |
| 14599 * | 14980 * |
| 14600 * @param index the index of the flag whose value is to be returned | 14981 * @param index the index of the flag whose value is to be returned |
| 14601 * @return the value of the flag with the given index | 14982 * @return the value of the flag with the given index |
| 14602 */ | 14983 */ |
| 14603 bool getFlag(int index) => BooleanArray.get(_flags, index); | 14984 bool getFlag(int index) => BooleanArray.get(_flags, index); |
| 14604 | 14985 |
| 14605 /** | 14986 /** |
| 14606 * Return `true` if the state of any data value is [CacheState#ERROR]. | 14987 * Return `true` if the state of any data value is [CacheState#ERROR]. |
| 14607 * | 14988 * |
| 14608 * @return `true` if the state of any data value is [CacheState#ERROR] | 14989 * @return `true` if the state of any data value is [CacheState#ERROR] |
| 14609 */ | 14990 */ |
| 14610 bool get hasErrorState => _contentState == CacheState.ERROR || _lineInfoState
== CacheState.ERROR; | 14991 bool get hasErrorState => _contentState == CacheState.ERROR || _lineInfoState
== CacheState.ERROR; |
| 14611 | 14992 |
| 14612 /** | 14993 /** |
| 14994 * Set the exception that caused one or more values to have a state of [CacheS
tate#ERROR] to |
| 14995 * the given exception. |
| 14996 * |
| 14997 * @param exception the exception that caused one or more values to be uncompu
table |
| 14998 */ |
| 14999 void set exception(AnalysisException exception) { |
| 15000 if (exception == null) { |
| 15001 throw new IllegalArgumentException("exception cannot be null"); |
| 15002 } |
| 15003 this._exception = exception; |
| 15004 } |
| 15005 |
| 15006 /** |
| 14613 * Set the value of the flag with the given index to the given value. | 15007 * Set the value of the flag with the given index to the given value. |
| 14614 * | 15008 * |
| 14615 * @param index the index of the flag whose value is to be returned | 15009 * @param index the index of the flag whose value is to be returned |
| 14616 * @param value the value of the flag with the given index | 15010 * @param value the value of the flag with the given index |
| 14617 */ | 15011 */ |
| 14618 void setFlag(int index, bool value) { | 15012 void setFlag(int index, bool value) { |
| 14619 _flags = BooleanArray.set(_flags, index, value); | 15013 _flags = BooleanArray.set(_flags, index, value); |
| 14620 } | 15014 } |
| 14621 | 15015 |
| 14622 /** | 15016 /** |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14963 _index++; | 15357 _index++; |
| 14964 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { | 15358 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { |
| 14965 _index = 0; | 15359 _index = 0; |
| 14966 _queueIndex++; | 15360 _queueIndex++; |
| 14967 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { | 15361 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { |
| 14968 _queueIndex++; | 15362 _queueIndex++; |
| 14969 } | 15363 } |
| 14970 } | 15364 } |
| 14971 } | 15365 } |
| 14972 } | 15366 } |
| OLD | NEW |