| 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 'dart:collection'; | 10 import 'dart:collection'; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 * Instances of the class `AnalysisCache` implement an LRU cache of information
related to | 28 * Instances of the class `AnalysisCache` implement an LRU cache of information
related to |
| 29 * analysis. | 29 * analysis. |
| 30 */ | 30 */ |
| 31 class AnalysisCache { | 31 class AnalysisCache { |
| 32 /** | 32 /** |
| 33 * An array containing the partitions of which this cache is comprised. | 33 * An array containing the partitions of which this cache is comprised. |
| 34 */ | 34 */ |
| 35 final List<CachePartition> _partitions; | 35 final List<CachePartition> _partitions; |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * A flag used to control whether trace information should be produced when th
e content of the |
| 39 * cache is modified. |
| 40 */ |
| 41 static bool _TRACE_CHANGES = false; |
| 42 |
| 43 /** |
| 38 * Initialize a newly created cache to have the given partitions. The partitio
ns will be searched | 44 * Initialize a newly created cache to have the given partitions. The partitio
ns will be searched |
| 39 * in the order in which they appear in the array, so the most specific partit
ion (usually an | 45 * in the order in which they appear in the array, so the most specific partit
ion (usually an |
| 40 * [SdkCachePartition]) should be first and the most general (usually a | 46 * [SdkCachePartition]) should be first and the most general (usually a |
| 41 * [UniversalCachePartition]) last. | 47 * [UniversalCachePartition]) last. |
| 42 * | 48 * |
| 43 * @param partitions the partitions for the newly created cache | 49 * @param partitions the partitions for the newly created cache |
| 44 */ | 50 */ |
| 45 AnalysisCache(this._partitions); | 51 AnalysisCache(this._partitions); |
| 46 | 52 |
| 47 /** | 53 /** |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 * Associate the given entry with the given source. | 121 * Associate the given entry with the given source. |
| 116 * | 122 * |
| 117 * @param source the source with which the entry is to be associated | 123 * @param source the source with which the entry is to be associated |
| 118 * @param entry the entry to be associated with the source | 124 * @param entry the entry to be associated with the source |
| 119 */ | 125 */ |
| 120 void put(Source source, SourceEntry entry) { | 126 void put(Source source, SourceEntry entry) { |
| 121 (entry as SourceEntryImpl).fixExceptionState(); | 127 (entry as SourceEntryImpl).fixExceptionState(); |
| 122 int count = _partitions.length; | 128 int count = _partitions.length; |
| 123 for (int i = 0; i < count; i++) { | 129 for (int i = 0; i < count; i++) { |
| 124 if (_partitions[i].contains(source)) { | 130 if (_partitions[i].contains(source)) { |
| 131 if (_TRACE_CHANGES) { |
| 132 try { |
| 133 SourceEntry oldEntry = _partitions[i].get(source); |
| 134 if (oldEntry == null) { |
| 135 AnalysisEngine.instance.logger.logInformation("Added a cache entry
for '${source.fullName}'."); |
| 136 } else { |
| 137 AnalysisEngine.instance.logger.logInformation("Modified the cache
entry for ${source.fullName}'. Diff = ${(entry as SourceEntryImpl).getDiff(oldEn
try)}"); |
| 138 } |
| 139 } catch (exception) { |
| 140 // Ignored |
| 141 JavaSystem.currentTimeMillis(); |
| 142 } |
| 143 } |
| 125 _partitions[i].put(source, entry); | 144 _partitions[i].put(source, entry); |
| 126 return; | 145 return; |
| 127 } | 146 } |
| 128 } | 147 } |
| 129 } | 148 } |
| 130 | 149 |
| 131 /** | 150 /** |
| 132 * Remove all information related to the given source from this cache. | 151 * Remove all information related to the given source from this cache. |
| 133 * | 152 * |
| 134 * @param source the source to be removed | 153 * @param source the source to be removed |
| 135 */ | 154 */ |
| 136 void remove(Source source) { | 155 void remove(Source source) { |
| 137 int count = _partitions.length; | 156 int count = _partitions.length; |
| 138 for (int i = 0; i < count; i++) { | 157 for (int i = 0; i < count; i++) { |
| 139 if (_partitions[i].contains(source)) { | 158 if (_partitions[i].contains(source)) { |
| 159 if (_TRACE_CHANGES) { |
| 160 try { |
| 161 AnalysisEngine.instance.logger.logInformation("Removed the cache ent
ry for ${source.fullName}'."); |
| 162 } catch (exception) { |
| 163 // Ignored |
| 164 JavaSystem.currentTimeMillis(); |
| 165 } |
| 166 } |
| 140 _partitions[i].remove(source); | 167 _partitions[i].remove(source); |
| 141 return; | 168 return; |
| 142 } | 169 } |
| 143 } | 170 } |
| 144 } | 171 } |
| 145 | 172 |
| 146 /** | 173 /** |
| 147 * Record that the AST associated with the given source was just removed from
the cache. | 174 * Record that the AST associated with the given source was just removed from
the cache. |
| 148 * | 175 * |
| 149 * @param source the source whose AST was removed | 176 * @param source the source whose AST was removed |
| (...skipping 9750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9900 _publicNamespace = other._publicNamespace; | 9927 _publicNamespace = other._publicNamespace; |
| 9901 _clientServerState = other._clientServerState; | 9928 _clientServerState = other._clientServerState; |
| 9902 _launchableState = other._launchableState; | 9929 _launchableState = other._launchableState; |
| 9903 _angularErrors = other._angularErrors; | 9930 _angularErrors = other._angularErrors; |
| 9904 } | 9931 } |
| 9905 | 9932 |
| 9906 @override | 9933 @override |
| 9907 bool get hasErrorState => super.hasErrorState || _scanErrorsState == CacheStat
e.ERROR || _tokenStreamState == CacheState.ERROR || _sourceKindState == CacheSta
te.ERROR || _parsedUnitState == CacheState.ERROR || _parseErrorsState == CacheSt
ate.ERROR || _importedLibrariesState == CacheState.ERROR || _exportedLibrariesSt
ate == CacheState.ERROR || _includedPartsState == CacheState.ERROR || _elementSt
ate == CacheState.ERROR || _publicNamespaceState == CacheState.ERROR || _clientS
erverState == CacheState.ERROR || _launchableState == CacheState.ERROR || _resol
utionState.hasErrorState; | 9934 bool get hasErrorState => super.hasErrorState || _scanErrorsState == CacheStat
e.ERROR || _tokenStreamState == CacheState.ERROR || _sourceKindState == CacheSta
te.ERROR || _parsedUnitState == CacheState.ERROR || _parseErrorsState == CacheSt
ate.ERROR || _importedLibrariesState == CacheState.ERROR || _exportedLibrariesSt
ate == CacheState.ERROR || _includedPartsState == CacheState.ERROR || _elementSt
ate == CacheState.ERROR || _publicNamespaceState == CacheState.ERROR || _clientS
erverState == CacheState.ERROR || _launchableState == CacheState.ERROR || _resol
utionState.hasErrorState; |
| 9908 | 9935 |
| 9909 @override | 9936 @override |
| 9937 bool writeDiffOn(JavaStringBuilder builder, SourceEntry oldEntry) { |
| 9938 bool needsSeparator = super.writeDiffOn(builder, oldEntry); |
| 9939 if (oldEntry is! DartEntryImpl) { |
| 9940 if (needsSeparator) { |
| 9941 builder.append("; "); |
| 9942 } |
| 9943 builder.append("entry type changed; was ${oldEntry.runtimeType.toString()}
"); |
| 9944 return true; |
| 9945 } |
| 9946 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.TOKEN_STREAM, "tokenStream"); |
| 9947 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.SCAN_ERRORS, "scanErrors"); |
| 9948 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.SOURCE_KIND, "sourceKind"); |
| 9949 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.PARSED_UNIT, "parsedUnit"); |
| 9950 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.PARSE_ERRORS, "parseErrors"); |
| 9951 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.IMPORTED_LIBRARIES, "importedLibraries"); |
| 9952 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.EXPORTED_LIBRARIES, "exportedLibraries"); |
| 9953 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.INCLUDED_PARTS, "includedParts"); |
| 9954 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.ELEMENT, "element"); |
| 9955 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.PUBLIC_NAMESPACE, "publicNamespace"); |
| 9956 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.IS_CLIENT, "clientServer"); |
| 9957 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.IS_LAUNCHABLE, "launchable"); |
| 9958 // TODO(brianwilkerson) Add better support for containingLibraries. It would
be nice to be able |
| 9959 // to report on size-preserving changes. |
| 9960 int oldLibraryCount = (oldEntry as DartEntryImpl)._containingLibraries.lengt
h; |
| 9961 int libraryCount = _containingLibraries.length; |
| 9962 if (oldLibraryCount != libraryCount) { |
| 9963 if (needsSeparator) { |
| 9964 builder.append("; "); |
| 9965 } |
| 9966 builder.append("containingLibraryCount = "); |
| 9967 builder.append(oldLibraryCount); |
| 9968 builder.append(" -> "); |
| 9969 builder.append(libraryCount); |
| 9970 needsSeparator = true; |
| 9971 } |
| 9972 // |
| 9973 // Report change to the per-library state. |
| 9974 // |
| 9975 HashMap<Source, DartEntryImpl_ResolutionState> oldStateMap = new HashMap<Sou
rce, DartEntryImpl_ResolutionState>(); |
| 9976 DartEntryImpl_ResolutionState state = (oldEntry as DartEntryImpl)._resolutio
nState; |
| 9977 while (state != null) { |
| 9978 Source librarySource = state._librarySource; |
| 9979 if (librarySource != null) { |
| 9980 oldStateMap[librarySource] = state; |
| 9981 } |
| 9982 state = state._nextState; |
| 9983 } |
| 9984 state = _resolutionState; |
| 9985 while (state != null) { |
| 9986 Source librarySource = state._librarySource; |
| 9987 if (librarySource != null) { |
| 9988 DartEntryImpl_ResolutionState oldState = oldStateMap.remove(librarySourc
e); |
| 9989 if (oldState == null) { |
| 9990 if (needsSeparator) { |
| 9991 builder.append("; "); |
| 9992 } |
| 9993 builder.append("added resolution for "); |
| 9994 builder.append(librarySource.fullName); |
| 9995 needsSeparator = true; |
| 9996 } else { |
| 9997 needsSeparator = oldState.writeDiffOn(builder, needsSeparator, oldEntr
y as DartEntry); |
| 9998 } |
| 9999 } |
| 10000 state = state._nextState; |
| 10001 } |
| 10002 for (Source librarySource in oldStateMap.keys.toSet()) { |
| 10003 if (needsSeparator) { |
| 10004 builder.append("; "); |
| 10005 } |
| 10006 builder.append("removed resolution for "); |
| 10007 builder.append(librarySource.fullName); |
| 10008 needsSeparator = true; |
| 10009 } |
| 10010 return needsSeparator; |
| 10011 } |
| 10012 |
| 10013 @override |
| 9910 void writeOn(JavaStringBuilder builder) { | 10014 void writeOn(JavaStringBuilder builder) { |
| 9911 builder.append("Dart: "); | 10015 builder.append("Dart: "); |
| 9912 super.writeOn(builder); | 10016 super.writeOn(builder); |
| 9913 builder.append("; tokenStream = "); | 10017 builder.append("; tokenStream = "); |
| 9914 builder.append(_tokenStreamState); | 10018 builder.append(_tokenStreamState); |
| 9915 builder.append("; scanErrors = "); | 10019 builder.append("; scanErrors = "); |
| 9916 builder.append(_scanErrorsState); | 10020 builder.append(_scanErrorsState); |
| 9917 builder.append("; sourceKind = "); | 10021 builder.append("; sourceKind = "); |
| 9918 builder.append(_sourceKindState); | 10022 builder.append(_sourceKindState); |
| 9919 builder.append("; parsedUnit = "); | 10023 builder.append("; parsedUnit = "); |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10237 * represented by this entry. This will set the state of all verification info
rmation as being | 10341 * represented by this entry. This will set the state of all verification info
rmation as being |
| 10238 * in error. | 10342 * in error. |
| 10239 */ | 10343 */ |
| 10240 void recordVerificationError() { | 10344 void recordVerificationError() { |
| 10241 _verificationErrors = AnalysisError.NO_ERRORS; | 10345 _verificationErrors = AnalysisError.NO_ERRORS; |
| 10242 _verificationErrorsState = CacheState.ERROR; | 10346 _verificationErrorsState = CacheState.ERROR; |
| 10243 recordHintError(); | 10347 recordHintError(); |
| 10244 } | 10348 } |
| 10245 | 10349 |
| 10246 /** | 10350 /** |
| 10351 * Write a textual representation of the difference between the old entry and
this entry to the |
| 10352 * given string builder. |
| 10353 * |
| 10354 * @param builder the string builder to which the difference is to be written |
| 10355 * @param oldEntry the entry that was replaced by this entry |
| 10356 * @return `true` if some difference was written |
| 10357 */ |
| 10358 bool writeDiffOn(JavaStringBuilder builder, bool needsSeparator, DartEntry old
Entry) { |
| 10359 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.BUILT_UNIT, _builtUnitState, "builtUnit"); |
| 10360 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.BUILD_ELEMENT_ERRORS, _buildElementErrorsState, "buildElementErrors"); |
| 10361 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.RESOLVED_UNIT, _resolvedUnitState, "resolvedUnit"); |
| 10362 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.RESOLUTION_ERRORS, _resolutionErrorsState, "resolutionErrors"); |
| 10363 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.VERIFICATION_ERRORS, _verificationErrorsState, "verificationErrors"); |
| 10364 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, DartEnt
ry.HINTS, _hintsState, "hints"); |
| 10365 return needsSeparator; |
| 10366 } |
| 10367 |
| 10368 /** |
| 10247 * Write a textual representation of this state to the given builder. The resu
lt will only be | 10369 * Write a textual representation of this state to the given builder. The resu
lt will only be |
| 10248 * used for debugging purposes. | 10370 * used for debugging purposes. |
| 10249 * | 10371 * |
| 10250 * @param builder the builder to which the text should be written | 10372 * @param builder the builder to which the text should be written |
| 10251 */ | 10373 */ |
| 10252 void writeOn(JavaStringBuilder builder) { | 10374 void writeOn(JavaStringBuilder builder) { |
| 10253 if (_librarySource != null) { | 10375 if (_librarySource != null) { |
| 10254 builder.append("; builtUnit = "); | 10376 builder.append("; builtUnit = "); |
| 10255 builder.append(_builtUnitState); | 10377 builder.append(_builtUnitState); |
| 10256 builder.append("; buildElementErrors = "); | 10378 builder.append("; buildElementErrors = "); |
| 10257 builder.append(_buildElementErrorsState); | 10379 builder.append(_buildElementErrorsState); |
| 10258 builder.append("; resolvedUnit = "); | 10380 builder.append("; resolvedUnit = "); |
| 10259 builder.append(_resolvedUnitState); | 10381 builder.append(_resolvedUnitState); |
| 10260 builder.append("; resolutionErrors = "); | 10382 builder.append("; resolutionErrors = "); |
| 10261 builder.append(_resolutionErrorsState); | 10383 builder.append(_resolutionErrorsState); |
| 10262 builder.append("; verificationErrors = "); | 10384 builder.append("; verificationErrors = "); |
| 10263 builder.append(_verificationErrorsState); | 10385 builder.append(_verificationErrorsState); |
| 10264 builder.append("; hints = "); | 10386 builder.append("; hints = "); |
| 10265 builder.append(_hintsState); | 10387 builder.append(_hintsState); |
| 10266 if (_nextState != null) { | 10388 if (_nextState != null) { |
| 10267 _nextState.writeOn(builder); | 10389 _nextState.writeOn(builder); |
| 10268 } | 10390 } |
| 10269 } | 10391 } |
| 10270 } | 10392 } |
| 10393 |
| 10394 /** |
| 10395 * Write a textual representation of the difference between the state of the s
pecified data |
| 10396 * between the old entry and this entry to the given string builder. |
| 10397 * |
| 10398 * @param builder the string builder to which the difference is to be written |
| 10399 * @param needsSeparator `true` if any data that is written |
| 10400 * @param oldEntry the entry that was replaced by this entry |
| 10401 * @param descriptor the descriptor defining the data whose state is being com
pared |
| 10402 * @param label the label used to describe the state |
| 10403 * @return `true` if some difference was written |
| 10404 */ |
| 10405 bool writeStateDiffOn(JavaStringBuilder builder, bool needsSeparator, SourceEn
try oldEntry, DataDescriptor descriptor, CacheState newState, String label) { |
| 10406 CacheState oldState = (oldEntry as DartEntryImpl).getStateInLibrary(descript
or, _librarySource); |
| 10407 if (oldState != newState) { |
| 10408 if (needsSeparator) { |
| 10409 builder.append("; "); |
| 10410 } |
| 10411 builder.append(label); |
| 10412 builder.append(" = "); |
| 10413 builder.append(oldState); |
| 10414 builder.append(" -> "); |
| 10415 builder.append(newState); |
| 10416 return true; |
| 10417 } |
| 10418 return needsSeparator; |
| 10419 } |
| 10271 } | 10420 } |
| 10272 | 10421 |
| 10273 /** | 10422 /** |
| 10274 * Instances of the class `DataDescriptor` are immutable constants representing
data that can | 10423 * Instances of the class `DataDescriptor` are immutable constants representing
data that can |
| 10275 * be stored in the cache. | 10424 * be stored in the cache. |
| 10276 */ | 10425 */ |
| 10277 class DataDescriptor<E> { | 10426 class DataDescriptor<E> { |
| 10278 /** | 10427 /** |
| 10279 * The name of the descriptor, used for debugging purposes. | 10428 * The name of the descriptor, used for debugging purposes. |
| 10280 */ | 10429 */ |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10643 @override | 10792 @override |
| 10644 String get taskDescription => "get contents of ${source.fullName}"; | 10793 String get taskDescription => "get contents of ${source.fullName}"; |
| 10645 | 10794 |
| 10646 @override | 10795 @override |
| 10647 void internalPerform() { | 10796 void internalPerform() { |
| 10648 _complete = true; | 10797 _complete = true; |
| 10649 try { | 10798 try { |
| 10650 TimestampedData<String> data = context.getContents(source); | 10799 TimestampedData<String> data = context.getContents(source); |
| 10651 _content = data.data; | 10800 _content = data.data; |
| 10652 _modificationTime = data.modificationTime; | 10801 _modificationTime = data.modificationTime; |
| 10653 } on JavaException catch (exception, stackTrace) { | 10802 } catch (exception, stackTrace) { |
| 10654 throw new AnalysisException("Could not get contents of ${source}", new Cau
ghtException(exception, stackTrace)); | 10803 throw new AnalysisException("Could not get contents of ${source}", new Cau
ghtException(exception, stackTrace)); |
| 10655 } | 10804 } |
| 10656 } | 10805 } |
| 10657 } | 10806 } |
| 10658 | 10807 |
| 10659 /** | 10808 /** |
| 10660 * The interface `HtmlEntry` defines the behavior of objects that maintain the i
nformation | 10809 * The interface `HtmlEntry` defines the behavior of objects that maintain the i
nformation |
| 10661 * cached by an analysis context about an individual HTML file. | 10810 * cached by an analysis context about an individual HTML file. |
| 10662 */ | 10811 */ |
| 10663 abstract class HtmlEntry implements SourceEntry { | 10812 abstract class HtmlEntry implements SourceEntry { |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11243 _polymerBuildErrorsState = other._polymerBuildErrorsState; | 11392 _polymerBuildErrorsState = other._polymerBuildErrorsState; |
| 11244 _polymerBuildErrors = other._polymerBuildErrors; | 11393 _polymerBuildErrors = other._polymerBuildErrors; |
| 11245 _polymerResolutionErrorsState = other._polymerResolutionErrorsState; | 11394 _polymerResolutionErrorsState = other._polymerResolutionErrorsState; |
| 11246 _polymerResolutionErrors = other._polymerResolutionErrors; | 11395 _polymerResolutionErrors = other._polymerResolutionErrors; |
| 11247 } | 11396 } |
| 11248 | 11397 |
| 11249 @override | 11398 @override |
| 11250 bool get hasErrorState => super.hasErrorState || _parsedUnitState == CacheStat
e.ERROR || _resolvedUnitState == CacheState.ERROR || _parseErrorsState == CacheS
tate.ERROR || _resolutionErrorsState == CacheState.ERROR || _referencedLibraries
State == CacheState.ERROR || _elementState == CacheState.ERROR || _angularErrors
State == CacheState.ERROR || _hintsState == CacheState.ERROR || _polymerBuildErr
orsState == CacheState.ERROR || _polymerResolutionErrorsState == CacheState.ERRO
R; | 11399 bool get hasErrorState => super.hasErrorState || _parsedUnitState == CacheStat
e.ERROR || _resolvedUnitState == CacheState.ERROR || _parseErrorsState == CacheS
tate.ERROR || _resolutionErrorsState == CacheState.ERROR || _referencedLibraries
State == CacheState.ERROR || _elementState == CacheState.ERROR || _angularErrors
State == CacheState.ERROR || _hintsState == CacheState.ERROR || _polymerBuildErr
orsState == CacheState.ERROR || _polymerResolutionErrorsState == CacheState.ERRO
R; |
| 11251 | 11400 |
| 11252 @override | 11401 @override |
| 11402 bool writeDiffOn(JavaStringBuilder builder, SourceEntry oldEntry) { |
| 11403 bool needsSeparator = super.writeDiffOn(builder, oldEntry); |
| 11404 if (oldEntry is! HtmlEntryImpl) { |
| 11405 if (needsSeparator) { |
| 11406 builder.append("; "); |
| 11407 } |
| 11408 builder.append("entry type changed; was ${oldEntry.runtimeType.toString()}
"); |
| 11409 return true; |
| 11410 } |
| 11411 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.PARSE_ERRORS, "parseErrors"); |
| 11412 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.PARSED_UNIT, "parsedUnit"); |
| 11413 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.RESOLVED_UNIT, "resolvedUnit"); |
| 11414 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.RESOLUTION_ERRORS, "resolutionErrors"); |
| 11415 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.REFERENCED_LIBRARIES, "referencedLibraries"); |
| 11416 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.ELEMENT, "element"); |
| 11417 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.ANGULAR_APPLICATION, "angularApplicationState"); |
| 11418 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.ANGULAR_COMPONENT, "angularComponent"); |
| 11419 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.ANGULAR_ENTRY, "angularEntry"); |
| 11420 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.ANGULAR_ERRORS, "angularErrors"); |
| 11421 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.POLYMER_BUILD_ERRORS, "polymerBuildErrors"); |
| 11422 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, HtmlEnt
ry.POLYMER_RESOLUTION_ERRORS, "polymerResolutionErrors"); |
| 11423 return needsSeparator; |
| 11424 } |
| 11425 |
| 11426 @override |
| 11253 void writeOn(JavaStringBuilder builder) { | 11427 void writeOn(JavaStringBuilder builder) { |
| 11254 builder.append("Html: "); | 11428 builder.append("Html: "); |
| 11255 super.writeOn(builder); | 11429 super.writeOn(builder); |
| 11256 builder.append("; parseErrors = "); | 11430 builder.append("; parseErrors = "); |
| 11257 builder.append(_parseErrorsState); | 11431 builder.append(_parseErrorsState); |
| 11258 builder.append("; parsedUnit = "); | 11432 builder.append("; parsedUnit = "); |
| 11259 builder.append(_parsedUnitState); | 11433 builder.append(_parsedUnitState); |
| 11260 builder.append("; resolvedUnit = "); | 11434 builder.append("; resolvedUnit = "); |
| 11261 builder.append(_resolvedUnitState); | 11435 builder.append(_resolvedUnitState); |
| 11262 builder.append("; resolutionErrors = "); | 11436 builder.append("; resolutionErrors = "); |
| (...skipping 3606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14869 // recorded when it should be. | 15043 // recorded when it should be. |
| 14870 // | 15044 // |
| 14871 _exception = new CaughtException(new AnalysisException("State set to ERR
OR without setting an exception"), null); | 15045 _exception = new CaughtException(new AnalysisException("State set to ERR
OR without setting an exception"), null); |
| 14872 } | 15046 } |
| 14873 } else { | 15047 } else { |
| 14874 _exception = null; | 15048 _exception = null; |
| 14875 } | 15049 } |
| 14876 } | 15050 } |
| 14877 | 15051 |
| 14878 /** | 15052 /** |
| 15053 * Return a textual representation of the difference between the old entry and
this entry. The |
| 15054 * difference is represented as a sequence of fields whose value would change
if the old entry |
| 15055 * were converted into the new entry. |
| 15056 * |
| 15057 * @param oldEntry the entry being diff'd with this entry |
| 15058 * @return a textual representation of the difference |
| 15059 */ |
| 15060 String getDiff(SourceEntry oldEntry) { |
| 15061 JavaStringBuilder builder = new JavaStringBuilder(); |
| 15062 writeDiffOn(builder, oldEntry); |
| 15063 return builder.toString(); |
| 15064 } |
| 15065 |
| 15066 /** |
| 14879 * Return the exception that caused one or more values to have a state of [Cac
heState#ERROR] | 15067 * Return the exception that caused one or more values to have a state of [Cac
heState#ERROR] |
| 14880 * . | 15068 * . |
| 14881 * | 15069 * |
| 14882 * @return the exception that caused one or more values to be uncomputable | 15070 * @return the exception that caused one or more values to be uncomputable |
| 14883 */ | 15071 */ |
| 14884 @override | 15072 @override |
| 14885 CaughtException get exception => _exception; | 15073 CaughtException get exception => _exception; |
| 14886 | 15074 |
| 14887 /** | 15075 /** |
| 14888 * Return `true` if the source was explicitly added to the context or `false`
if the | 15076 * Return `true` if the source was explicitly added to the context or `false`
if the |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15095 } else if (state == CacheState.IN_PROCESS) { | 15283 } else if (state == CacheState.IN_PROCESS) { |
| 15096 // | 15284 // |
| 15097 // We can leave the current value in the cache for any 'get' methods to ac
cess. | 15285 // We can leave the current value in the cache for any 'get' methods to ac
cess. |
| 15098 // | 15286 // |
| 15099 return currentValue; | 15287 return currentValue; |
| 15100 } | 15288 } |
| 15101 return defaultValue; | 15289 return defaultValue; |
| 15102 } | 15290 } |
| 15103 | 15291 |
| 15104 /** | 15292 /** |
| 15293 * Write a textual representation of the difference between the old entry and
this entry to the |
| 15294 * given string builder. |
| 15295 * |
| 15296 * @param builder the string builder to which the difference is to be written |
| 15297 * @param oldEntry the entry that was replaced by this entry |
| 15298 * @return `true` if some difference was written |
| 15299 */ |
| 15300 bool writeDiffOn(JavaStringBuilder builder, SourceEntry oldEntry) { |
| 15301 bool needsSeparator = false; |
| 15302 CaughtException oldException = oldEntry.exception; |
| 15303 if (!identical(oldException, _exception)) { |
| 15304 builder.append("exception = "); |
| 15305 builder.append(oldException.runtimeType); |
| 15306 builder.append(" -> "); |
| 15307 builder.append(_exception.runtimeType); |
| 15308 needsSeparator = true; |
| 15309 } |
| 15310 int oldModificationTime = oldEntry.modificationTime; |
| 15311 if (oldModificationTime != _modificationTime) { |
| 15312 if (needsSeparator) { |
| 15313 builder.append("; "); |
| 15314 } |
| 15315 builder.append("time = "); |
| 15316 builder.append(oldModificationTime); |
| 15317 builder.append(" -> "); |
| 15318 builder.append(_modificationTime); |
| 15319 needsSeparator = true; |
| 15320 } |
| 15321 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, SourceE
ntry.CONTENT, "content"); |
| 15322 needsSeparator = writeStateDiffOn(builder, needsSeparator, oldEntry, SourceE
ntry.LINE_INFO, "lineInfo"); |
| 15323 return needsSeparator; |
| 15324 } |
| 15325 |
| 15326 /** |
| 15105 * Write a textual representation of this entry to the given builder. The resu
lt will only be used | 15327 * Write a textual representation of this entry to the given builder. The resu
lt will only be used |
| 15106 * for debugging purposes. | 15328 * for debugging purposes. |
| 15107 * | 15329 * |
| 15108 * @param builder the builder to which the text should be written | 15330 * @param builder the builder to which the text should be written |
| 15109 */ | 15331 */ |
| 15110 void writeOn(JavaStringBuilder builder) { | 15332 void writeOn(JavaStringBuilder builder) { |
| 15111 builder.append("time = "); | 15333 builder.append("time = "); |
| 15112 builder.append(_modificationTime); | 15334 builder.append(_modificationTime); |
| 15113 builder.append("; content = "); | 15335 builder.append("; content = "); |
| 15114 builder.append(_contentState); | 15336 builder.append(_contentState); |
| 15115 builder.append("; lineInfo = "); | 15337 builder.append("; lineInfo = "); |
| 15116 builder.append(_lineInfoState); | 15338 builder.append(_lineInfoState); |
| 15117 } | 15339 } |
| 15118 | 15340 |
| 15119 /** | 15341 /** |
| 15342 * Write a textual representation of the difference between the state of the s
pecified data |
| 15343 * between the old entry and this entry to the given string builder. |
| 15344 * |
| 15345 * @param builder the string builder to which the difference is to be written |
| 15346 * @param needsSeparator `true` if any data that is written |
| 15347 * @param oldEntry the entry that was replaced by this entry |
| 15348 * @param descriptor the descriptor defining the data whose state is being com
pared |
| 15349 * @param label the label used to describe the state |
| 15350 * @return `true` if some difference was written |
| 15351 */ |
| 15352 bool writeStateDiffOn(JavaStringBuilder builder, bool needsSeparator, SourceEn
try oldEntry, DataDescriptor descriptor, String label) { |
| 15353 CacheState oldState = oldEntry.getState(descriptor); |
| 15354 CacheState newState = getState(descriptor); |
| 15355 if (oldState != newState) { |
| 15356 if (needsSeparator) { |
| 15357 builder.append("; "); |
| 15358 } |
| 15359 builder.append(label); |
| 15360 builder.append(" = "); |
| 15361 builder.append(oldState); |
| 15362 builder.append(" -> "); |
| 15363 builder.append(newState); |
| 15364 return true; |
| 15365 } |
| 15366 return needsSeparator; |
| 15367 } |
| 15368 |
| 15369 /** |
| 15120 * If the state is changing from ERROR to anything else, capture the informati
on. This is an | 15370 * If the state is changing from ERROR to anything else, capture the informati
on. This is an |
| 15121 * attempt to discover the underlying cause of a long-standing bug. | 15371 * attempt to discover the underlying cause of a long-standing bug. |
| 15122 * | 15372 * |
| 15123 * @param newState the new state of the content | 15373 * @param newState the new state of the content |
| 15124 * @return the new state of the content | 15374 * @return the new state of the content |
| 15125 */ | 15375 */ |
| 15126 CacheState _checkContentState(CacheState newState) { | 15376 CacheState _checkContentState(CacheState newState) { |
| 15127 if (_contentState == CacheState.ERROR) { | 15377 if (_contentState == CacheState.ERROR) { |
| 15128 InstrumentationBuilder builder = Instrumentation.builder2("SourceEntryImpl
-checkContentState"); | 15378 InstrumentationBuilder builder = Instrumentation.builder2("SourceEntryImpl
-checkContentState"); |
| 15129 builder.data3("message", "contentState changing from ${_contentState} to $
{newState}"); | 15379 builder.data3("message", "contentState changing from ${_contentState} to $
{newState}"); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15424 _index++; | 15674 _index++; |
| 15425 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { | 15675 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { |
| 15426 _index = 0; | 15676 _index = 0; |
| 15427 _queueIndex++; | 15677 _queueIndex++; |
| 15428 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { | 15678 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { |
| 15429 _queueIndex++; | 15679 _queueIndex++; |
| 15430 } | 15680 } |
| 15431 } | 15681 } |
| 15432 } | 15682 } |
| 15433 } | 15683 } |
| OLD | NEW |