Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 214593008: Rollback pkg/analyzer that breaks code_transformers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | pkg/analyzer/lib/src/generated/error.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 861 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 } 872 }
873 873
874 /** 874 /**
875 * Instances of the class `AnalysisResult` 875 * Instances of the class `AnalysisResult`
876 */ 876 */
877 class AnalysisResult { 877 class AnalysisResult {
878 /** 878 /**
879 * The change notices associated with this result, or `null` if there were no changes and 879 * The change notices associated with this result, or `null` if there were no changes and
880 * there is no more work to be done. 880 * there is no more work to be done.
881 */ 881 */
882 final List<ChangeNotice> _notices; 882 List<ChangeNotice> _notices;
883 883
884 /** 884 /**
885 * The number of milliseconds required to determine which task was to be perfo rmed. 885 * The number of milliseconds required to determine which task was to be perfo rmed.
886 */ 886 */
887 final int getTime; 887 int getTime = 0;
888 888
889 /** 889 /**
890 * The name of the class of the task that was performed. 890 * The name of the class of the task that was performed.
891 */ 891 */
892 final String taskClassName; 892 String taskClassName;
893 893
894 /** 894 /**
895 * The number of milliseconds required to perform the task. 895 * The number of milliseconds required to perform the task.
896 */ 896 */
897 final int performTime; 897 int performTime = 0;
898 898
899 /** 899 /**
900 * Initialize a newly created analysis result to have the given values. 900 * Initialize a newly created analysis result to have the given values.
901 * 901 *
902 * @param notices the change notices associated with this result 902 * @param notices the change notices associated with this result
903 * @param getTime the number of milliseconds required to determine which task was to be performed 903 * @param getTime the number of milliseconds required to determine which task was to be performed
904 * @param taskClassName the name of the class of the task that was performed 904 * @param taskClassName the name of the class of the task that was performed
905 * @param performTime the number of milliseconds required to perform the task 905 * @param performTime the number of milliseconds required to perform the task
906 */ 906 */
907 AnalysisResult(this._notices, this.getTime, this.taskClassName, this.performTi me); 907 AnalysisResult(List<ChangeNotice> notices, int getTime, String taskClassName, int performTime) {
908 this._notices = notices;
909 this.getTime = getTime;
910 this.taskClassName = taskClassName;
911 this.performTime = performTime;
912 }
908 913
909 /** 914 /**
910 * Return the change notices associated with this result, or `null` if there w ere no changes 915 * Return the change notices associated with this result, or `null` if there w ere no changes
911 * and there is no more work to be done. 916 * and there is no more work to be done.
912 * 917 *
913 * @return the change notices associated with this result 918 * @return the change notices associated with this result
914 */ 919 */
915 List<ChangeNotice> get changeNotices => _notices; 920 List<ChangeNotice> get changeNotices => _notices;
916 921
917 /** 922 /**
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 Map<Source, SourceEntry> _sourceMap = new Map<Source, SourceEntry>(); 1142 Map<Source, SourceEntry> _sourceMap = new Map<Source, SourceEntry>();
1138 1143
1139 /** 1144 /**
1140 * The maximum number of sources for which AST structures should be kept in th e cache. 1145 * The maximum number of sources for which AST structures should be kept in th e cache.
1141 */ 1146 */
1142 int _maxCacheSize = 0; 1147 int _maxCacheSize = 0;
1143 1148
1144 /** 1149 /**
1145 * The policy used to determine which pieces of data to remove from the cache. 1150 * The policy used to determine which pieces of data to remove from the cache.
1146 */ 1151 */
1147 final CacheRetentionPolicy _retentionPolicy; 1152 CacheRetentionPolicy _retentionPolicy;
1148 1153
1149 /** 1154 /**
1150 * A list containing the most recently accessed sources with the most recently used at the end of 1155 * A list containing the most recently accessed sources with the most recently used at the end of
1151 * the list. When more sources are added than the maximum allowed then the lea st recently used 1156 * the list. When more sources are added than the maximum allowed then the lea st recently used
1152 * source will be removed and will have it's cached AST structure flushed. 1157 * source will be removed and will have it's cached AST structure flushed.
1153 */ 1158 */
1154 List<Source> _recentlyUsed; 1159 List<Source> _recentlyUsed;
1155 1160
1156 /** 1161 /**
1157 * Initialize a newly created cache to maintain at most the given number of AS T structures in the 1162 * Initialize a newly created cache to maintain at most the given number of AS T structures in the
1158 * cache. 1163 * cache.
1159 * 1164 *
1160 * @param maxCacheSize the maximum number of sources for which AST structures should be kept in 1165 * @param maxCacheSize the maximum number of sources for which AST structures should be kept in
1161 * the cache 1166 * the cache
1162 * @param retentionPolicy the policy used to determine which pieces of data to remove from the 1167 * @param retentionPolicy the policy used to determine which pieces of data to remove from the
1163 * cache 1168 * cache
1164 */ 1169 */
1165 AnalysisCache(int maxCacheSize, this._retentionPolicy) { 1170 AnalysisCache(int maxCacheSize, CacheRetentionPolicy retentionPolicy) {
1166 this._maxCacheSize = maxCacheSize; 1171 this._maxCacheSize = maxCacheSize;
1172 this._retentionPolicy = retentionPolicy;
1167 _recentlyUsed = new List<Source>(); 1173 _recentlyUsed = new List<Source>();
1168 } 1174 }
1169 1175
1170 /** 1176 /**
1171 * Record that the AST associated with the given source was just read from the cache. 1177 * Record that the AST associated with the given source was just read from the cache.
1172 * 1178 *
1173 * @param source the source whose AST was accessed 1179 * @param source the source whose AST was accessed
1174 */ 1180 */
1175 void accessedAst(Source source) { 1181 void accessedAst(Source source) {
1176 if (_recentlyUsed.remove(source)) { 1182 if (_recentlyUsed.remove(source)) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1341 * The enumeration `CacheState` defines the possible states of cached data. 1347 * The enumeration `CacheState` defines the possible states of cached data.
1342 */ 1348 */
1343 class CacheState extends Enum<CacheState> { 1349 class CacheState extends Enum<CacheState> {
1344 /** 1350 /**
1345 * The data is not in the cache and the last time an attempt was made to compu te the data an 1351 * The data is not in the cache and the last time an attempt was made to compu te the data an
1346 * exception occurred, making it pointless to attempt. 1352 * exception occurred, making it pointless to attempt.
1347 * 1353 *
1348 * Valid Transitions: 1354 * Valid Transitions:
1349 * * [INVALID] if a source was modified that might cause the data to be comput able 1355 * * [INVALID] if a source was modified that might cause the data to be comput able
1350 */ 1356 */
1351 static const CacheState ERROR = const CacheState('ERROR', 0); 1357 static final CacheState ERROR = new CacheState('ERROR', 0);
1352 1358
1353 /** 1359 /**
1354 * The data is not in the cache because it was flushed from the cache in order to control memory 1360 * The data is not in the cache because it was flushed from the cache in order to control memory
1355 * usage. If the data is recomputed, results do not need to be reported. 1361 * usage. If the data is recomputed, results do not need to be reported.
1356 * 1362 *
1357 * Valid Transitions: 1363 * Valid Transitions:
1358 * * [IN_PROCESS] if the data is being recomputed 1364 * * [IN_PROCESS] if the data is being recomputed
1359 * * [INVALID] if a source was modified that causes the data to need to be rec omputed 1365 * * [INVALID] if a source was modified that causes the data to need to be rec omputed
1360 */ 1366 */
1361 static const CacheState FLUSHED = const CacheState('FLUSHED', 1); 1367 static final CacheState FLUSHED = new CacheState('FLUSHED', 1);
1362 1368
1363 /** 1369 /**
1364 * The data might or might not be in the cache but is in the process of being recomputed. 1370 * The data might or might not be in the cache but is in the process of being recomputed.
1365 * 1371 *
1366 * Valid Transitions: 1372 * Valid Transitions:
1367 * * [ERROR] if an exception occurred while trying to compute the data 1373 * * [ERROR] if an exception occurred while trying to compute the data
1368 * * [VALID] if the data was successfully computed and stored in the cache 1374 * * [VALID] if the data was successfully computed and stored in the cache
1369 */ 1375 */
1370 static const CacheState IN_PROCESS = const CacheState('IN_PROCESS', 2); 1376 static final CacheState IN_PROCESS = new CacheState('IN_PROCESS', 2);
1371 1377
1372 /** 1378 /**
1373 * The data is not in the cache and needs to be recomputed so that results can be reported. 1379 * The data is not in the cache and needs to be recomputed so that results can be reported.
1374 * 1380 *
1375 * Valid Transitions: 1381 * Valid Transitions:
1376 * * [IN_PROCESS] if an attempt is being made to recompute the data 1382 * * [IN_PROCESS] if an attempt is being made to recompute the data
1377 */ 1383 */
1378 static const CacheState INVALID = const CacheState('INVALID', 3); 1384 static final CacheState INVALID = new CacheState('INVALID', 3);
1379 1385
1380 /** 1386 /**
1381 * The data is in the cache and up-to-date. 1387 * The data is in the cache and up-to-date.
1382 * 1388 *
1383 * Valid Transitions: 1389 * Valid Transitions:
1384 * * [FLUSHED] if the data is removed in order to manage memory usage 1390 * * [FLUSHED] if the data is removed in order to manage memory usage
1385 * * [INVALID] if a source was modified in such a way as to invalidate the pre vious data 1391 * * [INVALID] if a source was modified in such a way as to invalidate the pre vious data
1386 */ 1392 */
1387 static const CacheState VALID = const CacheState('VALID', 4); 1393 static final CacheState VALID = new CacheState('VALID', 4);
1388 1394
1389 static const List<CacheState> values = const [ERROR, FLUSHED, IN_PROCESS, INVA LID, VALID]; 1395 static final List<CacheState> values = [ERROR, FLUSHED, IN_PROCESS, INVALID, V ALID];
1390 1396
1391 const CacheState(String name, int ordinal) : super(name, ordinal); 1397 CacheState(String name, int ordinal) : super(name, ordinal);
1392 } 1398 }
1393 1399
1394 /** 1400 /**
1395 * The interface `DartEntry` defines the behavior of objects that maintain the i nformation 1401 * The interface `DartEntry` defines the behavior of objects that maintain the i nformation
1396 * cached by an analysis context about an individual Dart file. 1402 * cached by an analysis context about an individual Dart file.
1397 */ 1403 */
1398 abstract class DartEntry implements SourceEntry { 1404 abstract class DartEntry implements SourceEntry {
1399 /** 1405 /**
1400 * The data descriptor representing the errors reported during Angular resolut ion. 1406 * The data descriptor representing the errors reported during Angular resolut ion.
1401 */ 1407 */
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 * The state of the cached client/ server flag. 1705 * The state of the cached client/ server flag.
1700 */ 1706 */
1701 CacheState _clientServerState = CacheState.INVALID; 1707 CacheState _clientServerState = CacheState.INVALID;
1702 1708
1703 /** 1709 /**
1704 * The state of the cached launchable flag. 1710 * The state of the cached launchable flag.
1705 */ 1711 */
1706 CacheState _launchableState = CacheState.INVALID; 1712 CacheState _launchableState = CacheState.INVALID;
1707 1713
1708 /** 1714 /**
1715 * An integer holding bit masks such as [LAUNCHABLE] and [CLIENT_CODE].
1716 */
1717 int _bitmask = 0;
1718
1719 /**
1709 * The error produced while performing Angular resolution, or an empty array i f there are no 1720 * The error produced while performing Angular resolution, or an empty array i f there are no
1710 * errors if the error are not currently cached. 1721 * errors if the error are not currently cached.
1711 */ 1722 */
1712 List<AnalysisError> _angularErrors = AnalysisError.NO_ERRORS; 1723 List<AnalysisError> _angularErrors = AnalysisError.NO_ERRORS;
1713 1724
1714 /** 1725 /**
1715 * The index of the flag indicating whether this library is launchable (whethe r the file has a 1726 * The index of the bit in the [bitmask] indicating that this library is launc hable: that
1716 * main method). 1727 * the file has a main method.
1717 */ 1728 */
1718 static int _LAUNCHABLE_INDEX = 1; 1729 static int _LAUNCHABLE_INDEX = 1;
1719 1730
1720 /** 1731 /**
1721 * The index of the flag indicating whether the library is client code (whethe r the library 1732 * The index of the bit in the [bitmask] indicating that the library is client code: that
1722 * depends on the html library). If the library is not "client code", then it is referred to as 1733 * the library depends on the html library. If the library is not "client code ", then it is
1723 * "server code". 1734 * referred to as "server code".
1724 */ 1735 */
1725 static int _CLIENT_CODE_INDEX = 2; 1736 static int _CLIENT_CODE_INDEX = 2;
1726 1737
1727 /** 1738 /**
1728 * Add the given library to the list of libraries that contain this part. This method should only 1739 * Add the given library to the list of libraries that contain this part. This method should only
1729 * be invoked on entries that represent a part. 1740 * be invoked on entries that represent a part.
1730 * 1741 *
1731 * @param librarySource the source of the library to be added 1742 * @param librarySource the source of the library to be added
1732 */ 1743 */
1733 void addContainingLibrary(Source librarySource) { 1744 void addContainingLibrary(Source librarySource) {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 while (state != null) { 1795 while (state != null) {
1785 if (identical(state._resolvedUnitState, CacheState.VALID)) { 1796 if (identical(state._resolvedUnitState, CacheState.VALID)) {
1786 return state._resolvedUnit; 1797 return state._resolvedUnit;
1787 } 1798 }
1788 state = state._nextState; 1799 state = state._nextState;
1789 } 1800 }
1790 ; 1801 ;
1791 return null; 1802 return null;
1792 } 1803 }
1793 1804
1794 /**
1795 * Return a list containing the libraries that are known to contain this part.
1796 *
1797 * @return a list containing the libraries that are known to contain this part
1798 */
1799 List<Source> get containingLibraries => _containingLibraries;
1800
1801 @override 1805 @override
1802 SourceKind get kind => _sourceKind; 1806 SourceKind get kind => _sourceKind;
1803 1807
1804 /** 1808 /**
1805 * Answer an array of library sources containing the receiver's source. 1809 * Answer an array of library sources containing the receiver's source.
1806 */ 1810 */
1807 List<Source> get librariesContaining { 1811 List<Source> get librariesContaining {
1808 DartEntryImpl_ResolutionState state = _resolutionState; 1812 DartEntryImpl_ResolutionState state = _resolutionState;
1809 List<Source> result = new List<Source>(); 1813 List<Source> result = new List<Source>();
1810 while (state != null) { 1814 while (state != null) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1910 return new List.from(_containingLibraries); 1914 return new List.from(_containingLibraries);
1911 } else if (identical(descriptor, DartEntry.ELEMENT)) { 1915 } else if (identical(descriptor, DartEntry.ELEMENT)) {
1912 return _element; 1916 return _element;
1913 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { 1917 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) {
1914 return _exportedLibraries; 1918 return _exportedLibraries;
1915 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { 1919 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) {
1916 return _importedLibraries; 1920 return _importedLibraries;
1917 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { 1921 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) {
1918 return _includedParts; 1922 return _includedParts;
1919 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { 1923 } else if (identical(descriptor, DartEntry.IS_CLIENT)) {
1920 return getFlag(_CLIENT_CODE_INDEX); 1924 return BooleanArray.get(_bitmask, _CLIENT_CODE_INDEX);
1921 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) { 1925 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) {
1922 return getFlag(_LAUNCHABLE_INDEX); 1926 return BooleanArray.get(_bitmask, _LAUNCHABLE_INDEX);
1923 } else if (identical(descriptor, DartEntry.PARSE_ERRORS)) { 1927 } else if (identical(descriptor, DartEntry.PARSE_ERRORS)) {
1924 return _parseErrors; 1928 return _parseErrors;
1925 } else if (identical(descriptor, DartEntry.PARSED_UNIT)) { 1929 } else if (identical(descriptor, DartEntry.PARSED_UNIT)) {
1926 _parsedUnitAccessed = true; 1930 _parsedUnitAccessed = true;
1927 return _parsedUnit; 1931 return _parsedUnit;
1928 } else if (identical(descriptor, DartEntry.PUBLIC_NAMESPACE)) { 1932 } else if (identical(descriptor, DartEntry.PUBLIC_NAMESPACE)) {
1929 return _publicNamespace; 1933 return _publicNamespace;
1930 } else if (identical(descriptor, DartEntry.SCAN_ERRORS)) { 1934 } else if (identical(descriptor, DartEntry.SCAN_ERRORS)) {
1931 return _scanErrors; 1935 return _scanErrors;
1932 } else if (identical(descriptor, DartEntry.SOURCE_KIND)) { 1936 } else if (identical(descriptor, DartEntry.SOURCE_KIND)) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
2171 } 2175 }
2172 2176
2173 /** 2177 /**
2174 * Record that an error occurred while attempting to scan or parse the entry r epresented by this 2178 * Record that an error occurred while attempting to scan or parse the entry r epresented by this
2175 * entry. This will set the state of all resolution-based information as being in error, but will 2179 * entry. This will set the state of all resolution-based information as being in error, but will
2176 * not change the state of any parse results. 2180 * not change the state of any parse results.
2177 */ 2181 */
2178 void recordResolutionError() { 2182 void recordResolutionError() {
2179 _element = null; 2183 _element = null;
2180 _elementState = CacheState.ERROR; 2184 _elementState = CacheState.ERROR;
2181 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); 2185 _bitmask = 0;
2182 _clientServerState = CacheState.ERROR; 2186 _clientServerState = CacheState.ERROR;
2183 _launchableState = CacheState.ERROR; 2187 _launchableState = CacheState.ERROR;
2184 _publicNamespace = null; 2188 _publicNamespace = null;
2185 _publicNamespaceState = CacheState.ERROR; 2189 _publicNamespaceState = CacheState.ERROR;
2186 _resolutionState.recordResolutionError(); 2190 _resolutionState.recordResolutionError();
2187 } 2191 }
2188 2192
2189 /** 2193 /**
2190 * Record that an in-process parse has stopped without recording results becau se the results were 2194 * Record that an in-process parse has stopped without recording results becau se the results were
2191 * invalidated before they could be recorded. 2195 * invalidated before they could be recorded.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2311 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { 2315 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) {
2312 _exportedLibraries = updatedValue(state, _exportedLibraries, Source.EMPTY_ ARRAY); 2316 _exportedLibraries = updatedValue(state, _exportedLibraries, Source.EMPTY_ ARRAY);
2313 _exportedLibrariesState = state; 2317 _exportedLibrariesState = state;
2314 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { 2318 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) {
2315 _importedLibraries = updatedValue(state, _importedLibraries, Source.EMPTY_ ARRAY); 2319 _importedLibraries = updatedValue(state, _importedLibraries, Source.EMPTY_ ARRAY);
2316 _importedLibrariesState = state; 2320 _importedLibrariesState = state;
2317 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { 2321 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) {
2318 _includedParts = updatedValue(state, _includedParts, Source.EMPTY_ARRAY); 2322 _includedParts = updatedValue(state, _includedParts, Source.EMPTY_ARRAY);
2319 _includedPartsState = state; 2323 _includedPartsState = state;
2320 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { 2324 } else if (identical(descriptor, DartEntry.IS_CLIENT)) {
2321 _updateValueOfFlag(_CLIENT_CODE_INDEX, state); 2325 _bitmask = _updatedValueOfFlag(state, _bitmask, _CLIENT_CODE_INDEX);
2322 _clientServerState = state; 2326 _clientServerState = state;
2323 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) { 2327 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) {
2324 _updateValueOfFlag(_LAUNCHABLE_INDEX, state); 2328 _bitmask = _updatedValueOfFlag(state, _bitmask, _LAUNCHABLE_INDEX);
2325 _launchableState = state; 2329 _launchableState = state;
2326 } else if (identical(descriptor, DartEntry.PARSE_ERRORS)) { 2330 } else if (identical(descriptor, DartEntry.PARSE_ERRORS)) {
2327 _parseErrors = updatedValue(state, _parseErrors, AnalysisError.NO_ERRORS); 2331 _parseErrors = updatedValue(state, _parseErrors, AnalysisError.NO_ERRORS);
2328 _parseErrorsState = state; 2332 _parseErrorsState = state;
2329 } else if (identical(descriptor, DartEntry.PARSED_UNIT)) { 2333 } else if (identical(descriptor, DartEntry.PARSED_UNIT)) {
2330 CompilationUnit newUnit = updatedValue(state, _parsedUnit, null); 2334 CompilationUnit newUnit = updatedValue(state, _parsedUnit, null);
2331 if (newUnit != _parsedUnit) { 2335 if (newUnit != _parsedUnit) {
2332 _parsedUnitAccessed = false; 2336 _parsedUnitAccessed = false;
2333 } 2337 }
2334 _parsedUnit = newUnit; 2338 _parsedUnit = newUnit;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { 2392 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) {
2389 _exportedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S ource>); 2393 _exportedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S ource>);
2390 _exportedLibrariesState = CacheState.VALID; 2394 _exportedLibrariesState = CacheState.VALID;
2391 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { 2395 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) {
2392 _importedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S ource>); 2396 _importedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S ource>);
2393 _importedLibrariesState = CacheState.VALID; 2397 _importedLibrariesState = CacheState.VALID;
2394 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { 2398 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) {
2395 _includedParts = value == null ? Source.EMPTY_ARRAY : (value as List<Sourc e>); 2399 _includedParts = value == null ? Source.EMPTY_ARRAY : (value as List<Sourc e>);
2396 _includedPartsState = CacheState.VALID; 2400 _includedPartsState = CacheState.VALID;
2397 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { 2401 } else if (identical(descriptor, DartEntry.IS_CLIENT)) {
2398 setFlag(_CLIENT_CODE_INDEX, value as bool); 2402 _bitmask = BooleanArray.set(_bitmask, _CLIENT_CODE_INDEX, value as bool);
2399 _clientServerState = CacheState.VALID; 2403 _clientServerState = CacheState.VALID;
2400 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) { 2404 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) {
2401 setFlag(_LAUNCHABLE_INDEX, value as bool); 2405 _bitmask = BooleanArray.set(_bitmask, _LAUNCHABLE_INDEX, value as bool);
2402 _launchableState = CacheState.VALID; 2406 _launchableState = CacheState.VALID;
2403 } else if (identical(descriptor, DartEntry.PARSE_ERRORS)) { 2407 } else if (identical(descriptor, DartEntry.PARSE_ERRORS)) {
2404 _parseErrors = value == null ? AnalysisError.NO_ERRORS : (value as List<An alysisError>); 2408 _parseErrors = value == null ? AnalysisError.NO_ERRORS : (value as List<An alysisError>);
2405 _parseErrorsState = CacheState.VALID; 2409 _parseErrorsState = CacheState.VALID;
2406 } else if (identical(descriptor, DartEntry.PARSED_UNIT)) { 2410 } else if (identical(descriptor, DartEntry.PARSED_UNIT)) {
2407 _parsedUnit = value as CompilationUnit; 2411 _parsedUnit = value as CompilationUnit;
2408 _parsedUnitAccessed = false; 2412 _parsedUnitAccessed = false;
2409 _parsedUnitState = CacheState.VALID; 2413 _parsedUnitState = CacheState.VALID;
2410 } else if (identical(descriptor, DartEntry.PUBLIC_NAMESPACE)) { 2414 } else if (identical(descriptor, DartEntry.PUBLIC_NAMESPACE)) {
2411 _publicNamespace = value as Namespace; 2415 _publicNamespace = value as Namespace;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
2472 _importedLibrariesState = other._importedLibrariesState; 2476 _importedLibrariesState = other._importedLibrariesState;
2473 _importedLibraries = other._importedLibraries; 2477 _importedLibraries = other._importedLibraries;
2474 _containingLibraries = new List<Source>.from(other._containingLibraries); 2478 _containingLibraries = new List<Source>.from(other._containingLibraries);
2475 _resolutionState.copyFrom(other._resolutionState); 2479 _resolutionState.copyFrom(other._resolutionState);
2476 _elementState = other._elementState; 2480 _elementState = other._elementState;
2477 _element = other._element; 2481 _element = other._element;
2478 _publicNamespaceState = other._publicNamespaceState; 2482 _publicNamespaceState = other._publicNamespaceState;
2479 _publicNamespace = other._publicNamespace; 2483 _publicNamespace = other._publicNamespace;
2480 _clientServerState = other._clientServerState; 2484 _clientServerState = other._clientServerState;
2481 _launchableState = other._launchableState; 2485 _launchableState = other._launchableState;
2486 _bitmask = other._bitmask;
2482 _angularErrors = other._angularErrors; 2487 _angularErrors = other._angularErrors;
2483 } 2488 }
2484 2489
2485 @override 2490 @override
2486 bool get hasErrorState => super.hasErrorState || identical(_scanErrorsState, C acheState.ERROR) || identical(_tokenStreamState, CacheState.ERROR) || identical( _sourceKindState, CacheState.ERROR) || identical(_parsedUnitState, CacheState.ER ROR) || identical(_parseErrorsState, CacheState.ERROR) || identical(_importedLib rariesState, CacheState.ERROR) || identical(_exportedLibrariesState, CacheState. ERROR) || identical(_includedPartsState, CacheState.ERROR) || identical(_element State, CacheState.ERROR) || identical(_publicNamespaceState, CacheState.ERROR) | | identical(_clientServerState, CacheState.ERROR) || identical(_launchableState, CacheState.ERROR) || _resolutionState.hasErrorState; 2491 bool get hasErrorState => super.hasErrorState || identical(_scanErrorsState, C acheState.ERROR) || identical(_tokenStreamState, CacheState.ERROR) || identical( _sourceKindState, CacheState.ERROR) || identical(_parsedUnitState, CacheState.ER ROR) || identical(_parseErrorsState, CacheState.ERROR) || identical(_importedLib rariesState, CacheState.ERROR) || identical(_exportedLibrariesState, CacheState. ERROR) || identical(_includedPartsState, CacheState.ERROR) || identical(_element State, CacheState.ERROR) || identical(_publicNamespaceState, CacheState.ERROR) | | identical(_clientServerState, CacheState.ERROR) || identical(_launchableState, CacheState.ERROR) || _resolutionState.hasErrorState;
2487 2492
2488 @override 2493 @override
2489 void writeOn(JavaStringBuilder builder) { 2494 void writeOn(JavaStringBuilder builder) {
2490 builder.append("Dart: "); 2495 builder.append("Dart: ");
2491 super.writeOn(builder); 2496 super.writeOn(builder);
(...skipping 26 matching lines...) Expand all
2518 // builder.append("; angularElements = "); 2523 // builder.append("; angularElements = ");
2519 _resolutionState.writeOn(builder); 2524 _resolutionState.writeOn(builder);
2520 } 2525 }
2521 2526
2522 /** 2527 /**
2523 * Invalidate all of the resolution information associated with the compilatio n unit. 2528 * Invalidate all of the resolution information associated with the compilatio n unit.
2524 */ 2529 */
2525 void _discardCachedResolutionInformation() { 2530 void _discardCachedResolutionInformation() {
2526 _element = null; 2531 _element = null;
2527 _elementState = CacheState.INVALID; 2532 _elementState = CacheState.INVALID;
2528 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); 2533 _bitmask = 0;
2529 _clientServerState = CacheState.INVALID; 2534 _clientServerState = CacheState.INVALID;
2530 _launchableState = CacheState.INVALID; 2535 _launchableState = CacheState.INVALID;
2531 _publicNamespace = null; 2536 _publicNamespace = null;
2532 _publicNamespaceState = CacheState.INVALID; 2537 _publicNamespaceState = CacheState.INVALID;
2533 _resolutionState.invalidateAllResolutionInformation(); 2538 _resolutionState.invalidateAllResolutionInformation();
2534 } 2539 }
2535 2540
2536 /** 2541 /**
2537 * Return a resolution state for the specified library, creating one as necess ary. 2542 * Return a resolution state for the specified library, creating one as necess ary.
2538 * 2543 *
(...skipping 12 matching lines...) Expand all
2551 newState._librarySource = librarySource; 2556 newState._librarySource = librarySource;
2552 state._nextState = newState; 2557 state._nextState = newState;
2553 return newState; 2558 return newState;
2554 } 2559 }
2555 state = state._nextState; 2560 state = state._nextState;
2556 } 2561 }
2557 return state; 2562 return state;
2558 } 2563 }
2559 2564
2560 /** 2565 /**
2561 * Given that the specified flag is being transitioned to the given state, set the value of the 2566 * Given that one of the flags is being transitioned to the given state, retur n the value of the
2562 * flag to the value that should be kept in the cache. 2567 * flags that should be kept in the cache.
2563 * 2568 *
2564 * @param index the index of the flag whose state is being set 2569 * @param state the state to which the data is being transitioned
2565 * @param state the state to which the value is being transitioned 2570 * @param currentValue the value of the flags before the transition
2571 * @param bitMask the mask used to access the bit whose state is being set
2572 * @return the value of the data that should be kept in the cache
2566 */ 2573 */
2567 void _updateValueOfFlag(int index, CacheState state) { 2574 int _updatedValueOfFlag(CacheState state, int currentValue, int bitIndex) {
2568 if (identical(state, CacheState.VALID)) { 2575 if (identical(state, CacheState.VALID)) {
2569 throw new IllegalArgumentException("Use setValue() to set the state to VAL ID"); 2576 throw new IllegalArgumentException("Use setValue() to set the state to VAL ID");
2570 } else if (state != CacheState.IN_PROCESS) { 2577 } else if (identical(state, CacheState.IN_PROCESS)) {
2571 // 2578 //
2572 // If the value is in process, we can leave the current value in the cache for any 'get' 2579 // We can leave the current value in the cache for any 'get' methods to ac cess.
2573 // methods to access.
2574 // 2580 //
2575 setFlag(index, false); 2581 return currentValue;
2576 } 2582 }
2583 return BooleanArray.set(currentValue, bitIndex, false);
2577 } 2584 }
2578 } 2585 }
2579 2586
2580 /** 2587 /**
2581 * Instances of the class `ResolutionState` represent the information produced b y resolving 2588 * Instances of the class `ResolutionState` represent the information produced b y resolving
2582 * a compilation unit as part of a specific library. 2589 * a compilation unit as part of a specific library.
2583 */ 2590 */
2584 class DartEntryImpl_ResolutionState { 2591 class DartEntryImpl_ResolutionState {
2585 /** 2592 /**
2586 * The next resolution state or `null` if none. 2593 * The next resolution state or `null` if none.
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 } 2763 }
2757 2764
2758 /** 2765 /**
2759 * Instances of the class `DataDescriptor` are immutable constants representing data that can 2766 * Instances of the class `DataDescriptor` are immutable constants representing data that can
2760 * be stored in the cache. 2767 * be stored in the cache.
2761 */ 2768 */
2762 class DataDescriptor<E> { 2769 class DataDescriptor<E> {
2763 /** 2770 /**
2764 * The name of the descriptor, used for debugging purposes. 2771 * The name of the descriptor, used for debugging purposes.
2765 */ 2772 */
2766 final String _name; 2773 String _name;
2767 2774
2768 /** 2775 /**
2769 * Initialize a newly created descriptor to have the given name. 2776 * Initialize a newly created descriptor to have the given name.
2770 * 2777 *
2771 * @param name the name of the descriptor 2778 * @param name the name of the descriptor
2772 */ 2779 */
2773 DataDescriptor(this._name); 2780 DataDescriptor(String name) {
2781 this._name = name;
2782 }
2774 2783
2775 @override 2784 @override
2776 String toString() => _name; 2785 String toString() => _name;
2777 } 2786 }
2778 2787
2779 /** 2788 /**
2780 * The interface `HtmlEntry` defines the behavior of objects that maintain the i nformation 2789 * The interface `HtmlEntry` defines the behavior of objects that maintain the i nformation
2781 * cached by an analysis context about an individual HTML file. 2790 * cached by an analysis context about an individual HTML file.
2782 */ 2791 */
2783 abstract class HtmlEntry implements SourceEntry { 2792 abstract class HtmlEntry implements SourceEntry {
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after
3305 3314
3306 /** 3315 /**
3307 * The enumerated type `RetentionPriority` represents the priority of data in th e cache in 3316 * The enumerated type `RetentionPriority` represents the priority of data in th e cache in
3308 * terms of the desirability of retaining some specified data about a specified source. 3317 * terms of the desirability of retaining some specified data about a specified source.
3309 */ 3318 */
3310 class RetentionPriority extends Enum<RetentionPriority> { 3319 class RetentionPriority extends Enum<RetentionPriority> {
3311 /** 3320 /**
3312 * A priority indicating that a given piece of data can be removed from the ca che without 3321 * A priority indicating that a given piece of data can be removed from the ca che without
3313 * reservation. 3322 * reservation.
3314 */ 3323 */
3315 static const RetentionPriority LOW = const RetentionPriority('LOW', 0); 3324 static final RetentionPriority LOW = new RetentionPriority('LOW', 0);
3316 3325
3317 /** 3326 /**
3318 * A priority indicating that a given piece of data should not be removed from the cache unless 3327 * A priority indicating that a given piece of data should not be removed from the cache unless
3319 * there are no sources for which the corresponding data has a lower priority. Currently used for 3328 * there are no sources for which the corresponding data has a lower priority. Currently used for
3320 * data that is needed in order to finish some outstanding analysis task. 3329 * data that is needed in order to finish some outstanding analysis task.
3321 */ 3330 */
3322 static const RetentionPriority MEDIUM = const RetentionPriority('MEDIUM', 1); 3331 static final RetentionPriority MEDIUM = new RetentionPriority('MEDIUM', 1);
3323 3332
3324 /** 3333 /**
3325 * A priority indicating that a given piece of data should not be removed from the cache. 3334 * A priority indicating that a given piece of data should not be removed from the cache.
3326 * Currently used for data related to a priority source. 3335 * Currently used for data related to a priority source.
3327 */ 3336 */
3328 static const RetentionPriority HIGH = const RetentionPriority('HIGH', 2); 3337 static final RetentionPriority HIGH = new RetentionPriority('HIGH', 2);
3329 3338
3330 static const List<RetentionPriority> values = const [LOW, MEDIUM, HIGH]; 3339 static final List<RetentionPriority> values = [LOW, MEDIUM, HIGH];
3331 3340
3332 const RetentionPriority(String name, int ordinal) : super(name, ordinal); 3341 RetentionPriority(String name, int ordinal) : super(name, ordinal);
3333 } 3342 }
3334 3343
3335 /** 3344 /**
3336 * The interface `SourceEntry` defines the behavior of objects that maintain the information 3345 * The interface `SourceEntry` defines the behavior of objects that maintain the information
3337 * cached by an analysis context about an individual source, no matter what kind of source it is. 3346 * cached by an analysis context about an individual source, no matter what kind of source it is.
3338 * 3347 *
3339 * Source entries should be treated as if they were immutable unless a writable copy of the entry 3348 * Source entries should be treated as if they were immutable unless a writable copy of the entry
3340 * has been obtained and has not yet been made visible to other threads. 3349 * has been obtained and has not yet been made visible to other threads.
3341 */ 3350 */
3342 abstract class SourceEntry { 3351 abstract class SourceEntry {
3343 /** 3352 /**
3344 * The data descriptor representing the contents of the source. 3353 * The data descriptor representing the contents of the source.
3345 */ 3354 */
3346 static final DataDescriptor<String> CONTENT = new DataDescriptor<String>("Dart Entry.CONTENT"); 3355 static final DataDescriptor<String> CONTENT = new DataDescriptor<String>("Dart Entry.CONTENT");
3347 3356
3348 /** 3357 /**
3349 * The data descriptor representing the line information. 3358 * The data descriptor representing the line information.
3350 */ 3359 */
3351 static final DataDescriptor<LineInfo> LINE_INFO = new DataDescriptor<LineInfo> ("SourceEntry.LINE_INFO"); 3360 static final DataDescriptor<LineInfo> LINE_INFO = new DataDescriptor<LineInfo> ("SourceEntry.LINE_INFO");
3352 3361
3353 /** 3362 /**
3354 * Return the exception that caused one or more values to have a state of [Cac heState#ERROR] 3363 * Return the exception that caused one or more values to have a state of [Cac heState#ERROR]
3355 * . 3364 * .
3356 * 3365 *
3357 * @return the exception that caused one or more values to be uncomputable 3366 * @return the exception that caused one or more values to be uncomputable
3358 */ 3367 */
3359 AnalysisException get exception; 3368 AnalysisException get exception;
3360 3369
3361 /** 3370 /**
3362 * Return `true` if the source was explicitly added to the context or `false` if the
3363 * source was implicitly added because it was referenced by another source.
3364 *
3365 * @return `true` if the source was explicitly added to the context
3366 */
3367 bool get explicitlyAdded;
3368
3369 /**
3370 * Return the kind of the source, or `null` if the kind is not currently cache d. 3371 * Return the kind of the source, or `null` if the kind is not currently cache d.
3371 * 3372 *
3372 * @return the kind of the source 3373 * @return the kind of the source
3373 */ 3374 */
3374 SourceKind get kind; 3375 SourceKind get kind;
3375 3376
3376 /** 3377 /**
3377 * Return the most recent time at which the state of the source matched the st ate represented by 3378 * Return the most recent time at which the state of the source matched the st ate represented by
3378 * this entry. 3379 * this entry.
3379 * 3380 *
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
3412 * [SourceEntry]. 3413 * [SourceEntry].
3413 */ 3414 */
3414 abstract class SourceEntryImpl implements SourceEntry { 3415 abstract class SourceEntryImpl implements SourceEntry {
3415 /** 3416 /**
3416 * The most recent time at which the state of the source matched the state rep resented by this 3417 * The most recent time at which the state of the source matched the state rep resented by this
3417 * entry. 3418 * entry.
3418 */ 3419 */
3419 int _modificationTime = 0; 3420 int _modificationTime = 0;
3420 3421
3421 /** 3422 /**
3422 * A bit-encoding of boolean flags associated with this element.
3423 */
3424 int _flags = 0;
3425
3426 /**
3427 * The exception that caused one or more values to have a state of [CacheState #ERROR]. 3423 * The exception that caused one or more values to have a state of [CacheState #ERROR].
3428 */ 3424 */
3429 AnalysisException exception; 3425 AnalysisException exception;
3430 3426
3431 /** 3427 /**
3432 * The state of the cached content. 3428 * The state of the cached content.
3433 */ 3429 */
3434 CacheState _contentState = CacheState.INVALID; 3430 CacheState _contentState = CacheState.INVALID;
3435 3431
3436 /** 3432 /**
3437 * The content of the source, or `null` if the content is not currently cached . 3433 * The content of the source, or `null` if the content is not currently cached .
3438 */ 3434 */
3439 String _content; 3435 String _content;
3440 3436
3441 /** 3437 /**
3442 * The state of the cached line information. 3438 * The state of the cached line information.
3443 */ 3439 */
3444 CacheState _lineInfoState = CacheState.INVALID; 3440 CacheState _lineInfoState = CacheState.INVALID;
3445 3441
3446 /** 3442 /**
3447 * The line information computed for the source, or `null` if the line informa tion is not 3443 * The line information computed for the source, or `null` if the line informa tion is not
3448 * currently cached. 3444 * currently cached.
3449 */ 3445 */
3450 LineInfo _lineInfo; 3446 LineInfo _lineInfo;
3451 3447
3452 /** 3448 /**
3453 * The index of the flag indicating whether the source was explicitly added to the context or
3454 * whether the source was implicitly added because it was referenced by anothe r source.
3455 */
3456 static int _EXPLICITLY_ADDED_FLAG = 0;
3457
3458 /**
3459 * Fix the state of the [exception] to match the current state of the entry. 3449 * Fix the state of the [exception] to match the current state of the entry.
3460 */ 3450 */
3461 void fixExceptionState() { 3451 void fixExceptionState() {
3462 if (hasErrorState) { 3452 if (hasErrorState) {
3463 if (exception == null) { 3453 if (exception == null) {
3464 // 3454 //
3465 // This code should never be reached, but is a fail-safe in case an exce ption is not 3455 // This code should never be reached, but is a fail-safe in case an exce ption is not
3466 // recorded when it should be. 3456 // recorded when it should be.
3467 // 3457 //
3468 exception = new AnalysisException.con1("State set to ERROR without setti ng an exception"); 3458 exception = new AnalysisException.con1("State set to ERROR without setti ng an exception");
3469 } 3459 }
3470 } else { 3460 } else {
3471 exception = null; 3461 exception = null;
3472 } 3462 }
3473 } 3463 }
3474 3464
3475 /**
3476 * Return `true` if the source was explicitly added to the context or `false` if the
3477 * source was implicitly added because it was referenced by another source.
3478 *
3479 * @return `true` if the source was explicitly added to the context
3480 */
3481 @override
3482 bool get explicitlyAdded => getFlag(_EXPLICITLY_ADDED_FLAG);
3483
3484 @override 3465 @override
3485 int get modificationTime => _modificationTime; 3466 int get modificationTime => _modificationTime;
3486 3467
3487 @override 3468 @override
3488 CacheState getState(DataDescriptor descriptor) { 3469 CacheState getState(DataDescriptor descriptor) {
3489 if (identical(descriptor, SourceEntry.CONTENT)) { 3470 if (identical(descriptor, SourceEntry.CONTENT)) {
3490 return _contentState; 3471 return _contentState;
3491 } else if (identical(descriptor, SourceEntry.LINE_INFO)) { 3472 } else if (identical(descriptor, SourceEntry.LINE_INFO)) {
3492 return _lineInfoState; 3473 return _lineInfoState;
3493 } else { 3474 } else {
(...skipping 26 matching lines...) Expand all
3520 * Record that an error occurred while attempting to get the contents of the s ource represented by 3501 * Record that an error occurred while attempting to get the contents of the s ource represented by
3521 * this entry. This will set the state of all information, including any resol ution-based 3502 * this entry. This will set the state of all information, including any resol ution-based
3522 * information, as being in error. 3503 * information, as being in error.
3523 */ 3504 */
3524 void recordContentError() { 3505 void recordContentError() {
3525 _content = null; 3506 _content = null;
3526 _contentState = CacheState.ERROR; 3507 _contentState = CacheState.ERROR;
3527 } 3508 }
3528 3509
3529 /** 3510 /**
3530 * Set whether the source was explicitly added to the context to match the giv en value.
3531 *
3532 * @param explicitlyAdded `true` if the source was explicitly added to the con text
3533 */
3534 void set explicitlyAdded(bool explicitlyAdded) {
3535 setFlag(_EXPLICITLY_ADDED_FLAG, explicitlyAdded);
3536 }
3537
3538 /**
3539 * Set the most recent time at which the state of the source matched the state represented by this 3511 * Set the most recent time at which the state of the source matched the state represented by this
3540 * entry to the given time. 3512 * entry to the given time.
3541 * 3513 *
3542 * @param time the new modification time of this entry 3514 * @param time the new modification time of this entry
3543 */ 3515 */
3544 void set modificationTime(int time) { 3516 void set modificationTime(int time) {
3545 _modificationTime = time; 3517 _modificationTime = time;
3546 } 3518 }
3547 3519
3548 /** 3520 /**
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
3582 } 3554 }
3583 3555
3584 @override 3556 @override
3585 String toString() { 3557 String toString() {
3586 JavaStringBuilder builder = new JavaStringBuilder(); 3558 JavaStringBuilder builder = new JavaStringBuilder();
3587 writeOn(builder); 3559 writeOn(builder);
3588 return builder.toString(); 3560 return builder.toString();
3589 } 3561 }
3590 3562
3591 /** 3563 /**
3592 * Set the value of all of the flags with the given indexes to false.
3593 *
3594 * @param indexes the indexes of the flags whose value is to be set to false
3595 */
3596 void clearFlags(List<int> indexes) {
3597 for (int i = 0; i < indexes.length; i++) {
3598 _flags = BooleanArray.set(_flags, indexes[i], false);
3599 }
3600 }
3601
3602 /**
3603 * Copy the information from the given cache entry. 3564 * Copy the information from the given cache entry.
3604 * 3565 *
3605 * @param entry the cache entry from which information will be copied 3566 * @param entry the cache entry from which information will be copied
3606 */ 3567 */
3607 void copyFrom(SourceEntryImpl entry) { 3568 void copyFrom(SourceEntryImpl entry) {
3608 _modificationTime = entry._modificationTime; 3569 _modificationTime = entry._modificationTime;
3609 _flags = entry._flags;
3610 exception = entry.exception; 3570 exception = entry.exception;
3611 _contentState = entry._contentState; 3571 _contentState = entry._contentState;
3612 _content = entry._content; 3572 _content = entry._content;
3613 _lineInfoState = entry._lineInfoState; 3573 _lineInfoState = entry._lineInfoState;
3614 _lineInfo = entry._lineInfo; 3574 _lineInfo = entry._lineInfo;
3615 } 3575 }
3616 3576
3617 /** 3577 /**
3618 * Return the value of the flag with the given index.
3619 *
3620 * @param index the index of the flag whose value is to be returned
3621 * @return the value of the flag with the given index
3622 */
3623 bool getFlag(int index) => BooleanArray.get(_flags, index);
3624
3625 /**
3626 * Return `true` if the state of any data value is [CacheState#ERROR]. 3578 * Return `true` if the state of any data value is [CacheState#ERROR].
3627 * 3579 *
3628 * @return `true` if the state of any data value is [CacheState#ERROR] 3580 * @return `true` if the state of any data value is [CacheState#ERROR]
3629 */ 3581 */
3630 bool get hasErrorState => identical(_contentState, CacheState.ERROR) || identi cal(_lineInfoState, CacheState.ERROR); 3582 bool get hasErrorState => identical(_contentState, CacheState.ERROR) || identi cal(_lineInfoState, CacheState.ERROR);
3631 3583
3632 /** 3584 /**
3633 * Set the value of the flag with the given index to the given value.
3634 *
3635 * @param index the index of the flag whose value is to be returned
3636 * @param value the value of the flag with the given index
3637 */
3638 void setFlag(int index, bool value) {
3639 _flags = BooleanArray.set(_flags, index, value);
3640 }
3641
3642 /**
3643 * Given that some data is being transitioned to the given state, return the v alue that should be 3585 * Given that some data is being transitioned to the given state, return the v alue that should be
3644 * kept in the cache. 3586 * kept in the cache.
3645 * 3587 *
3646 * @param state the state to which the data is being transitioned 3588 * @param state the state to which the data is being transitioned
3647 * @param currentValue the value of the data before the transition 3589 * @param currentValue the value of the data before the transition
3648 * @param defaultValue the value to be used if the current value is to be remo ved from the cache 3590 * @param defaultValue the value to be used if the current value is to be remo ved from the cache
3649 * @return the value of the data that should be kept in the cache 3591 * @return the value of the data that should be kept in the cache
3650 */ 3592 */
3651 Object updatedValue(CacheState state, Object currentValue, Object defaultValue ) { 3593 Object updatedValue(CacheState state, Object currentValue, Object defaultValue ) {
3652 if (identical(state, CacheState.VALID)) { 3594 if (identical(state, CacheState.VALID)) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3721 if (identical(state, CacheState.ERROR)) { 3663 if (identical(state, CacheState.ERROR)) {
3722 AnalysisException exception = dartEntry.exception; 3664 AnalysisException exception = dartEntry.exception;
3723 if (exception != null) { 3665 if (exception != null) {
3724 _exceptions.add(exception); 3666 _exceptions.add(exception);
3725 } 3667 }
3726 } 3668 }
3727 } 3669 }
3728 } 3670 }
3729 3671
3730 class AnalysisContentStatisticsImpl_CacheRowImpl implements AnalysisContentStati stics_CacheRow { 3672 class AnalysisContentStatisticsImpl_CacheRowImpl implements AnalysisContentStati stics_CacheRow {
3731 final String name; 3673 String name;
3732 3674
3733 int _errorCount = 0; 3675 int _errorCount = 0;
3734 3676
3735 int _flushedCount = 0; 3677 int _flushedCount = 0;
3736 3678
3737 int _inProcessCount = 0; 3679 int _inProcessCount = 0;
3738 3680
3739 int _invalidCount = 0; 3681 int _invalidCount = 0;
3740 3682
3741 int _validCount = 0; 3683 int _validCount = 0;
3742 3684
3743 AnalysisContentStatisticsImpl_CacheRowImpl(this.name); 3685 AnalysisContentStatisticsImpl_CacheRowImpl(String name) {
3686 this.name = name;
3687 }
3744 3688
3745 @override 3689 @override
3746 bool operator ==(Object obj) => obj is AnalysisContentStatisticsImpl_CacheRowI mpl && obj.name == name; 3690 bool operator ==(Object obj) => obj is AnalysisContentStatisticsImpl_CacheRowI mpl && obj.name == name;
3747 3691
3748 @override 3692 @override
3749 int get errorCount => _errorCount; 3693 int get errorCount => _errorCount;
3750 3694
3751 @override 3695 @override
3752 int get flushedCount => _flushedCount; 3696 int get flushedCount => _flushedCount;
3753 3697
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
4838 _cache.remove(source); 4782 _cache.remove(source);
4839 } 4783 }
4840 dartCopy.exception = thrownException; 4784 dartCopy.exception = thrownException;
4841 _cache.put(source, dartCopy); 4785 _cache.put(source, dartCopy);
4842 if (source != librarySource) { 4786 if (source != librarySource) {
4843 _workManager.add(source, SourcePriority.PRIORITY_PART); 4787 _workManager.add(source, SourcePriority.PRIORITY_PART);
4844 } 4788 }
4845 if (source == unitSource) { 4789 if (source == unitSource) {
4846 unitEntry = dartCopy; 4790 unitEntry = dartCopy;
4847 } 4791 }
4848 ChangeNoticeImpl notice = _getNotice(source); 4792 if (_generateSdkErrors || !source.isInSystemLibrary) {
4849 notice.compilationUnit = unit; 4793 ChangeNoticeImpl notice = _getNotice(source);
4850 notice.setErrors(dartCopy.allErrors, lineInfo); 4794 notice.compilationUnit = unit;
4795 notice.setErrors(dartCopy.allErrors, lineInfo);
4796 }
4851 } 4797 }
4852 } 4798 }
4853 } else { 4799 } else {
4854 PrintStringWriter writer = new PrintStringWriter(); 4800 PrintStringWriter writer = new PrintStringWriter();
4855 writer.println("Library resolution results discarded for"); 4801 writer.println("Library resolution results discarded for");
4856 for (ResolvableLibrary library in resolvedLibraries) { 4802 for (ResolvableLibrary library in resolvedLibraries) {
4857 for (Source source in library.compilationUnitSources) { 4803 for (Source source in library.compilationUnitSources) {
4858 DartEntry dartEntry = _getReadableDartEntry(source); 4804 DartEntry dartEntry = _getReadableDartEntry(source);
4859 if (dartEntry != null) { 4805 if (dartEntry != null) {
4860 int resultTime = library.getModificationTime(source); 4806 int resultTime = library.getModificationTime(source);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
4963 _cache.remove(source); 4909 _cache.remove(source);
4964 } 4910 }
4965 dartCopy.exception = thrownException; 4911 dartCopy.exception = thrownException;
4966 _cache.put(source, dartCopy); 4912 _cache.put(source, dartCopy);
4967 if (source != librarySource) { 4913 if (source != librarySource) {
4968 _workManager.add(source, SourcePriority.PRIORITY_PART); 4914 _workManager.add(source, SourcePriority.PRIORITY_PART);
4969 } 4915 }
4970 if (source == unitSource) { 4916 if (source == unitSource) {
4971 unitEntry = dartCopy; 4917 unitEntry = dartCopy;
4972 } 4918 }
4973 ChangeNoticeImpl notice = _getNotice(source); 4919 if (_generateSdkErrors || !source.isInSystemLibrary) {
4974 notice.compilationUnit = unit; 4920 ChangeNoticeImpl notice = _getNotice(source);
4975 notice.setErrors(dartCopy.allErrors, lineInfo); 4921 notice.compilationUnit = unit;
4922 notice.setErrors(dartCopy.allErrors, lineInfo);
4923 }
4976 } 4924 }
4977 } 4925 }
4978 } else { 4926 } else {
4979 PrintStringWriter writer = new PrintStringWriter(); 4927 PrintStringWriter writer = new PrintStringWriter();
4980 writer.println("Library resolution results discarded for"); 4928 writer.println("Library resolution results discarded for");
4981 for (Library library in resolvedLibraries) { 4929 for (Library library in resolvedLibraries) {
4982 for (Source source in library.compilationUnitSources) { 4930 for (Source source in library.compilationUnitSources) {
4983 DartEntry dartEntry = _getReadableDartEntry(source); 4931 DartEntry dartEntry = _getReadableDartEntry(source);
4984 if (dartEntry != null) { 4932 if (dartEntry != null) {
4985 int resultTime = library.getModificationTime(source); 4933 int resultTime = library.getModificationTime(source);
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
5415 for (Source targetSource in targetSources) { 5363 for (Source targetSource in targetSources) {
5416 if (_contains(sources, targetSource)) { 5364 if (_contains(sources, targetSource)) {
5417 return true; 5365 return true;
5418 } 5366 }
5419 } 5367 }
5420 return false; 5368 return false;
5421 } 5369 }
5422 5370
5423 /** 5371 /**
5424 * Create a [GenerateDartErrorsTask] for the given source, marking the verific ation errors 5372 * Create a [GenerateDartErrorsTask] for the given source, marking the verific ation errors
5425 * as being in-process. The compilation unit and the library can be the same i f the compilation 5373 * as being in-process.
5426 * unit is the defining compilation unit of the library.
5427 * 5374 *
5428 * @param unitSource the source for the compilation unit to be verified 5375 * @param source the source whose content is to be verified
5429 * @param unitEntry the entry for the compilation unit 5376 * @param dartEntry the entry for the source
5430 * @param librarySource the source for the library containing the compilation unit 5377 * @param librarySource the source for the library containing the source
5431 * @param libraryEntry the entry for the library 5378 * @param libraryEntry the entry for the library
5432 * @return task data representing the created task 5379 * @return task data representing the created task
5433 */ 5380 */
5434 AnalysisContextImpl_TaskData _createGenerateDartErrorsTask(Source unitSource, DartEntry unitEntry, Source librarySource, DartEntry libraryEntry) { 5381 AnalysisContextImpl_TaskData _createGenerateDartErrorsTask(Source source, Dart Entry dartEntry, Source librarySource, SourceEntry libraryEntry) {
5435 if (unitEntry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource) != C acheState.VALID || libraryEntry.getState(DartEntry.ELEMENT) != CacheState.VALID) { 5382 if (dartEntry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource) != C acheState.VALID || libraryEntry.getState(DartEntry.ELEMENT) != CacheState.VALID) {
5436 return _createResolveDartLibraryTask(librarySource, libraryEntry);
5437 } 5383 }
5438 CompilationUnit unit = unitEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource); 5384 CompilationUnit unit = dartEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource);
5439 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT); 5385 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT);
5440 DartEntryImpl dartCopy = unitEntry.writableCopy; 5386 DartEntryImpl dartCopy = dartEntry.writableCopy;
5441 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, Cac heState.IN_PROCESS); 5387 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, Cac heState.IN_PROCESS);
5442 _cache.put(unitSource, dartCopy); 5388 _cache.put(source, dartCopy);
5443 return new AnalysisContextImpl_TaskData(new GenerateDartErrorsTask(this, uni tSource, dartCopy.modificationTime, unit, libraryElement), false); 5389 return new AnalysisContextImpl_TaskData(new GenerateDartErrorsTask(this, sou rce, dartCopy.modificationTime, unit, libraryElement), false);
5444 } 5390 }
5445 5391
5446 /** 5392 /**
5447 * Create a [GenerateDartHintsTask] for the given source, marking the hints as being 5393 * Create a [GenerateDartHintsTask] for the given source, marking the hints as being
5448 * in-process. 5394 * in-process.
5449 * 5395 *
5450 * @param source the source whose content is to be verified 5396 * @param source the source whose content is to be verified
5451 * @param dartEntry the entry for the source 5397 * @param dartEntry the entry for the source
5452 * @param librarySource the source for the library containing the source 5398 * @param librarySource the source for the library containing the source
5453 * @param libraryEntry the entry for the library 5399 * @param libraryEntry the entry for the library
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
5632 dartCopy.setState(DartEntry.SCAN_ERRORS, CacheState.IN_PROCESS); 5578 dartCopy.setState(DartEntry.SCAN_ERRORS, CacheState.IN_PROCESS);
5633 _cache.put(source, dartCopy); 5579 _cache.put(source, dartCopy);
5634 return new AnalysisContextImpl_TaskData(new ScanDartTask(this, source, dartC opy.modificationTime, content), false); 5580 return new AnalysisContextImpl_TaskData(new ScanDartTask(this, source, dartC opy.modificationTime, content), false);
5635 } 5581 }
5636 5582
5637 /** 5583 /**
5638 * Create a source information object suitable for the given source. Return th e source information 5584 * Create a source information object suitable for the given source. Return th e source information
5639 * object that was created, or `null` if the source should not be tracked by t his context. 5585 * object that was created, or `null` if the source should not be tracked by t his context.
5640 * 5586 *
5641 * @param source the source for which an information object is being created 5587 * @param source the source for which an information object is being created
5642 * @param explicitlyAdded `true` if the source was explicitly added to the con text
5643 * @return the source information object that was created 5588 * @return the source information object that was created
5644 */ 5589 */
5645 SourceEntry _createSourceEntry(Source source, bool explicitlyAdded) { 5590 SourceEntry _createSourceEntry(Source source) {
5646 String name = source.shortName; 5591 String name = source.shortName;
5647 if (AnalysisEngine.isHtmlFileName(name)) { 5592 if (AnalysisEngine.isHtmlFileName(name)) {
5648 HtmlEntryImpl htmlEntry = new HtmlEntryImpl(); 5593 HtmlEntryImpl htmlEntry = new HtmlEntryImpl();
5649 htmlEntry.modificationTime = getModificationStamp(source); 5594 htmlEntry.modificationTime = getModificationStamp(source);
5650 htmlEntry.explicitlyAdded = explicitlyAdded;
5651 _cache.put(source, htmlEntry); 5595 _cache.put(source, htmlEntry);
5652 return htmlEntry; 5596 return htmlEntry;
5653 } else { 5597 } else {
5654 DartEntryImpl dartEntry = new DartEntryImpl(); 5598 DartEntryImpl dartEntry = new DartEntryImpl();
5655 dartEntry.modificationTime = getModificationStamp(source); 5599 dartEntry.modificationTime = getModificationStamp(source);
5656 dartEntry.explicitlyAdded = explicitlyAdded;
5657 _cache.put(source, dartEntry); 5600 _cache.put(source, dartEntry);
5658 return dartEntry; 5601 return dartEntry;
5659 } 5602 }
5660 } 5603 }
5661 5604
5662 /** 5605 /**
5663 * Return a string with debugging information about the given source (the full name and 5606 * Return a string with debugging information about the given source (the full name and
5664 * modification stamp of the source). 5607 * modification stamp of the source).
5665 * 5608 *
5666 * @param source the source for which a debugging string is to be produced 5609 * @param source the source for which a debugging string is to be produced
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
6102 if (identical(kind, SourceKind.UNKNOWN)) { 6045 if (identical(kind, SourceKind.UNKNOWN)) {
6103 return _createParseDartTask(source, dartEntry); 6046 return _createParseDartTask(source, dartEntry);
6104 } else if (identical(kind, SourceKind.LIBRARY)) { 6047 } else if (identical(kind, SourceKind.LIBRARY)) {
6105 CacheState elementState = dartEntry.getState(DartEntry.ELEMENT); 6048 CacheState elementState = dartEntry.getState(DartEntry.ELEMENT);
6106 if (identical(elementState, CacheState.INVALID)) { 6049 if (identical(elementState, CacheState.INVALID)) {
6107 return _createResolveDartLibraryTask(source, dartEntry); 6050 return _createResolveDartLibraryTask(source, dartEntry);
6108 } 6051 }
6109 } 6052 }
6110 List<Source> librariesContaining = dartEntry.getValue(DartEntry.CONTAINING _LIBRARIES); 6053 List<Source> librariesContaining = dartEntry.getValue(DartEntry.CONTAINING _LIBRARIES);
6111 for (Source librarySource in librariesContaining) { 6054 for (Source librarySource in librariesContaining) {
6112 SourceEntry librarySourceEntry = _cache.get(librarySource); 6055 SourceEntry libraryEntry = _cache.get(librarySource);
6113 if (librarySourceEntry is DartEntry) { 6056 if (libraryEntry is DartEntry) {
6114 DartEntry libraryEntry = librarySourceEntry;
6115 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT); 6057 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT);
6116 if (identical(elementState, CacheState.INVALID) || (isPriority && iden tical(elementState, CacheState.FLUSHED))) { 6058 if (identical(elementState, CacheState.INVALID) || (isPriority && iden tical(elementState, CacheState.FLUSHED))) {
6117 //return createResolveDartLibraryTask(librarySource, (DartEntry) lib raryEntry); 6059 //return createResolveDartLibraryTask(librarySource, (DartEntry) lib raryEntry);
6118 DartEntryImpl libraryCopy = libraryEntry.writableCopy; 6060 DartEntryImpl libraryCopy = libraryEntry.writableCopy;
6119 libraryCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS); 6061 libraryCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS);
6120 _cache.put(librarySource, libraryCopy); 6062 _cache.put(librarySource, libraryCopy);
6121 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryTask(t his, source, librarySource), false); 6063 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryTask(t his, source, librarySource), false);
6122 } 6064 }
6123 CacheState resolvedUnitState = dartEntry.getStateInLibrary(DartEntry.R ESOLVED_UNIT, librarySource); 6065 CacheState resolvedUnitState = dartEntry.getStateInLibrary(DartEntry.R ESOLVED_UNIT, librarySource);
6124 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && identical(resolvedUnitState, CacheState.FLUSHED))) { 6066 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && identical(resolvedUnitState, CacheState.FLUSHED))) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
6204 /** 6146 /**
6205 * Return the cache entry associated with the given source, or `null` if the s ource is not a 6147 * Return the cache entry associated with the given source, or `null` if the s ource is not a
6206 * Dart file. 6148 * Dart file.
6207 * 6149 *
6208 * @param source the source for which a cache entry is being sought 6150 * @param source the source for which a cache entry is being sought
6209 * @return the source cache entry associated with the given source 6151 * @return the source cache entry associated with the given source
6210 */ 6152 */
6211 DartEntry _getReadableDartEntry(Source source) { 6153 DartEntry _getReadableDartEntry(Source source) {
6212 SourceEntry sourceEntry = _cache.get(source); 6154 SourceEntry sourceEntry = _cache.get(source);
6213 if (sourceEntry == null) { 6155 if (sourceEntry == null) {
6214 sourceEntry = _createSourceEntry(source, false); 6156 sourceEntry = _createSourceEntry(source);
6215 } 6157 }
6216 if (sourceEntry is DartEntry) { 6158 if (sourceEntry is DartEntry) {
6217 return sourceEntry as DartEntry; 6159 return sourceEntry as DartEntry;
6218 } 6160 }
6219 return null; 6161 return null;
6220 } 6162 }
6221 6163
6222 /** 6164 /**
6223 * Return the cache entry associated with the given source, or `null` if the s ource is not 6165 * Return the cache entry associated with the given source, or `null` if the s ource is not
6224 * an HTML file. 6166 * an HTML file.
6225 * 6167 *
6226 * @param source the source for which a cache entry is being sought 6168 * @param source the source for which a cache entry is being sought
6227 * @return the source cache entry associated with the given source 6169 * @return the source cache entry associated with the given source
6228 */ 6170 */
6229 HtmlEntry _getReadableHtmlEntry(Source source) { 6171 HtmlEntry _getReadableHtmlEntry(Source source) {
6230 SourceEntry sourceEntry = _cache.get(source); 6172 SourceEntry sourceEntry = _cache.get(source);
6231 if (sourceEntry == null) { 6173 if (sourceEntry == null) {
6232 sourceEntry = _createSourceEntry(source, false); 6174 sourceEntry = _createSourceEntry(source);
6233 } 6175 }
6234 if (sourceEntry is HtmlEntry) { 6176 if (sourceEntry is HtmlEntry) {
6235 return sourceEntry as HtmlEntry; 6177 return sourceEntry as HtmlEntry;
6236 } 6178 }
6237 return null; 6179 return null;
6238 } 6180 }
6239 6181
6240 /** 6182 /**
6241 * Return the cache entry associated with the given source, creating it if nec essary. 6183 * Return the cache entry associated with the given source, creating it if nec essary.
6242 * 6184 *
6243 * @param source the source for which a cache entry is being sought 6185 * @param source the source for which a cache entry is being sought
6244 * @return the source cache entry associated with the given source 6186 * @return the source cache entry associated with the given source
6245 */ 6187 */
6246 SourceEntry _getReadableSourceEntry(Source source) { 6188 SourceEntry _getReadableSourceEntry(Source source) {
6247 SourceEntry sourceEntry = _cache.get(source); 6189 SourceEntry sourceEntry = _cache.get(source);
6248 if (sourceEntry == null) { 6190 if (sourceEntry == null) {
6249 sourceEntry = _createSourceEntry(source, false); 6191 sourceEntry = _createSourceEntry(source);
6250 } 6192 }
6251 return sourceEntry; 6193 return sourceEntry;
6252 } 6194 }
6253 6195
6254 /** 6196 /**
6255 * Return the cache entry associated with the given source, or `null` if there is no entry 6197 * Return the cache entry associated with the given source, or `null` if there is no entry
6256 * associated with the source. 6198 * associated with the source.
6257 * 6199 *
6258 * @param source the source for which a cache entry is being sought 6200 * @param source the source for which a cache entry is being sought
6259 * @return the source cache entry associated with the given source 6201 * @return the source cache entry associated with the given source
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
6398 } 6340 }
6399 } 6341 }
6400 } 6342 }
6401 6343
6402 /** 6344 /**
6403 * Invalidate all of the resolution results computed by this context. 6345 * Invalidate all of the resolution results computed by this context.
6404 * 6346 *
6405 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 6347 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
6406 */ 6348 */
6407 void _invalidateAllResolutionInformation() { 6349 void _invalidateAllResolutionInformation() {
6408 Map<Source, List<Source>> oldPartMap = new Map<Source, List<Source>>();
6409 for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) { 6350 for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) {
6410 Source source = mapEntry.getKey(); 6351 Source source = mapEntry.getKey();
6411 SourceEntry sourceEntry = mapEntry.getValue(); 6352 SourceEntry sourceEntry = mapEntry.getValue();
6412 if (sourceEntry is HtmlEntry) { 6353 if (sourceEntry is HtmlEntry) {
6413 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy; 6354 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy;
6414 htmlCopy.invalidateAllResolutionInformation(); 6355 htmlCopy.invalidateAllResolutionInformation();
6415 mapEntry.setValue(htmlCopy); 6356 mapEntry.setValue(htmlCopy);
6416 } else if (sourceEntry is DartEntry) { 6357 } else if (sourceEntry is DartEntry) {
6417 DartEntry dartEntry = sourceEntry; 6358 DartEntry dartEntry = sourceEntry;
6418 oldPartMap[source] = dartEntry.getValue(DartEntry.INCLUDED_PARTS); 6359 _removeFromParts(source, dartEntry);
6419 DartEntryImpl dartCopy = dartEntry.writableCopy; 6360 DartEntryImpl dartCopy = dartEntry.writableCopy;
6420 dartCopy.invalidateAllResolutionInformation(); 6361 dartCopy.invalidateAllResolutionInformation();
6421 mapEntry.setValue(dartCopy); 6362 mapEntry.setValue(dartCopy);
6422 _workManager.add(source, SourcePriority.UNKNOWN); 6363 _workManager.add(source, SourcePriority.UNKNOWN);
6423 } 6364 }
6424 } 6365 }
6425 _removeFromPartsUsingMap(oldPartMap);
6426 } 6366 }
6427 6367
6428 /** 6368 /**
6429 * In response to a change to Angular entry point [HtmlElement], invalidate an y results that 6369 * In response to a change to Angular entry point [HtmlElement], invalidate an y results that
6430 * depend on it. 6370 * depend on it.
6431 * 6371 *
6432 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 6372 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
6433 * 6373 *
6434 * <b>Note:</b> Any cache entries that were accessed before this method was in voked must be 6374 * <b>Note:</b> Any cache entries that were accessed before this method was in voked must be
6435 * re-accessed after this method returns. 6375 * re-accessed after this method returns.
(...skipping 26 matching lines...) Expand all
6462 } 6402 }
6463 } 6403 }
6464 // reset Dart sources 6404 // reset Dart sources
6465 List<Source> oldElementSources = application.elementSources; 6405 List<Source> oldElementSources = application.elementSources;
6466 for (Source elementSource in oldElementSources) { 6406 for (Source elementSource in oldElementSources) {
6467 DartEntry dartEntry = _getReadableDartEntry(elementSource); 6407 DartEntry dartEntry = _getReadableDartEntry(elementSource);
6468 DartEntryImpl dartCopy = dartEntry.writableCopy; 6408 DartEntryImpl dartCopy = dartEntry.writableCopy;
6469 dartCopy.setValue(DartEntry.ANGULAR_ERRORS, AnalysisError.NO_ERRORS); 6409 dartCopy.setValue(DartEntry.ANGULAR_ERRORS, AnalysisError.NO_ERRORS);
6470 _cache.put(elementSource, dartCopy); 6410 _cache.put(elementSource, dartCopy);
6471 // notify about (disappeared) Angular errors 6411 // notify about (disappeared) Angular errors
6472 ChangeNoticeImpl notice = _getNotice(elementSource); 6412 if (_generateSdkErrors || !elementSource.isInSystemLibrary) {
6473 notice.setErrors(dartCopy.allErrors, dartEntry.getValue(SourceEntry.LINE_I NFO)); 6413 ChangeNoticeImpl notice = _getNotice(elementSource);
6414 notice.setErrors(dartCopy.allErrors, dartEntry.getValue(SourceEntry.LINE _INFO));
6415 }
6474 } 6416 }
6475 } 6417 }
6476 6418
6477 /** 6419 /**
6478 * In response to a change to at least one of the compilation units in the giv en library, 6420 * In response to a change to at least one of the compilation units in the giv en library,
6479 * invalidate any results that are dependent on the result of resolving that l ibrary. 6421 * invalidate any results that are dependent on the result of resolving that l ibrary.
6480 * 6422 *
6481 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 6423 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
6482 * 6424 *
6483 * <b>Note:</b> Any cache entries that were accessed before this method was in voked must be 6425 * <b>Note:</b> Any cache entries that were accessed before this method was in voked must be
6484 * re-accessed after this method returns. 6426 * re-accessed after this method returns.
6485 * 6427 *
6486 * @param librarySource the source of the library being invalidated 6428 * @param librarySource the source of the library being invalidated
6429 * @param writer the writer to which debugging information should be written
6487 */ 6430 */
6488 void _invalidateLibraryResolution(Source librarySource) { 6431 void _invalidateLibraryResolution(Source librarySource, PrintStringWriter writ er) {
6489 // TODO(brianwilkerson) This could be optimized. There's no need to flush al l of these entries 6432 // TODO(brianwilkerson) This could be optimized. There's no need to flush al l of these caches if
6490 // if the public namespace hasn't changed, which will be a fairly common cas e. The question is 6433 // the public namespace hasn't changed, which will be a fairly common case. The question is
6491 // whether we can afford the time to compute the namespace to look for diffe rences. 6434 // whether we can afford the time to compute the namespace to look for diffe rences.
6492 DartEntry libraryEntry = _getReadableDartEntry(librarySource); 6435 DartEntry libraryEntry = _getReadableDartEntry(librarySource);
6493 if (libraryEntry != null) { 6436 if (libraryEntry != null) {
6494 List<Source> includedParts = libraryEntry.getValue(DartEntry.INCLUDED_PART S); 6437 List<Source> includedParts = libraryEntry.getValue(DartEntry.INCLUDED_PART S);
6495 DartEntryImpl libraryCopy = libraryEntry.writableCopy; 6438 DartEntryImpl libraryCopy = libraryEntry.writableCopy;
6439 // long oldTime = libraryCopy.getModificationTime();
6496 libraryCopy.invalidateAllResolutionInformation(); 6440 libraryCopy.invalidateAllResolutionInformation();
6497 _cache.put(librarySource, libraryCopy); 6441 _cache.put(librarySource, libraryCopy);
6498 _workManager.add(librarySource, SourcePriority.LIBRARY); 6442 _workManager.add(librarySource, SourcePriority.LIBRARY);
6443 // if (writer != null) {
6444 // writer.println(" Invalidated library source: " + debuggingStrin g(librarySource)
6445 // + " (previously modified at " + oldTime + ")");
6446 // }
6499 for (Source partSource in includedParts) { 6447 for (Source partSource in includedParts) {
6500 SourceEntry partEntry = _cache.get(partSource); 6448 SourceEntry partEntry = _cache.get(partSource);
6501 if (partEntry is DartEntry) { 6449 if (partEntry is DartEntry) {
6502 DartEntryImpl partCopy = partEntry.writableCopy; 6450 DartEntryImpl partCopy = partEntry.writableCopy;
6451 // oldTime = partCopy.getModificationTime();
6452 if (partEntry != libraryCopy) {
6453 partCopy.removeContainingLibrary(librarySource);
6454 _workManager.add(librarySource, SourcePriority.NORMAL_PART);
6455 }
6503 partCopy.invalidateAllResolutionInformation(); 6456 partCopy.invalidateAllResolutionInformation();
6504 _cache.put(partSource, partCopy); 6457 _cache.put(partSource, partCopy);
6505 } 6458 }
6506 } 6459 }
6507 } 6460 }
6508 // invalidate Angular applications 6461 // invalidate Angular applications
6509 List<AngularApplication> angularApplicationsCopy = []; 6462 List<AngularApplication> angularApplicationsCopy = [];
6510 for (AngularApplication application in angularApplicationsCopy) { 6463 for (AngularApplication application in angularApplicationsCopy) {
6511 if (application.dependsOn(librarySource)) { 6464 if (application.dependsOn(librarySource)) {
6512 Source entryPointSource = application.entryPoint; 6465 Source entryPointSource = application.entryPoint;
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
6602 } 6555 }
6603 } 6556 }
6604 // update Dart sources errors 6557 // update Dart sources errors
6605 List<Source> newElementSources = application.elementSources; 6558 List<Source> newElementSources = application.elementSources;
6606 for (Source elementSource in newElementSources) { 6559 for (Source elementSource in newElementSources) {
6607 DartEntry dartEntry = _getReadableDartEntry(elementSource); 6560 DartEntry dartEntry = _getReadableDartEntry(elementSource);
6608 DartEntryImpl dartCopy = dartEntry.writableCopy; 6561 DartEntryImpl dartCopy = dartEntry.writableCopy;
6609 dartCopy.setValue(DartEntry.ANGULAR_ERRORS, task.getErrors(elementSource )); 6562 dartCopy.setValue(DartEntry.ANGULAR_ERRORS, task.getErrors(elementSource ));
6610 _cache.put(elementSource, dartCopy); 6563 _cache.put(elementSource, dartCopy);
6611 // notify about Dart errors 6564 // notify about Dart errors
6612 ChangeNoticeImpl notice = _getNotice(elementSource); 6565 if (_generateSdkErrors || !elementSource.isInSystemLibrary) {
6613 notice.setErrors(dartCopy.allErrors, computeLineInfo(elementSource)); 6566 ChangeNoticeImpl notice = _getNotice(elementSource);
6567 notice.setErrors(dartCopy.allErrors, computeLineInfo(elementSource));
6568 }
6614 } 6569 }
6615 } 6570 }
6616 // remember Angular entry point 6571 // remember Angular entry point
6617 entry.setValue(HtmlEntry.ANGULAR_ENTRY, application); 6572 entry.setValue(HtmlEntry.ANGULAR_ENTRY, application);
6618 } 6573 }
6619 6574
6620 /** 6575 /**
6621 * Given a cache entry and a library element, record the library element and o ther information 6576 * Given a cache entry and a library element, record the library element and o ther information
6622 * gleaned from the element in the cache entry. 6577 * gleaned from the element in the cache entry.
6623 * 6578 *
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
6662 // The source has changed without the context being notified. Simulate n otification. 6617 // The source has changed without the context being notified. Simulate n otification.
6663 _sourceChanged(source); 6618 _sourceChanged(source);
6664 dartEntry = _getReadableDartEntry(source); 6619 dartEntry = _getReadableDartEntry(source);
6665 if (dartEntry == null) { 6620 if (dartEntry == null) {
6666 throw new AnalysisException.con1("A Dart file became a non-Dart file: ${source.fullName}"); 6621 throw new AnalysisException.con1("A Dart file became a non-Dart file: ${source.fullName}");
6667 } 6622 }
6668 } 6623 }
6669 DartEntryImpl dartCopy = dartEntry.writableCopy; 6624 DartEntryImpl dartCopy = dartEntry.writableCopy;
6670 if (thrownException == null) { 6625 if (thrownException == null) {
6671 dartCopy.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, task.errors); 6626 dartCopy.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, task.errors);
6672 ChangeNoticeImpl notice = _getNotice(source); 6627 if (_generateSdkErrors || !source.isInSystemLibrary) {
6673 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LINE_ INFO)); 6628 ChangeNoticeImpl notice = _getNotice(source);
6629 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LIN E_INFO));
6630 }
6674 } else { 6631 } else {
6675 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, CacheState.ERROR); 6632 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, CacheState.ERROR);
6676 } 6633 }
6677 dartCopy.exception = thrownException; 6634 dartCopy.exception = thrownException;
6678 _cache.put(source, dartCopy); 6635 _cache.put(source, dartCopy);
6679 dartEntry = dartCopy; 6636 dartEntry = dartCopy;
6680 } else { 6637 } else {
6681 _logInformation2("Generated errors discarded for ${_debuggingString(source )}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEn try.modificationTime}", thrownException); 6638 _logInformation2("Generated errors discarded for ${_debuggingString(source )}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEn try.modificationTime}", thrownException);
6682 DartEntryImpl dartCopy = dartEntry.writableCopy; 6639 DartEntryImpl dartCopy = dartEntry.writableCopy;
6683 if (thrownException == null || resultTime >= 0) { 6640 if (thrownException == null || resultTime >= 0) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
6762 // The source has changed without the context being notified. Simulate notification. 6719 // The source has changed without the context being notified. Simulate notification.
6763 _sourceChanged(unitSource); 6720 _sourceChanged(unitSource);
6764 dartEntry = _getReadableDartEntry(unitSource); 6721 dartEntry = _getReadableDartEntry(unitSource);
6765 if (dartEntry == null) { 6722 if (dartEntry == null) {
6766 throw new AnalysisException.con1("A Dart file became a non-Dart file : ${unitSource.fullName}"); 6723 throw new AnalysisException.con1("A Dart file became a non-Dart file : ${unitSource.fullName}");
6767 } 6724 }
6768 } 6725 }
6769 DartEntryImpl dartCopy = dartEntry.writableCopy; 6726 DartEntryImpl dartCopy = dartEntry.writableCopy;
6770 if (thrownException == null) { 6727 if (thrownException == null) {
6771 dartCopy.setValueInLibrary(DartEntry.HINTS, librarySource, results.dat a); 6728 dartCopy.setValueInLibrary(DartEntry.HINTS, librarySource, results.dat a);
6772 ChangeNoticeImpl notice = _getNotice(unitSource); 6729 if (_generateSdkErrors || !unitSource.isInSystemLibrary) {
6773 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LIN E_INFO)); 6730 ChangeNoticeImpl notice = _getNotice(unitSource);
6731 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.L INE_INFO));
6732 }
6774 } else { 6733 } else {
6775 dartCopy.setStateInLibrary(DartEntry.HINTS, librarySource, CacheState. ERROR); 6734 dartCopy.setStateInLibrary(DartEntry.HINTS, librarySource, CacheState. ERROR);
6776 } 6735 }
6777 dartCopy.exception = thrownException; 6736 dartCopy.exception = thrownException;
6778 _cache.put(unitSource, dartCopy); 6737 _cache.put(unitSource, dartCopy);
6779 dartEntry = dartCopy; 6738 dartEntry = dartCopy;
6780 } else { 6739 } else {
6781 _logInformation2("Generated hints discarded for ${_debuggingString(unitS ource)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${d artEntry.modificationTime}", thrownException); 6740 _logInformation2("Generated hints discarded for ${_debuggingString(unitS ource)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${d artEntry.modificationTime}", thrownException);
6782 if (identical(dartEntry.getStateInLibrary(DartEntry.HINTS, librarySource ), CacheState.IN_PROCESS)) { 6741 if (identical(dartEntry.getStateInLibrary(DartEntry.HINTS, librarySource ), CacheState.IN_PROCESS)) {
6783 DartEntryImpl dartCopy = dartEntry.writableCopy; 6742 DartEntryImpl dartCopy = dartEntry.writableCopy;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
6850 /** 6809 /**
6851 * Record the results produced by performing a [IncrementalAnalysisTask]. 6810 * Record the results produced by performing a [IncrementalAnalysisTask].
6852 * 6811 *
6853 * @param task the task that was performed 6812 * @param task the task that was performed
6854 * @return an entry containing the computed results 6813 * @return an entry containing the computed results
6855 * @throws AnalysisException if the results could not be recorded 6814 * @throws AnalysisException if the results could not be recorded
6856 */ 6815 */
6857 DartEntry _recordIncrementalAnalysisTaskResults(IncrementalAnalysisTask task) { 6816 DartEntry _recordIncrementalAnalysisTaskResults(IncrementalAnalysisTask task) {
6858 CompilationUnit unit = task.compilationUnit; 6817 CompilationUnit unit = task.compilationUnit;
6859 if (unit != null) { 6818 if (unit != null) {
6860 ChangeNoticeImpl notice = _getNotice(task.source); 6819 if (_generateSdkErrors || !task.source.isInSystemLibrary) {
6861 notice.compilationUnit = unit; 6820 ChangeNoticeImpl notice = _getNotice(task.source);
6821 notice.compilationUnit = unit;
6822 }
6862 _incrementalAnalysisCache = IncrementalAnalysisCache.cacheResult(task.cach e, unit); 6823 _incrementalAnalysisCache = IncrementalAnalysisCache.cacheResult(task.cach e, unit);
6863 } 6824 }
6864 return null; 6825 return null;
6865 } 6826 }
6866 6827
6867 /** 6828 /**
6868 * Record the results produced by performing a [ParseDartTask]. If the results were computed 6829 * Record the results produced by performing a [ParseDartTask]. If the results were computed
6869 * from data that is now out-of-date, then the results will not be recorded. 6830 * from data that is now out-of-date, then the results will not be recorded.
6870 * 6831 *
6871 * @param task the task that was performed 6832 * @param task the task that was performed
(...skipping 20 matching lines...) Expand all
6892 // The source has changed without the context being notified. Simulate n otification. 6853 // The source has changed without the context being notified. Simulate n otification.
6893 _sourceChanged(source); 6854 _sourceChanged(source);
6894 dartEntry = _getReadableDartEntry(source); 6855 dartEntry = _getReadableDartEntry(source);
6895 if (dartEntry == null) { 6856 if (dartEntry == null) {
6896 throw new AnalysisException.con1("A Dart file became a non-Dart file: ${source.fullName}"); 6857 throw new AnalysisException.con1("A Dart file became a non-Dart file: ${source.fullName}");
6897 } 6858 }
6898 } 6859 }
6899 _removeFromParts(source, dartEntry); 6860 _removeFromParts(source, dartEntry);
6900 DartEntryImpl dartCopy = dartEntry.writableCopy; 6861 DartEntryImpl dartCopy = dartEntry.writableCopy;
6901 if (thrownException == null) { 6862 if (thrownException == null) {
6902 if (task.hasNonPartOfDirective) { 6863 if (task.hasPartOfDirective && !task.hasLibraryDirective) {
6903 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY);
6904 dartCopy.containingLibrary = source;
6905 _workManager.add(source, SourcePriority.LIBRARY);
6906 } else if (task.hasPartOfDirective) {
6907 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.PART); 6864 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.PART);
6908 dartCopy.removeContainingLibrary(source); 6865 dartCopy.removeContainingLibrary(source);
6909 _workManager.add(source, SourcePriority.NORMAL_PART); 6866 _workManager.add(source, SourcePriority.NORMAL_PART);
6910 } else { 6867 } else {
6911 // The file contains no directives. 6868 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY);
6912 List<Source> containingLibraries = dartCopy.containingLibraries; 6869 dartCopy.containingLibrary = source;
6913 if (containingLibraries.length > 1 || (containingLibraries.length == 1 && containingLibraries[0] != source)) { 6870 _workManager.add(source, SourcePriority.LIBRARY);
6914 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.PART);
6915 dartCopy.removeContainingLibrary(source);
6916 _workManager.add(source, SourcePriority.NORMAL_PART);
6917 } else {
6918 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY);
6919 dartCopy.containingLibrary = source;
6920 _workManager.add(source, SourcePriority.LIBRARY);
6921 }
6922 } 6871 }
6923 List<Source> newParts = task.includedSources; 6872 List<Source> newParts = task.includedSources;
6924 for (int i = 0; i < newParts.length; i++) { 6873 for (int i = 0; i < newParts.length; i++) {
6925 Source partSource = newParts[i]; 6874 Source partSource = newParts[i];
6926 DartEntry partEntry = _getReadableDartEntry(partSource); 6875 DartEntry partEntry = _getReadableDartEntry(partSource);
6927 if (partEntry != null && partEntry != dartEntry) { 6876 if (partEntry != null && partEntry != dartEntry) {
6928 DartEntryImpl partCopy = partEntry.writableCopy; 6877 DartEntryImpl partCopy = partEntry.writableCopy;
6929 // TODO(brianwilkerson) Change the kind of the "part" if it was mark ed as a library
6930 // and it has no directives.
6931 partCopy.addContainingLibrary(source); 6878 partCopy.addContainingLibrary(source);
6932 _cache.put(partSource, partCopy); 6879 _cache.put(partSource, partCopy);
6933 } 6880 }
6934 } 6881 }
6935 dartCopy.setValue(DartEntry.PARSED_UNIT, task.compilationUnit); 6882 dartCopy.setValue(DartEntry.PARSED_UNIT, task.compilationUnit);
6936 dartCopy.setValue(DartEntry.PARSE_ERRORS, task.errors); 6883 dartCopy.setValue(DartEntry.PARSE_ERRORS, task.errors);
6937 dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, task.exportedSources); 6884 dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, task.exportedSources);
6938 dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources); 6885 dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources);
6939 dartCopy.setValue(DartEntry.INCLUDED_PARTS, newParts); 6886 dartCopy.setValue(DartEntry.INCLUDED_PARTS, newParts);
6940 _cache.storedAst(source); 6887 _cache.storedAst(source);
6941 ChangeNoticeImpl notice = _getNotice(source); 6888 if (_generateSdkErrors || !source.isInSystemLibrary) {
6942 notice.setErrors(dartCopy.allErrors, task.lineInfo); 6889 ChangeNoticeImpl notice = _getNotice(source);
6890 notice.setErrors(dartCopy.allErrors, task.lineInfo);
6891 }
6943 // Verify that the incrementally parsed and resolved unit in the increme ntal cache 6892 // Verify that the incrementally parsed and resolved unit in the increme ntal cache
6944 // is structurally equivalent to the fully parsed unit 6893 // is structurally equivalent to the fully parsed unit
6945 _incrementalAnalysisCache = IncrementalAnalysisCache.verifyStructure(_in crementalAnalysisCache, source, task.compilationUnit); 6894 _incrementalAnalysisCache = IncrementalAnalysisCache.verifyStructure(_in crementalAnalysisCache, source, task.compilationUnit);
6946 } else { 6895 } else {
6947 _removeFromParts(source, dartEntry); 6896 _removeFromParts(source, dartEntry);
6948 dartCopy.recordParseError(); 6897 dartCopy.recordParseError();
6949 _cache.removedAst(source); 6898 _cache.removedAst(source);
6950 } 6899 }
6951 dartCopy.exception = thrownException; 6900 dartCopy.exception = thrownException;
6952 _cache.put(source, dartCopy); 6901 _cache.put(source, dartCopy);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
7017 } 6966 }
7018 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy; 6967 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy;
7019 if (thrownException == null) { 6968 if (thrownException == null) {
7020 LineInfo lineInfo = task.lineInfo; 6969 LineInfo lineInfo = task.lineInfo;
7021 ht.HtmlUnit unit = task.htmlUnit; 6970 ht.HtmlUnit unit = task.htmlUnit;
7022 htmlCopy.setValue(SourceEntry.LINE_INFO, lineInfo); 6971 htmlCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
7023 htmlCopy.setValue(HtmlEntry.PARSED_UNIT, unit); 6972 htmlCopy.setValue(HtmlEntry.PARSED_UNIT, unit);
7024 htmlCopy.setValue(HtmlEntry.PARSE_ERRORS, task.errors); 6973 htmlCopy.setValue(HtmlEntry.PARSE_ERRORS, task.errors);
7025 htmlCopy.setValue(HtmlEntry.REFERENCED_LIBRARIES, task.referencedLibrari es); 6974 htmlCopy.setValue(HtmlEntry.REFERENCED_LIBRARIES, task.referencedLibrari es);
7026 _cache.storedAst(source); 6975 _cache.storedAst(source);
7027 ChangeNoticeImpl notice = _getNotice(source); 6976 if (_generateSdkErrors || !source.isInSystemLibrary) {
7028 notice.setErrors(htmlCopy.allErrors, lineInfo); 6977 ChangeNoticeImpl notice = _getNotice(source);
6978 notice.setErrors(htmlCopy.allErrors, lineInfo);
6979 }
7029 } else { 6980 } else {
7030 htmlCopy.recordParseError(); 6981 htmlCopy.recordParseError();
7031 _cache.removedAst(source); 6982 _cache.removedAst(source);
7032 } 6983 }
7033 htmlCopy.exception = thrownException; 6984 htmlCopy.exception = thrownException;
7034 _cache.put(source, htmlCopy); 6985 _cache.put(source, htmlCopy);
7035 htmlEntry = htmlCopy; 6986 htmlEntry = htmlCopy;
7036 } else { 6987 } else {
7037 _logInformation2("Parse results discarded for ${_debuggingString(source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${htmlEntry .modificationTime}", thrownException); 6988 _logInformation2("Parse results discarded for ${_debuggingString(source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${htmlEntry .modificationTime}", thrownException);
7038 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy; 6989 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
7102 _sourceChanged(source); 7053 _sourceChanged(source);
7103 htmlEntry = _getReadableHtmlEntry(source); 7054 htmlEntry = _getReadableHtmlEntry(source);
7104 if (htmlEntry == null) { 7055 if (htmlEntry == null) {
7105 throw new AnalysisException.con1("An HTML file became a non-HTML file: ${source.fullName}"); 7056 throw new AnalysisException.con1("An HTML file became a non-HTML file: ${source.fullName}");
7106 } 7057 }
7107 } 7058 }
7108 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 7059 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
7109 if (thrownException == null) { 7060 if (thrownException == null) {
7110 htmlCopy.setValue(HtmlEntry.ANGULAR_ERRORS, task.resolutionErrors); 7061 htmlCopy.setValue(HtmlEntry.ANGULAR_ERRORS, task.resolutionErrors);
7111 // notify about errors 7062 // notify about errors
7112 ChangeNoticeImpl notice = _getNotice(source); 7063 if (_generateSdkErrors || !source.isInSystemLibrary) {
7113 notice.htmlUnit = task.resolvedUnit; 7064 ChangeNoticeImpl notice = _getNotice(source);
7114 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_ INFO)); 7065 notice.htmlUnit = task.resolvedUnit;
7066 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LIN E_INFO));
7067 }
7115 } else { 7068 } else {
7116 htmlCopy.recordResolutionError(); 7069 htmlCopy.recordResolutionError();
7117 } 7070 }
7118 htmlCopy.exception = thrownException; 7071 htmlCopy.exception = thrownException;
7119 _cache.put(source, htmlCopy); 7072 _cache.put(source, htmlCopy);
7120 htmlEntry = htmlCopy; 7073 htmlEntry = htmlCopy;
7121 } else { 7074 } else {
7122 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 7075 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
7123 if (thrownException == null || resultTime >= 0) { 7076 if (thrownException == null || resultTime >= 0) {
7124 // 7077 //
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
7184 htmlEntry = _getReadableHtmlEntry(source); 7137 htmlEntry = _getReadableHtmlEntry(source);
7185 if (htmlEntry == null) { 7138 if (htmlEntry == null) {
7186 throw new AnalysisException.con1("An HTML file became a non-HTML file: ${source.fullName}"); 7139 throw new AnalysisException.con1("An HTML file became a non-HTML file: ${source.fullName}");
7187 } 7140 }
7188 } 7141 }
7189 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 7142 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
7190 if (thrownException == null) { 7143 if (thrownException == null) {
7191 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit); 7144 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit);
7192 _recordAngularEntryPoint(htmlCopy, task); 7145 _recordAngularEntryPoint(htmlCopy, task);
7193 _cache.storedAst(source); 7146 _cache.storedAst(source);
7194 ChangeNoticeImpl notice = _getNotice(source); 7147 if (_generateSdkErrors || !source.isInSystemLibrary) {
7195 notice.htmlUnit = task.resolvedUnit; 7148 ChangeNoticeImpl notice = _getNotice(source);
7196 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_ INFO)); 7149 notice.htmlUnit = task.resolvedUnit;
7150 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LIN E_INFO));
7151 }
7197 } else { 7152 } else {
7198 htmlCopy.recordResolutionError(); 7153 htmlCopy.recordResolutionError();
7199 } 7154 }
7200 htmlCopy.exception = thrownException; 7155 htmlCopy.exception = thrownException;
7201 _cache.put(source, htmlCopy); 7156 _cache.put(source, htmlCopy);
7202 htmlEntry = htmlCopy; 7157 htmlEntry = htmlCopy;
7203 } else { 7158 } else {
7204 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 7159 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
7205 if (thrownException == null || resultTime >= 0) { 7160 if (thrownException == null || resultTime >= 0) {
7206 // 7161 //
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
7347 throw new AnalysisException.con1("An HTML file became a non-HTML file: ${source.fullName}"); 7302 throw new AnalysisException.con1("An HTML file became a non-HTML file: ${source.fullName}");
7348 } 7303 }
7349 } 7304 }
7350 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 7305 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
7351 if (thrownException == null) { 7306 if (thrownException == null) {
7352 htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.FLUSHED); 7307 htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.FLUSHED);
7353 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit); 7308 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit);
7354 htmlCopy.setValue(HtmlEntry.ELEMENT, task.element); 7309 htmlCopy.setValue(HtmlEntry.ELEMENT, task.element);
7355 htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors); 7310 htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors);
7356 _cache.storedAst(source); 7311 _cache.storedAst(source);
7357 ChangeNoticeImpl notice = _getNotice(source); 7312 if (_generateSdkErrors || !source.isInSystemLibrary) {
7358 notice.htmlUnit = task.resolvedUnit; 7313 ChangeNoticeImpl notice = _getNotice(source);
7359 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_ INFO)); 7314 notice.htmlUnit = task.resolvedUnit;
7315 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LIN E_INFO));
7316 }
7360 } else { 7317 } else {
7361 htmlCopy.recordResolutionError(); 7318 htmlCopy.recordResolutionError();
7362 _cache.removedAst(source); 7319 _cache.removedAst(source);
7363 } 7320 }
7364 htmlCopy.exception = thrownException; 7321 htmlCopy.exception = thrownException;
7365 _cache.put(source, htmlCopy); 7322 _cache.put(source, htmlCopy);
7366 htmlEntry = htmlCopy; 7323 htmlEntry = htmlCopy;
7367 } else { 7324 } else {
7368 _logInformation2("Resolution results discarded for ${_debuggingString(sour ce)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${html Entry.modificationTime}", thrownException); 7325 _logInformation2("Resolution results discarded for ${_debuggingString(sour ce)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${html Entry.modificationTime}", thrownException);
7369 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 7326 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
7432 } 7389 }
7433 } 7390 }
7434 DartEntryImpl dartCopy = dartEntry.writableCopy; 7391 DartEntryImpl dartCopy = dartEntry.writableCopy;
7435 if (thrownException == null) { 7392 if (thrownException == null) {
7436 LineInfo lineInfo = task.lineInfo; 7393 LineInfo lineInfo = task.lineInfo;
7437 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo); 7394 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo);
7438 dartCopy.setValue(DartEntry.TOKEN_STREAM, task.tokenStream); 7395 dartCopy.setValue(DartEntry.TOKEN_STREAM, task.tokenStream);
7439 dartCopy.setValue(DartEntry.SCAN_ERRORS, task.errors); 7396 dartCopy.setValue(DartEntry.SCAN_ERRORS, task.errors);
7440 _cache.storedAst(source); 7397 _cache.storedAst(source);
7441 _workManager.add(source, SourcePriority.NORMAL_PART); 7398 _workManager.add(source, SourcePriority.NORMAL_PART);
7442 ChangeNoticeImpl notice = _getNotice(source); 7399 if (_generateSdkErrors || !source.isInSystemLibrary) {
7443 notice.setErrors(dartEntry.allErrors, lineInfo); 7400 ChangeNoticeImpl notice = _getNotice(source);
7401 notice.setErrors(dartEntry.allErrors, lineInfo);
7402 }
7444 } else { 7403 } else {
7445 _removeFromParts(source, dartEntry); 7404 _removeFromParts(source, dartEntry);
7446 dartCopy.recordScanError(); 7405 dartCopy.recordScanError();
7447 _cache.removedAst(source); 7406 _cache.removedAst(source);
7448 } 7407 }
7449 dartCopy.exception = thrownException; 7408 dartCopy.exception = thrownException;
7450 _cache.put(source, dartCopy); 7409 _cache.put(source, dartCopy);
7451 dartEntry = dartCopy; 7410 dartEntry = dartCopy;
7452 } else { 7411 } else {
7453 _logInformation2("Scan results discarded for ${_debuggingString(source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEntry. modificationTime}", thrownException); 7412 _logInformation2("Scan results discarded for ${_debuggingString(source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTime = ${dartEntry. modificationTime}", thrownException);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
7491 * @param dartEntry the entry containing the list of included parts 7450 * @param dartEntry the entry containing the list of included parts
7492 */ 7451 */
7493 void _removeFromParts(Source librarySource, DartEntry dartEntry) { 7452 void _removeFromParts(Source librarySource, DartEntry dartEntry) {
7494 List<Source> oldParts = dartEntry.getValue(DartEntry.INCLUDED_PARTS); 7453 List<Source> oldParts = dartEntry.getValue(DartEntry.INCLUDED_PARTS);
7495 for (int i = 0; i < oldParts.length; i++) { 7454 for (int i = 0; i < oldParts.length; i++) {
7496 Source partSource = oldParts[i]; 7455 Source partSource = oldParts[i];
7497 DartEntry partEntry = _getReadableDartEntry(partSource); 7456 DartEntry partEntry = _getReadableDartEntry(partSource);
7498 if (partEntry != null && partEntry != dartEntry) { 7457 if (partEntry != null && partEntry != dartEntry) {
7499 DartEntryImpl partCopy = partEntry.writableCopy; 7458 DartEntryImpl partCopy = partEntry.writableCopy;
7500 partCopy.removeContainingLibrary(librarySource); 7459 partCopy.removeContainingLibrary(librarySource);
7501 if (partCopy.containingLibraries.length == 0 && !exists(partSource)) { 7460 if (partCopy.librariesContaining.length == 0 && !exists(partSource)) {
7502 _cache.remove(partSource); 7461 _cache.remove(partSource);
7503 } else { 7462 } else {
7504 _cache.put(partSource, partCopy); 7463 _cache.put(partSource, partCopy);
7505 } 7464 }
7506 } 7465 }
7507 } 7466 }
7508 } 7467 }
7509 7468
7510 /** 7469 /**
7511 * Remove the given libraries that are keys in the given map from the list of containing libraries
7512 * for each of the parts in the corresponding value.
7513 *
7514 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
7515 *
7516 * @param oldPartMap the table containing the parts associated with each libra ry
7517 */
7518 void _removeFromPartsUsingMap(Map<Source, List<Source>> oldPartMap) {
7519 for (MapEntry<Source, List<Source>> entry in getMapEntrySet(oldPartMap)) {
7520 Source librarySource = entry.getKey();
7521 List<Source> oldParts = entry.getValue();
7522 for (int i = 0; i < oldParts.length; i++) {
7523 Source partSource = oldParts[i];
7524 if (partSource != librarySource) {
7525 DartEntry partEntry = _getReadableDartEntry(partSource);
7526 if (partEntry != null) {
7527 DartEntryImpl partCopy = partEntry.writableCopy;
7528 partCopy.removeContainingLibrary(librarySource);
7529 if (partCopy.containingLibraries.length == 0 && !exists(partSource)) {
7530 _cache.remove(partSource);
7531 } else {
7532 _cache.put(partSource, partCopy);
7533 }
7534 }
7535 }
7536 }
7537 }
7538 }
7539
7540 /**
7541 * Remove the given source from the priority order if it is in the list. 7470 * Remove the given source from the priority order if it is in the list.
7542 * 7471 *
7543 * @param source the source to be removed 7472 * @param source the source to be removed
7544 */ 7473 */
7545 void _removeFromPriorityOrder(Source source) { 7474 void _removeFromPriorityOrder(Source source) {
7546 int count = _priorityOrder.length; 7475 int count = _priorityOrder.length;
7547 List<Source> newOrder = new List<Source>(); 7476 List<Source> newOrder = new List<Source>();
7548 for (int i = 0; i < count; i++) { 7477 for (int i = 0; i < count; i++) {
7549 if (_priorityOrder[i] != source) { 7478 if (_priorityOrder[i] != source) {
7550 newOrder.add(_priorityOrder[i]); 7479 newOrder.add(_priorityOrder[i]);
7551 } 7480 }
7552 } 7481 }
7553 if (newOrder.length < count) { 7482 if (newOrder.length < count) {
7554 analysisPriorityOrder = newOrder; 7483 analysisPriorityOrder = newOrder;
7555 } 7484 }
7556 } 7485 }
7557 7486
7558 /** 7487 /**
7559 * Create an entry for the newly added source. Return `true` if the new source is a Dart 7488 * Create an entry for the newly added source. Return `true` if the new source is a Dart
7560 * file. 7489 * file.
7561 * 7490 *
7562 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 7491 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
7563 * 7492 *
7564 * @param source the source that has been added 7493 * @param source the source that has been added
7565 * @return `true` if the new source is a Dart file 7494 * @return `true` if the new source is a Dart file
7566 */ 7495 */
7567 bool _sourceAvailable(Source source) { 7496 bool _sourceAvailable(Source source) {
7568 SourceEntry sourceEntry = _cache.get(source); 7497 SourceEntry sourceEntry = _cache.get(source);
7569 if (sourceEntry == null) { 7498 if (sourceEntry == null) {
7570 sourceEntry = _createSourceEntry(source, true); 7499 sourceEntry = _createSourceEntry(source);
7571 } else { 7500 } else {
7572 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; 7501 SourceEntryImpl sourceCopy = sourceEntry.writableCopy;
7573 int newTime = getModificationStamp(source); 7502 // long oldTime = sourceCopy.getModificationTime();
7574 sourceCopy.modificationTime = newTime; 7503 sourceCopy.modificationTime = getModificationStamp(source);
7575 sourceCopy.explicitlyAdded = true; 7504 // TODO(brianwilkerson) Understand why we're not invalidating the cache.
7576 // TODO(brianwilkerson) Understand why we're not invalidating the cached d ata.
7577 _cache.put(source, sourceCopy); 7505 _cache.put(source, sourceCopy);
7578 } 7506 }
7579 if (sourceEntry is HtmlEntry) { 7507 if (sourceEntry is HtmlEntry) {
7580 _workManager.add(source, SourcePriority.HTML); 7508 _workManager.add(source, SourcePriority.HTML);
7581 } else { 7509 } else {
7582 _workManager.add(source, SourcePriority.UNKNOWN); 7510 _workManager.add(source, SourcePriority.UNKNOWN);
7583 } 7511 }
7584 return sourceEntry is DartEntry; 7512 return sourceEntry is DartEntry;
7585 } 7513 }
7586 7514
7587 /** 7515 /**
7588 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 7516 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
7589 * 7517 *
7590 * @param source the source that has been changed 7518 * @param source the source that has been changed
7591 */ 7519 */
7592 void _sourceChanged(Source source) { 7520 void _sourceChanged(Source source) {
7593 SourceEntry sourceEntry = _cache.get(source); 7521 SourceEntry sourceEntry = _cache.get(source);
7594 if (sourceEntry == null || sourceEntry.modificationTime == getModificationSt amp(source)) { 7522 if (sourceEntry == null || sourceEntry.modificationTime == getModificationSt amp(source)) {
7595 // Either we have removed this source, in which case we don't care that it is changed, or we 7523 // Either we have removed this source, in which case we don't care that it is changed, or we
7596 // have already invalidated the cache and don't need to invalidate it agai n. 7524 // have already invalidated the cache and don't need to invalidate it agai n.
7525 // if (sourceEntry == null) {
7526 // logInformation("Modified source, but there is no entry: " + debu ggingString(source));
7527 // } else {
7528 // logInformation("Modified source, but modification time matches: " + debuggingString(source));
7529 // }
7597 return; 7530 return;
7598 } 7531 }
7599 if (sourceEntry is HtmlEntry) { 7532 if (sourceEntry is HtmlEntry) {
7600 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy; 7533 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy;
7534 // long oldTime = htmlCopy.getModificationTime();
7601 htmlCopy.modificationTime = getModificationStamp(source); 7535 htmlCopy.modificationTime = getModificationStamp(source);
7602 _invalidateAngularResolution(htmlCopy); 7536 _invalidateAngularResolution(htmlCopy);
7603 htmlCopy.invalidateAllInformation(); 7537 htmlCopy.invalidateAllInformation();
7604 _cache.put(source, htmlCopy); 7538 _cache.put(source, htmlCopy);
7605 _cache.removedAst(source); 7539 _cache.removedAst(source);
7606 _workManager.add(source, SourcePriority.HTML); 7540 _workManager.add(source, SourcePriority.HTML);
7607 } else if (sourceEntry is DartEntry) { 7541 } else if (sourceEntry is DartEntry) {
7608 List<Source> containingLibraries = getLibrariesContaining(source); 7542 List<Source> containingLibraries = getLibrariesContaining(source);
7609 Set<Source> librariesToInvalidate = new Set<Source>(); 7543 Set<Source> librariesToInvalidate = new Set<Source>();
7610 for (Source containingLibrary in containingLibraries) { 7544 for (Source containingLibrary in containingLibraries) {
7611 librariesToInvalidate.add(containingLibrary); 7545 librariesToInvalidate.add(containingLibrary);
7612 for (Source dependentLibrary in getLibrariesDependingOn(containingLibrar y)) { 7546 for (Source dependentLibrary in getLibrariesDependingOn(containingLibrar y)) {
7613 librariesToInvalidate.add(dependentLibrary); 7547 librariesToInvalidate.add(dependentLibrary);
7614 } 7548 }
7615 } 7549 }
7550 PrintStringWriter writer = new PrintStringWriter();
7616 for (Source library in librariesToInvalidate) { 7551 for (Source library in librariesToInvalidate) {
7617 // for (Source library : containingLibraries) { 7552 // for (Source library : containingLibraries) {
7618 _invalidateLibraryResolution(library); 7553 _invalidateLibraryResolution(library, writer);
7619 } 7554 }
7620 _removeFromParts(source, _cache.get(source) as DartEntry); 7555 _removeFromParts(source, _cache.get(source) as DartEntry);
7621 DartEntryImpl dartCopy = (_cache.get(source) as DartEntry).writableCopy; 7556 DartEntryImpl dartCopy = (_cache.get(source) as DartEntry).writableCopy;
7622 dartCopy.modificationTime = getModificationStamp(source); 7557 dartCopy.modificationTime = getModificationStamp(source);
7623 dartCopy.invalidateAllInformation(); 7558 dartCopy.invalidateAllInformation();
7624 _cache.put(source, dartCopy); 7559 _cache.put(source, dartCopy);
7625 _cache.removedAst(source); 7560 _cache.removedAst(source);
7626 _workManager.add(source, SourcePriority.UNKNOWN); 7561 _workManager.add(source, SourcePriority.UNKNOWN);
7627 } 7562 }
7628 } 7563 }
7629 7564
7630 /** 7565 /**
7631 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 7566 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
7632 * 7567 *
7633 * @param source the source that has been deleted 7568 * @param source the source that has been deleted
7634 */ 7569 */
7635 void _sourceRemoved(Source source) { 7570 void _sourceRemoved(Source source) {
7571 PrintStringWriter writer = new PrintStringWriter();
7636 SourceEntry sourceEntry = _cache.get(source); 7572 SourceEntry sourceEntry = _cache.get(source);
7637 if (sourceEntry is HtmlEntry) { 7573 if (sourceEntry is HtmlEntry) {
7638 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy; 7574 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy;
7639 _invalidateAngularResolution(htmlCopy); 7575 _invalidateAngularResolution(htmlCopy);
7640 } else if (sourceEntry is DartEntry) { 7576 } else if (sourceEntry is DartEntry) {
7641 Set<Source> libraries = new Set<Source>(); 7577 Set<Source> libraries = new Set<Source>();
7642 for (Source librarySource in getLibrariesContaining(source)) { 7578 for (Source librarySource in getLibrariesContaining(source)) {
7643 libraries.add(librarySource); 7579 libraries.add(librarySource);
7644 for (Source dependentLibrary in getLibrariesDependingOn(librarySource)) { 7580 for (Source dependentLibrary in getLibrariesDependingOn(librarySource)) {
7645 libraries.add(dependentLibrary); 7581 libraries.add(dependentLibrary);
7646 } 7582 }
7647 } 7583 }
7648 for (Source librarySource in libraries) { 7584 for (Source librarySource in libraries) {
7649 _invalidateLibraryResolution(librarySource); 7585 _invalidateLibraryResolution(librarySource, writer);
7650 } 7586 }
7651 } 7587 }
7652 _cache.remove(source); 7588 _cache.remove(source);
7653 _workManager.remove(source); 7589 _workManager.remove(source);
7654 _removeFromPriorityOrder(source); 7590 _removeFromPriorityOrder(source);
7655 } 7591 }
7656 7592
7657 /** 7593 /**
7658 * Check the cache for any invalid entries (entries whose modification time do es not match the 7594 * Check the cache for any invalid entries (entries whose modification time do es not match the
7659 * modification time of the source associated with the entry). Invalid entries will be marked as 7595 * modification time of the source associated with the entry). Invalid entries will be marked as
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
8300 * be executed to further analyze the associated source. 8236 * be executed to further analyze the associated source.
8301 * * Otherwise, if [isBlocked] returns `true`, then there is no work that can be 8237 * * Otherwise, if [isBlocked] returns `true`, then there is no work that can be
8302 * done, but analysis for the associated source is not complete. 8238 * done, but analysis for the associated source is not complete.
8303 * * Otherwise, [getDependentSource] should return a source that needs to be ana lyzed 8239 * * Otherwise, [getDependentSource] should return a source that needs to be ana lyzed
8304 * before the analysis of the associated source can be completed. 8240 * before the analysis of the associated source can be completed.
8305 */ 8241 */
8306 class AnalysisContextImpl_TaskData { 8242 class AnalysisContextImpl_TaskData {
8307 /** 8243 /**
8308 * The task that is to be performed. 8244 * The task that is to be performed.
8309 */ 8245 */
8310 final AnalysisTask task; 8246 AnalysisTask task;
8311 8247
8312 /** 8248 /**
8313 * A flag indicating whether the associated source is blocked waiting for its contents to be 8249 * A flag indicating whether the associated source is blocked waiting for its contents to be
8314 * loaded. 8250 * loaded.
8315 */ 8251 */
8316 final bool _blocked; 8252 bool _blocked = false;
8317 8253
8318 /** 8254 /**
8319 * Initialize a newly created data holder. 8255 * Initialize a newly created data holder.
8320 * 8256 *
8321 * @param task the task that is to be performed 8257 * @param task the task that is to be performed
8322 * @param blocked `true` if the associated source is blocked waiting for its c ontents to 8258 * @param blocked `true` if the associated source is blocked waiting for its c ontents to
8323 * be loaded 8259 * be loaded
8324 */ 8260 */
8325 AnalysisContextImpl_TaskData(this.task, this._blocked); 8261 AnalysisContextImpl_TaskData(AnalysisTask task, bool blocked) {
8262 this.task = task;
8263 this._blocked = blocked;
8264 }
8326 8265
8327 /** 8266 /**
8328 * Return `true` if the associated source is blocked waiting for its contents to be 8267 * Return `true` if the associated source is blocked waiting for its contents to be
8329 * loaded. 8268 * loaded.
8330 * 8269 *
8331 * @return `true` if the associated source is blocked waiting for its contents to be 8270 * @return `true` if the associated source is blocked waiting for its contents to be
8332 * loaded 8271 * loaded
8333 */ 8272 */
8334 bool get isBlocked => _blocked; 8273 bool get isBlocked => _blocked;
8335 8274
8336 @override 8275 @override
8337 String toString() { 8276 String toString() {
8338 if (task == null) { 8277 if (task == null) {
8339 return "blocked: ${_blocked}"; 8278 return "blocked: ${_blocked}";
8340 } 8279 }
8341 return task.toString(); 8280 return task.toString();
8342 } 8281 }
8343 } 8282 }
8344 8283
8345 /** 8284 /**
8346 * Instances of the class `AnalysisErrorInfoImpl` represent the analysis errors and line info 8285 * Instances of the class `AnalysisErrorInfoImpl` represent the analysis errors and line info
8347 * associated with a source. 8286 * associated with a source.
8348 */ 8287 */
8349 class AnalysisErrorInfoImpl implements AnalysisErrorInfo { 8288 class AnalysisErrorInfoImpl implements AnalysisErrorInfo {
8350 /** 8289 /**
8351 * The analysis errors associated with a source, or `null` if there are no err ors. 8290 * The analysis errors associated with a source, or `null` if there are no err ors.
8352 */ 8291 */
8353 final List<AnalysisError> errors; 8292 List<AnalysisError> errors;
8354 8293
8355 /** 8294 /**
8356 * The line information associated with the errors, or `null` if there are no errors. 8295 * The line information associated with the errors, or `null` if there are no errors.
8357 */ 8296 */
8358 final LineInfo lineInfo; 8297 LineInfo lineInfo;
8359 8298
8360 /** 8299 /**
8361 * Initialize an newly created error info with the errors and line information 8300 * Initialize an newly created error info with the errors and line information
8362 * 8301 *
8363 * @param errors the errors as a result of analysis 8302 * @param errors the errors as a result of analysis
8364 * @param lineinfo the line info for the errors 8303 * @param lineinfo the line info for the errors
8365 */ 8304 */
8366 AnalysisErrorInfoImpl(this.errors, this.lineInfo); 8305 AnalysisErrorInfoImpl(List<AnalysisError> errors, LineInfo lineInfo) {
8306 this.errors = errors;
8307 this.lineInfo = lineInfo;
8308 }
8367 } 8309 }
8368 8310
8369 /** 8311 /**
8370 * Instances of the class `AnalysisOptions` represent a set of analysis options used to 8312 * Instances of the class `AnalysisOptions` represent a set of analysis options used to
8371 * control the behavior of an analysis context. 8313 * control the behavior of an analysis context.
8372 */ 8314 */
8373 class AnalysisOptionsImpl implements AnalysisOptions { 8315 class AnalysisOptionsImpl implements AnalysisOptions {
8374 /** 8316 /**
8375 * The maximum number of sources for which data should be kept in the cache. 8317 * The maximum number of sources for which data should be kept in the cache.
8376 */ 8318 */
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
8452 } 8394 }
8453 8395
8454 /** 8396 /**
8455 * Instances of the class `ChangeNoticeImpl` represent a change to the analysis results 8397 * Instances of the class `ChangeNoticeImpl` represent a change to the analysis results
8456 * associated with a given source. 8398 * associated with a given source.
8457 */ 8399 */
8458 class ChangeNoticeImpl implements ChangeNotice { 8400 class ChangeNoticeImpl implements ChangeNotice {
8459 /** 8401 /**
8460 * The source for which the result is being reported. 8402 * The source for which the result is being reported.
8461 */ 8403 */
8462 final Source source; 8404 Source source;
8463 8405
8464 /** 8406 /**
8465 * The fully resolved AST that changed as a result of the analysis, or `null` if the AST was 8407 * The fully resolved AST that changed as a result of the analysis, or `null` if the AST was
8466 * not changed. 8408 * not changed.
8467 */ 8409 */
8468 CompilationUnit compilationUnit; 8410 CompilationUnit compilationUnit;
8469 8411
8470 /** 8412 /**
8471 * The fully resolved HTML that changed as a result of the analysis, or `null` if the HTML 8413 * The fully resolved HTML that changed as a result of the analysis, or `null` if the HTML
8472 * was not changed. 8414 * was not changed.
(...skipping 14 matching lines...) Expand all
8487 /** 8429 /**
8488 * An empty array of change notices. 8430 * An empty array of change notices.
8489 */ 8431 */
8490 static List<ChangeNoticeImpl> EMPTY_ARRAY = new List<ChangeNoticeImpl>(0); 8432 static List<ChangeNoticeImpl> EMPTY_ARRAY = new List<ChangeNoticeImpl>(0);
8491 8433
8492 /** 8434 /**
8493 * Initialize a newly created notice associated with the given source. 8435 * Initialize a newly created notice associated with the given source.
8494 * 8436 *
8495 * @param source the source for which the change is being reported 8437 * @param source the source for which the change is being reported
8496 */ 8438 */
8497 ChangeNoticeImpl(this.source); 8439 ChangeNoticeImpl(Source source) {
8440 this.source = source;
8441 }
8498 8442
8499 @override 8443 @override
8500 List<AnalysisError> get errors => _errors; 8444 List<AnalysisError> get errors => _errors;
8501 8445
8502 @override 8446 @override
8503 LineInfo get lineInfo => _lineInfo; 8447 LineInfo get lineInfo => _lineInfo;
8504 8448
8505 /** 8449 /**
8506 * Set the errors that changed as a result of the analysis to the given errors and set the line 8450 * Set the errors that changed as a result of the analysis to the given errors and set the line
8507 * information to the given line information. 8451 * information to the given line information.
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
8940 */ 8884 */
8941 static IncrementalAnalysisCache verifyStructure(IncrementalAnalysisCache cache , Source source, CompilationUnit unit) { 8885 static IncrementalAnalysisCache verifyStructure(IncrementalAnalysisCache cache , Source source, CompilationUnit unit) {
8942 if (cache != null && unit != null && cache.source == source) { 8886 if (cache != null && unit != null && cache.source == source) {
8943 if (!AstComparator.equalUnits(cache.resolvedUnit, unit)) { 8887 if (!AstComparator.equalUnits(cache.resolvedUnit, unit)) {
8944 return null; 8888 return null;
8945 } 8889 }
8946 } 8890 }
8947 return cache; 8891 return cache;
8948 } 8892 }
8949 8893
8950 final Source librarySource; 8894 Source librarySource;
8951 8895
8952 final Source source; 8896 Source source;
8953 8897
8954 final String oldContents; 8898 String oldContents;
8955 8899
8956 final CompilationUnit resolvedUnit; 8900 CompilationUnit resolvedUnit;
8957 8901
8958 String _newContents; 8902 String _newContents;
8959 8903
8960 int _offset = 0; 8904 int _offset = 0;
8961 8905
8962 int _oldLength = 0; 8906 int _oldLength = 0;
8963 8907
8964 int _newLength = 0; 8908 int _newLength = 0;
8965 8909
8966 IncrementalAnalysisCache(this.librarySource, this.source, this.resolvedUnit, t his.oldContents, String newContents, int offset, int oldLength, int newLength) { 8910 IncrementalAnalysisCache(Source librarySource, Source source, CompilationUnit resolvedUnit, String oldContents, String newContents, int offset, int oldLength, int newLength) {
8911 this.librarySource = librarySource;
8912 this.source = source;
8913 this.resolvedUnit = resolvedUnit;
8914 this.oldContents = oldContents;
8967 this._newContents = newContents; 8915 this._newContents = newContents;
8968 this._offset = offset; 8916 this._offset = offset;
8969 this._oldLength = oldLength; 8917 this._oldLength = oldLength;
8970 this._newLength = newLength; 8918 this._newLength = newLength;
8971 } 8919 }
8972 8920
8973 /** 8921 /**
8974 * Return the current contents for the receiver's source. 8922 * Return the current contents for the receiver's source.
8975 * 8923 *
8976 * @return the contents (not `null`) 8924 * @return the contents (not `null`)
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after
10051 9999
10052 /** 10000 /**
10053 * Instances of the class `ResolvableCompilationUnit` represent a compilation un it that is not 10001 * Instances of the class `ResolvableCompilationUnit` represent a compilation un it that is not
10054 * referenced by any other objects and for which we have modification stamp info rmation. It is used 10002 * referenced by any other objects and for which we have modification stamp info rmation. It is used
10055 * by the [LibraryResolver] to resolve a library. 10003 * by the [LibraryResolver] to resolve a library.
10056 */ 10004 */
10057 class ResolvableCompilationUnit extends TimestampedData<CompilationUnit> { 10005 class ResolvableCompilationUnit extends TimestampedData<CompilationUnit> {
10058 /** 10006 /**
10059 * The source of the compilation unit. 10007 * The source of the compilation unit.
10060 */ 10008 */
10061 final Source source; 10009 Source _source;
10062 10010
10063 /** 10011 /**
10064 * Initialize a newly created holder to hold the given values. 10012 * Initialize a newly created holder to hold the given values.
10065 * 10013 *
10066 * @param modificationTime the modification time of the source from which the AST was created 10014 * @param modificationTime the modification time of the source from which the AST was created
10067 * @param unit the AST that was created from the source 10015 * @param unit the AST that was created from the source
10068 */ 10016 */
10069 ResolvableCompilationUnit.con1(int modificationTime, CompilationUnit unit) : t his.con2(modificationTime, unit, null); 10017 ResolvableCompilationUnit.con1(int modificationTime, CompilationUnit unit) : s uper(modificationTime, unit);
10070 10018
10071 /** 10019 /**
10072 * Initialize a newly created holder to hold the given values. 10020 * Initialize a newly created holder to hold the given values.
10073 * 10021 *
10074 * @param modificationTime the modification time of the source from which the AST was created 10022 * @param modificationTime the modification time of the source from which the AST was created
10075 * @param unit the AST that was created from the source 10023 * @param unit the AST that was created from the source
10076 * @param source the source of the compilation unit 10024 * @param source the source of the compilation unit
10077 */ 10025 */
10078 ResolvableCompilationUnit.con2(int modificationTime, CompilationUnit unit, thi s.source) : super(modificationTime, unit); 10026 ResolvableCompilationUnit.con2(int modificationTime, CompilationUnit unit, Sou rce source) : super(modificationTime, unit) {
10027 this._source = source;
10028 }
10079 10029
10080 /** 10030 /**
10081 * Return the AST that was created from the source. 10031 * Return the AST that was created from the source.
10082 * 10032 *
10083 * @return the AST that was created from the source 10033 * @return the AST that was created from the source
10084 */ 10034 */
10085 CompilationUnit get compilationUnit => data; 10035 CompilationUnit get compilationUnit => data;
10036
10037 /**
10038 * Return the source of the compilation unit.
10039 *
10040 * @return the source of the compilation unit
10041 */
10042 Source get source => _source;
10086 } 10043 }
10087 10044
10088 /** 10045 /**
10089 * Instances of the class `ResolvableHtmlUnit` represent an HTML unit that is no t referenced 10046 * Instances of the class `ResolvableHtmlUnit` represent an HTML unit that is no t referenced
10090 * by any other objects and for which we have modification stamp information. It is used by the 10047 * by any other objects and for which we have modification stamp information. It is used by the
10091 * [ResolveHtmlTask] to resolve an HTML source. 10048 * [ResolveHtmlTask] to resolve an HTML source.
10092 */ 10049 */
10093 class ResolvableHtmlUnit extends TimestampedData<ht.HtmlUnit> { 10050 class ResolvableHtmlUnit extends TimestampedData<ht.HtmlUnit> {
10094 /** 10051 /**
10095 * Initialize a newly created holder to hold the given values. 10052 * Initialize a newly created holder to hold the given values.
(...skipping 14 matching lines...) Expand all
10110 /** 10067 /**
10111 * The enumerated type `Priority` defines the priority levels used to return sou rces in an 10068 * The enumerated type `Priority` defines the priority levels used to return sou rces in an
10112 * optimal order. A smaller ordinal value equates to a higher priority. 10069 * optimal order. A smaller ordinal value equates to a higher priority.
10113 */ 10070 */
10114 class SourcePriority extends Enum<SourcePriority> { 10071 class SourcePriority extends Enum<SourcePriority> {
10115 /** 10072 /**
10116 * Used for a Dart source that is known to be a part contained in a library th at was recently 10073 * Used for a Dart source that is known to be a part contained in a library th at was recently
10117 * resolved. These parts are given a higher priority because there is a high p robability that 10074 * resolved. These parts are given a higher priority because there is a high p robability that
10118 * their AST structure is still in the cache and therefore would not need to b e re-created. 10075 * their AST structure is still in the cache and therefore would not need to b e re-created.
10119 */ 10076 */
10120 static const SourcePriority PRIORITY_PART = const SourcePriority('PRIORITY_PAR T', 0); 10077 static final SourcePriority PRIORITY_PART = new SourcePriority('PRIORITY_PART' , 0);
10121 10078
10122 /** 10079 /**
10123 * Used for a Dart source that is known to be a library. 10080 * Used for a Dart source that is known to be a library.
10124 */ 10081 */
10125 static const SourcePriority LIBRARY = const SourcePriority('LIBRARY', 1); 10082 static final SourcePriority LIBRARY = new SourcePriority('LIBRARY', 1);
10126 10083
10127 /** 10084 /**
10128 * Used for a Dart source whose kind is unknown. 10085 * Used for a Dart source whose kind is unknown.
10129 */ 10086 */
10130 static const SourcePriority UNKNOWN = const SourcePriority('UNKNOWN', 2); 10087 static final SourcePriority UNKNOWN = new SourcePriority('UNKNOWN', 2);
10131 10088
10132 /** 10089 /**
10133 * Used for a Dart source that is known to be a part but whose library has not yet been resolved. 10090 * Used for a Dart source that is known to be a part but whose library has not yet been resolved.
10134 */ 10091 */
10135 static const SourcePriority NORMAL_PART = const SourcePriority('NORMAL_PART', 3); 10092 static final SourcePriority NORMAL_PART = new SourcePriority('NORMAL_PART', 3) ;
10136 10093
10137 /** 10094 /**
10138 * Used for an HTML source. 10095 * Used for an HTML source.
10139 */ 10096 */
10140 static const SourcePriority HTML = const SourcePriority('HTML', 4); 10097 static final SourcePriority HTML = new SourcePriority('HTML', 4);
10141 10098
10142 static const List<SourcePriority> values = const [PRIORITY_PART, LIBRARY, UNKN OWN, NORMAL_PART, HTML]; 10099 static final List<SourcePriority> values = [PRIORITY_PART, LIBRARY, UNKNOWN, N ORMAL_PART, HTML];
10143 10100
10144 const SourcePriority(String name, int ordinal) : super(name, ordinal); 10101 SourcePriority(String name, int ordinal) : super(name, ordinal);
10145 } 10102 }
10146 10103
10147 /** 10104 /**
10148 * Instances of the class `TimestampedData` represent analysis data for which we have a 10105 * Instances of the class `TimestampedData` represent analysis data for which we have a
10149 * modification time. 10106 * modification time.
10150 */ 10107 */
10151 class TimestampedData<E> { 10108 class TimestampedData<E> {
10152 /** 10109 /**
10153 * The modification time of the source from which the data was created. 10110 * The modification time of the source from which the data was created.
10154 */ 10111 */
10155 final int modificationTime; 10112 int modificationTime = 0;
10156 10113
10157 /** 10114 /**
10158 * The data that was created from the source. 10115 * The data that was created from the source.
10159 */ 10116 */
10160 final E data; 10117 E data;
10161 10118
10162 /** 10119 /**
10163 * Initialize a newly created holder to hold the given values. 10120 * Initialize a newly created holder to hold the given values.
10164 * 10121 *
10165 * @param modificationTime the modification time of the source from which the data was created 10122 * @param modificationTime the modification time of the source from which the data was created
10166 * @param unit the data that was created from the source 10123 * @param unit the data that was created from the source
10167 */ 10124 */
10168 TimestampedData(this.modificationTime, this.data); 10125 TimestampedData(int modificationTime, E data) {
10126 this.modificationTime = modificationTime;
10127 this.data = data;
10128 }
10169 } 10129 }
10170 10130
10171 /** 10131 /**
10172 * Instances of the class `WorkManager` manage a list of sources that need to ha ve analysis 10132 * Instances of the class `WorkManager` manage a list of sources that need to ha ve analysis
10173 * work performed on them. 10133 * work performed on them.
10174 */ 10134 */
10175 class WorkManager { 10135 class WorkManager {
10176 /** 10136 /**
10177 * An array containing the various queues is priority order. 10137 * An array containing the various queues is priority order.
10178 */ 10138 */
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
10351 } 10311 }
10352 } 10312 }
10353 10313
10354 /** 10314 /**
10355 * An [Expression] with optional [AngularFilterNode]s. 10315 * An [Expression] with optional [AngularFilterNode]s.
10356 */ 10316 */
10357 class AngularExpression { 10317 class AngularExpression {
10358 /** 10318 /**
10359 * The [Expression] to apply filters to. 10319 * The [Expression] to apply filters to.
10360 */ 10320 */
10361 final Expression expression; 10321 Expression expression;
10362 10322
10363 /** 10323 /**
10364 * The filters to apply. 10324 * The filters to apply.
10365 */ 10325 */
10366 final List<AngularFilterNode> filters; 10326 List<AngularFilterNode> filters;
10367 10327
10368 AngularExpression(this.expression, this.filters); 10328 AngularExpression(Expression expression, List<AngularFilterNode> filters) {
10329 this.expression = expression;
10330 this.filters = filters;
10331 }
10369 10332
10370 /** 10333 /**
10371 * Return the offset of the character immediately following the last character of this node's 10334 * Return the offset of the character immediately following the last character of this node's
10372 * source range. This is equivalent to `node.getOffset() + node.getLength()`. 10335 * source range. This is equivalent to `node.getOffset() + node.getLength()`.
10373 * 10336 *
10374 * @return the offset of the character just past the node's source range 10337 * @return the offset of the character just past the node's source range
10375 */ 10338 */
10376 int get end { 10339 int get end {
10377 if (filters.isEmpty) { 10340 if (filters.isEmpty) {
10378 return expression.end; 10341 return expression.end;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
10412 int get offset => expression.offset; 10375 int get offset => expression.offset;
10413 } 10376 }
10414 10377
10415 /** 10378 /**
10416 * Angular filter argument. 10379 * Angular filter argument.
10417 */ 10380 */
10418 class AngularFilterArgument { 10381 class AngularFilterArgument {
10419 /** 10382 /**
10420 * The [TokenType#COLON] token. 10383 * The [TokenType#COLON] token.
10421 */ 10384 */
10422 final Token token; 10385 Token token;
10423 10386
10424 /** 10387 /**
10425 * The argument expression. 10388 * The argument expression.
10426 */ 10389 */
10427 final Expression expression; 10390 Expression expression;
10428 10391
10429 /** 10392 /**
10430 * The optional sub-[Expression]s. 10393 * The optional sub-[Expression]s.
10431 */ 10394 */
10432 List<Expression> subExpressions = Expression.EMPTY_ARRAY; 10395 List<Expression> subExpressions = Expression.EMPTY_ARRAY;
10433 10396
10434 AngularFilterArgument(this.token, this.expression); 10397 AngularFilterArgument(Token token, Expression expression) {
10398 this.token = token;
10399 this.expression = expression;
10400 }
10435 } 10401 }
10436 10402
10437 /** 10403 /**
10438 * Angular filter node. 10404 * Angular filter node.
10439 */ 10405 */
10440 class AngularFilterNode { 10406 class AngularFilterNode {
10441 /** 10407 /**
10442 * The [TokenType#BAR] token. 10408 * The [TokenType#BAR] token.
10443 */ 10409 */
10444 final Token token; 10410 Token token;
10445 10411
10446 /** 10412 /**
10447 * The name of the filter. 10413 * The name of the filter.
10448 */ 10414 */
10449 final SimpleIdentifier name; 10415 SimpleIdentifier name;
10450 10416
10451 /** 10417 /**
10452 * The arguments for this filter. 10418 * The arguments for this filter.
10453 */ 10419 */
10454 final List<AngularFilterArgument> arguments; 10420 List<AngularFilterArgument> arguments;
10455 10421
10456 AngularFilterNode(this.token, this.name, this.arguments); 10422 AngularFilterNode(Token token, SimpleIdentifier name, List<AngularFilterArgume nt> arguments) {
10423 this.token = token;
10424 this.name = name;
10425 this.arguments = arguments;
10426 }
10457 } 10427 }
10458 10428
10459 /** 10429 /**
10460 * Instances of the class [AngularHtmlUnitResolver] resolve Angular specific exp ressions. 10430 * Instances of the class [AngularHtmlUnitResolver] resolve Angular specific exp ressions.
10461 */ 10431 */
10462 class AngularHtmlUnitResolver extends ht.RecursiveXmlVisitor<Object> { 10432 class AngularHtmlUnitResolver extends ht.RecursiveXmlVisitor<Object> {
10463 static String _NG_APP = "ng-app"; 10433 static String _NG_APP = "ng-app";
10464 10434
10465 /** 10435 /**
10466 * Checks if given [Element] is an artificial local variable and returns corre sponding 10436 * Checks if given [Element] is an artificial local variable and returns corre sponding
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
10567 } 10537 }
10568 10538
10569 static Set<Source> _getLibrarySources(Set<LibraryElement> libraries) { 10539 static Set<Source> _getLibrarySources(Set<LibraryElement> libraries) {
10570 Set<Source> sources = new Set(); 10540 Set<Source> sources = new Set();
10571 for (LibraryElement library in libraries) { 10541 for (LibraryElement library in libraries) {
10572 sources.add(library.source); 10542 sources.add(library.source);
10573 } 10543 }
10574 return sources; 10544 return sources;
10575 } 10545 }
10576 10546
10577 final InternalAnalysisContext _context; 10547 InternalAnalysisContext _context;
10578 10548
10579 TypeProvider _typeProvider; 10549 TypeProvider _typeProvider;
10580 10550
10581 AngularHtmlUnitResolver_FilteringAnalysisErrorListener _errorListener; 10551 AngularHtmlUnitResolver_FilteringAnalysisErrorListener _errorListener;
10582 10552
10583 final Source _source; 10553 Source _source;
10584 10554
10585 final LineInfo _lineInfo; 10555 LineInfo _lineInfo;
10586 10556
10587 final ht.HtmlUnit _unit; 10557 ht.HtmlUnit _unit;
10588 10558
10589 List<AngularElement> _angularElements; 10559 List<AngularElement> _angularElements;
10590 10560
10591 List<NgProcessor> _processors = []; 10561 List<NgProcessor> _processors = [];
10592 10562
10593 LibraryElementImpl _libraryElement; 10563 LibraryElementImpl _libraryElement;
10594 10564
10595 CompilationUnitElementImpl _unitElement; 10565 CompilationUnitElementImpl _unitElement;
10596 10566
10597 FunctionElementImpl _functionElement; 10567 FunctionElementImpl _functionElement;
10598 10568
10599 ResolverVisitor _resolver; 10569 ResolverVisitor _resolver;
10600 10570
10601 bool _isAngular = false; 10571 bool _isAngular = false;
10602 10572
10603 List<LocalVariableElementImpl> _definedVariables = []; 10573 List<LocalVariableElementImpl> _definedVariables = [];
10604 10574
10605 Set<LibraryElement> _injectedLibraries = new Set(); 10575 Set<LibraryElement> _injectedLibraries = new Set();
10606 10576
10607 Scope _topNameScope; 10577 Scope _topNameScope;
10608 10578
10609 Scope _nameScope; 10579 Scope _nameScope;
10610 10580
10611 AngularHtmlUnitResolver(this._context, AnalysisErrorListener errorListener, th is._source, this._lineInfo, this._unit) { 10581 AngularHtmlUnitResolver(InternalAnalysisContext context, AnalysisErrorListener errorListener, Source source, LineInfo lineInfo, ht.HtmlUnit unit) {
10612 this._typeProvider = _context.typeProvider; 10582 this._context = context;
10583 this._typeProvider = context.typeProvider;
10613 this._errorListener = new AngularHtmlUnitResolver_FilteringAnalysisErrorList ener(errorListener); 10584 this._errorListener = new AngularHtmlUnitResolver_FilteringAnalysisErrorList ener(errorListener);
10585 this._source = source;
10586 this._lineInfo = lineInfo;
10587 this._unit = unit;
10614 } 10588 }
10615 10589
10616 /** 10590 /**
10617 * The [AngularApplication] for the Web application with this entry point, may be 10591 * The [AngularApplication] for the Web application with this entry point, may be
10618 * `null` if not an entry point. 10592 * `null` if not an entry point.
10619 */ 10593 */
10620 AngularApplication calculateAngularApplication() { 10594 AngularApplication calculateAngularApplication() {
10621 // check if Angular at all 10595 // check if Angular at all
10622 if (!hasAngularAnnotation(_unit)) { 10596 if (!hasAngularAnnotation(_unit)) {
10623 return null; 10597 return null;
(...skipping 514 matching lines...) Expand 10 before | Expand all | Expand 10 after
11138 * The "ng-model" directive is special, it contributes to the top-level name s cope. These models 11112 * The "ng-model" directive is special, it contributes to the top-level name s cope. These models
11139 * can be used before actual "ng-model" attribute in HTML. So, we need to defi ne them once we 11113 * can be used before actual "ng-model" attribute in HTML. So, we need to defi ne them once we
11140 * found [NG_APP] context. 11114 * found [NG_APP] context.
11141 */ 11115 */
11142 void _visitModelDirectives(ht.XmlTagNode appNode) { 11116 void _visitModelDirectives(ht.XmlTagNode appNode) {
11143 appNode.accept(new RecursiveXmlVisitor_AngularHtmlUnitResolver_visitModelDir ectives(this)); 11117 appNode.accept(new RecursiveXmlVisitor_AngularHtmlUnitResolver_visitModelDir ectives(this));
11144 } 11118 }
11145 } 11119 }
11146 11120
11147 class AngularHtmlUnitResolver_FilteringAnalysisErrorListener implements Analysis ErrorListener { 11121 class AngularHtmlUnitResolver_FilteringAnalysisErrorListener implements Analysis ErrorListener {
11148 final AnalysisErrorListener _listener; 11122 AnalysisErrorListener _listener;
11149 11123
11150 AngularHtmlUnitResolver_FilteringAnalysisErrorListener(this._listener); 11124 AngularHtmlUnitResolver_FilteringAnalysisErrorListener(AnalysisErrorListener l istener) {
11125 this._listener = listener;
11126 }
11151 11127
11152 @override 11128 @override
11153 void onError(AnalysisError error) { 11129 void onError(AnalysisError error) {
11154 ErrorCode errorCode = error.errorCode; 11130 ErrorCode errorCode = error.errorCode;
11155 if (identical(errorCode, StaticWarningCode.UNDEFINED_GETTER) || identical(er rorCode, StaticWarningCode.UNDEFINED_IDENTIFIER) || identical(errorCode, StaticT ypeWarningCode.UNDEFINED_GETTER)) { 11131 if (identical(errorCode, StaticWarningCode.UNDEFINED_GETTER) || identical(er rorCode, StaticWarningCode.UNDEFINED_IDENTIFIER) || identical(errorCode, StaticT ypeWarningCode.UNDEFINED_GETTER)) {
11156 return; 11132 return;
11157 } 11133 }
11158 _listener.onError(error); 11134 _listener.onError(error);
11159 } 11135 }
11160 } 11136 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
11200 11176
11201 static String CLOSING_DELIMITER = "}}"; 11177 static String CLOSING_DELIMITER = "}}";
11202 11178
11203 static int OPENING_DELIMITER_LENGTH = OPENING_DELIMITER.length; 11179 static int OPENING_DELIMITER_LENGTH = OPENING_DELIMITER.length;
11204 11180
11205 static int CLOSING_DELIMITER_LENGTH = CLOSING_DELIMITER.length; 11181 static int CLOSING_DELIMITER_LENGTH = CLOSING_DELIMITER.length;
11206 11182
11207 /** 11183 /**
11208 * The offset of the first character of the opening delimiter. 11184 * The offset of the first character of the opening delimiter.
11209 */ 11185 */
11210 final int _openingOffset; 11186 int _openingOffset = 0;
11211 11187
11212 /** 11188 /**
11213 * The offset of the first character of the closing delimiter. 11189 * The offset of the first character of the closing delimiter.
11214 */ 11190 */
11215 final int _closingOffset; 11191 int _closingOffset = 0;
11216 11192
11217 AngularMoustacheXmlExpression(this._openingOffset, this._closingOffset, Angula rExpression expression) : super(expression); 11193 AngularMoustacheXmlExpression(int openingOffset, int closingOffset, AngularExp ression expression) : super(expression) {
11194 this._openingOffset = openingOffset;
11195 this._closingOffset = closingOffset;
11196 }
11218 11197
11219 @override 11198 @override
11220 int get end => _closingOffset + CLOSING_DELIMITER_LENGTH; 11199 int get end => _closingOffset + CLOSING_DELIMITER_LENGTH;
11221 11200
11222 @override 11201 @override
11223 int get length => _closingOffset + CLOSING_DELIMITER_LENGTH - _openingOffset; 11202 int get length => _closingOffset + CLOSING_DELIMITER_LENGTH - _openingOffset;
11224 11203
11225 @override 11204 @override
11226 int get offset => _openingOffset; 11205 int get offset => _openingOffset;
11227 } 11206 }
(...skipping 15 matching lines...) Expand all
11243 int get offset => expression.offset; 11222 int get offset => expression.offset;
11244 } 11223 }
11245 11224
11246 /** 11225 /**
11247 * Abstract Angular specific [XmlExpression]. 11226 * Abstract Angular specific [XmlExpression].
11248 */ 11227 */
11249 abstract class AngularXmlExpression extends ht.XmlExpression { 11228 abstract class AngularXmlExpression extends ht.XmlExpression {
11250 /** 11229 /**
11251 * The expression that is enclosed between the delimiters. 11230 * The expression that is enclosed between the delimiters.
11252 */ 11231 */
11253 final AngularExpression expression; 11232 AngularExpression expression;
11254 11233
11255 AngularXmlExpression(this.expression); 11234 AngularXmlExpression(AngularExpression expression) {
11235 this.expression = expression;
11236 }
11256 11237
11257 @override 11238 @override
11258 ht.XmlExpression_Reference getReference(int offset) { 11239 ht.XmlExpression_Reference getReference(int offset) {
11259 // main expression 11240 // main expression
11260 ht.XmlExpression_Reference reference = _getReferenceAtNode(expression.expres sion, offset); 11241 ht.XmlExpression_Reference reference = _getReferenceAtNode(expression.expres sion, offset);
11261 if (reference != null) { 11242 if (reference != null) {
11262 return reference; 11243 return reference;
11263 } 11244 }
11264 // filters 11245 // filters
11265 for (AngularFilterNode filter in expression.filters) { 11246 for (AngularFilterNode filter in expression.filters) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
11334 } 11315 }
11335 } 11316 }
11336 } 11317 }
11337 } 11318 }
11338 11319
11339 /** 11320 /**
11340 * [NgComponentElementProcessor] applies [AngularComponentElement] by parsing ma pped 11321 * [NgComponentElementProcessor] applies [AngularComponentElement] by parsing ma pped
11341 * attributes as expressions. 11322 * attributes as expressions.
11342 */ 11323 */
11343 class NgComponentElementProcessor extends NgDirectiveProcessor { 11324 class NgComponentElementProcessor extends NgDirectiveProcessor {
11344 final AngularComponentElement _element; 11325 AngularComponentElement _element;
11345 11326
11346 NgComponentElementProcessor(this._element); 11327 NgComponentElementProcessor(AngularComponentElement element) {
11328 this._element = element;
11329 }
11347 11330
11348 @override 11331 @override
11349 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { 11332 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) {
11350 node.element = _element.selector; 11333 node.element = _element.selector;
11351 for (AngularPropertyElement property in _element.properties) { 11334 for (AngularPropertyElement property in _element.properties) {
11352 String name = property.name; 11335 String name = property.name;
11353 ht.XmlAttributeNode attribute = node.getAttribute(name); 11336 ht.XmlAttributeNode attribute = node.getAttribute(name);
11354 if (attribute != null) { 11337 if (attribute != null) {
11355 attribute.element = property; 11338 attribute.element = property;
11356 // resolve if binding 11339 // resolve if binding
11357 if (property.propertyKind != AngularPropertyKind.ATTR) { 11340 if (property.propertyKind != AngularPropertyKind.ATTR) {
11358 AngularExpression expression = parseAngularExpression(resolver, attrib ute); 11341 AngularExpression expression = parseAngularExpression(resolver, attrib ute);
11359 resolver._resolveExpression(expression); 11342 resolver._resolveExpression(expression);
11360 setAngularExpression(attribute, expression); 11343 setAngularExpression(attribute, expression);
11361 } 11344 }
11362 } 11345 }
11363 } 11346 }
11364 } 11347 }
11365 11348
11366 @override 11349 @override
11367 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node); 11350 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node);
11368 } 11351 }
11369 11352
11370 /** 11353 /**
11371 * [NgControllerElementProcessor] applies [AngularControllerElement]. 11354 * [NgControllerElementProcessor] applies [AngularControllerElement].
11372 */ 11355 */
11373 class NgControllerElementProcessor extends NgProcessor { 11356 class NgControllerElementProcessor extends NgProcessor {
11374 final AngularControllerElement _element; 11357 AngularControllerElement _element;
11375 11358
11376 NgControllerElementProcessor(this._element); 11359 NgControllerElementProcessor(AngularControllerElement element) {
11360 this._element = element;
11361 }
11377 11362
11378 @override 11363 @override
11379 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { 11364 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) {
11380 InterfaceType type = (_element.enclosingElement as ClassElement).type; 11365 InterfaceType type = (_element.enclosingElement as ClassElement).type;
11381 String name = _element.name; 11366 String name = _element.name;
11382 LocalVariableElementImpl variable = resolver._createLocalVariableWithName(ty pe, name); 11367 LocalVariableElementImpl variable = resolver._createLocalVariableWithName(ty pe, name);
11383 resolver._defineVariable(variable); 11368 resolver._defineVariable(variable);
11384 variable.toolkitObjects = <AngularElement> [_element]; 11369 variable.toolkitObjects = <AngularElement> [_element];
11385 } 11370 }
11386 11371
11387 @override 11372 @override
11388 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node); 11373 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node);
11389 } 11374 }
11390 11375
11391 /** 11376 /**
11392 * [NgDirectiveElementProcessor] applies [AngularDirectiveElement] by parsing ma pped 11377 * [NgDirectiveElementProcessor] applies [AngularDirectiveElement] by parsing ma pped
11393 * attributes as expressions. 11378 * attributes as expressions.
11394 */ 11379 */
11395 class NgDirectiveElementProcessor extends NgDirectiveProcessor { 11380 class NgDirectiveElementProcessor extends NgDirectiveProcessor {
11396 final AngularDirectiveElement _element; 11381 AngularDirectiveElement _element;
11397 11382
11398 NgDirectiveElementProcessor(this._element); 11383 NgDirectiveElementProcessor(AngularDirectiveElement element) {
11384 this._element = element;
11385 }
11399 11386
11400 @override 11387 @override
11401 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { 11388 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) {
11402 String selectorAttributeName = null; 11389 String selectorAttributeName = null;
11403 { 11390 {
11404 AngularSelectorElement selector = _element.selector; 11391 AngularSelectorElement selector = _element.selector;
11405 if (selector is HasAttributeSelectorElementImpl) { 11392 if (selector is HasAttributeSelectorElementImpl) {
11406 selectorAttributeName = selector.name; 11393 selectorAttributeName = selector.name;
11407 // resolve attribute expression 11394 // resolve attribute expression
11408 ht.XmlAttributeNode attribute = node.getAttribute(selectorAttributeName) ; 11395 ht.XmlAttributeNode attribute = node.getAttribute(selectorAttributeName) ;
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
11582 } 11569 }
11583 11570
11584 /** 11571 /**
11585 * The abstract class `AnalysisTask` defines the behavior of objects used to per form an 11572 * The abstract class `AnalysisTask` defines the behavior of objects used to per form an
11586 * analysis task. 11573 * analysis task.
11587 */ 11574 */
11588 abstract class AnalysisTask { 11575 abstract class AnalysisTask {
11589 /** 11576 /**
11590 * The context in which the task is to be performed. 11577 * The context in which the task is to be performed.
11591 */ 11578 */
11592 final InternalAnalysisContext context; 11579 InternalAnalysisContext context;
11593 11580
11594 /** 11581 /**
11595 * The exception that was thrown while performing this task, or `null` if the task completed 11582 * The exception that was thrown while performing this task, or `null` if the task completed
11596 * successfully. 11583 * successfully.
11597 */ 11584 */
11598 AnalysisException _thrownException; 11585 AnalysisException _thrownException;
11599 11586
11600 /** 11587 /**
11601 * Initialize a newly created task to perform analysis within the given contex t. 11588 * Initialize a newly created task to perform analysis within the given contex t.
11602 * 11589 *
11603 * @param context the context in which the task is to be performed 11590 * @param context the context in which the task is to be performed
11604 */ 11591 */
11605 AnalysisTask(this.context); 11592 AnalysisTask(InternalAnalysisContext context) {
11593 this.context = context;
11594 }
11606 11595
11607 /** 11596 /**
11608 * Use the given visitor to visit this task. 11597 * Use the given visitor to visit this task.
11609 * 11598 *
11610 * @param visitor the visitor that should be used to visit this task 11599 * @param visitor the visitor that should be used to visit this task
11611 * @return the value returned by the visitor 11600 * @return the value returned by the visitor
11612 * @throws AnalysisException if the visitor throws the exception 11601 * @throws AnalysisException if the visitor throws the exception
11613 */ 11602 */
11614 accept(AnalysisTaskVisitor visitor); 11603 accept(AnalysisTaskVisitor visitor);
11615 11604
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
11797 } 11786 }
11798 11787
11799 /** 11788 /**
11800 * Instances of the class `GenerateDartErrorsTask` generate errors and warnings for a single 11789 * Instances of the class `GenerateDartErrorsTask` generate errors and warnings for a single
11801 * Dart source. 11790 * Dart source.
11802 */ 11791 */
11803 class GenerateDartErrorsTask extends AnalysisTask { 11792 class GenerateDartErrorsTask extends AnalysisTask {
11804 /** 11793 /**
11805 * The source for which errors and warnings are to be produced. 11794 * The source for which errors and warnings are to be produced.
11806 */ 11795 */
11807 final Source source; 11796 Source source;
11808 11797
11809 /** 11798 /**
11810 * The time at which the contents of the source were last modified. 11799 * The time at which the contents of the source were last modified.
11811 */ 11800 */
11812 final int modificationTime; 11801 int modificationTime = 0;
11813 11802
11814 /** 11803 /**
11815 * The compilation unit used to resolve the dependencies. 11804 * The compilation unit used to resolve the dependencies.
11816 */ 11805 */
11817 final CompilationUnit _unit; 11806 CompilationUnit _unit;
11818 11807
11819 /** 11808 /**
11820 * The element model for the library containing the source. 11809 * The element model for the library containing the source.
11821 */ 11810 */
11822 final LibraryElement libraryElement; 11811 LibraryElement libraryElement;
11823 11812
11824 /** 11813 /**
11825 * The errors that were generated for the source. 11814 * The errors that were generated for the source.
11826 */ 11815 */
11827 List<AnalysisError> _errors; 11816 List<AnalysisError> _errors;
11828 11817
11829 /** 11818 /**
11830 * Initialize a newly created task to perform analysis within the given contex t. 11819 * Initialize a newly created task to perform analysis within the given contex t.
11831 * 11820 *
11832 * @param context the context in which the task is to be performed 11821 * @param context the context in which the task is to be performed
11833 * @param source the source for which errors and warnings are to be produced 11822 * @param source the source for which errors and warnings are to be produced
11834 * @param modificationTime the time at which the contents of the source were l ast modified 11823 * @param modificationTime the time at which the contents of the source were l ast modified
11835 * @param unit the compilation unit used to resolve the dependencies 11824 * @param unit the compilation unit used to resolve the dependencies
11836 * @param libraryElement the element model for the library containing the sour ce 11825 * @param libraryElement the element model for the library containing the sour ce
11837 */ 11826 */
11838 GenerateDartErrorsTask(InternalAnalysisContext context, this.source, this.modi ficationTime, this._unit, this.libraryElement) : super(context); 11827 GenerateDartErrorsTask(InternalAnalysisContext context, Source source, int mod ificationTime, CompilationUnit unit, LibraryElement libraryElement) : super(cont ext) {
11828 this.source = source;
11829 this.modificationTime = modificationTime;
11830 this._unit = unit;
11831 this.libraryElement = libraryElement;
11832 }
11839 11833
11840 @override 11834 @override
11841 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartErrorsTask(thi s); 11835 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartErrorsTask(thi s);
11842 11836
11843 /** 11837 /**
11844 * Return the errors that were generated for the source. 11838 * Return the errors that were generated for the source.
11845 * 11839 *
11846 * @return the errors that were generated for the source 11840 * @return the errors that were generated for the source
11847 */ 11841 */
11848 List<AnalysisError> get errors => _errors; 11842 List<AnalysisError> get errors => _errors;
(...skipping 27 matching lines...) Expand all
11876 } 11870 }
11877 11871
11878 /** 11872 /**
11879 * Instances of the class `GenerateDartHintsTask` generate hints for a single Da rt library. 11873 * Instances of the class `GenerateDartHintsTask` generate hints for a single Da rt library.
11880 */ 11874 */
11881 class GenerateDartHintsTask extends AnalysisTask { 11875 class GenerateDartHintsTask extends AnalysisTask {
11882 /** 11876 /**
11883 * The compilation units that comprise the library, with the defining compilat ion unit appearing 11877 * The compilation units that comprise the library, with the defining compilat ion unit appearing
11884 * first in the array. 11878 * first in the array.
11885 */ 11879 */
11886 final List<TimestampedData<CompilationUnit>> _units; 11880 List<TimestampedData<CompilationUnit>> _units;
11887 11881
11888 /** 11882 /**
11889 * The element model for the library being analyzed. 11883 * The element model for the library being analyzed.
11890 */ 11884 */
11891 final LibraryElement libraryElement; 11885 LibraryElement libraryElement;
11892 11886
11893 /** 11887 /**
11894 * A table mapping the sources that were analyzed to the hints that were gener ated for the 11888 * A table mapping the sources that were analyzed to the hints that were gener ated for the
11895 * sources. 11889 * sources.
11896 */ 11890 */
11897 Map<Source, TimestampedData<List<AnalysisError>>> _hintMap; 11891 Map<Source, TimestampedData<List<AnalysisError>>> _hintMap;
11898 11892
11899 /** 11893 /**
11900 * Initialize a newly created task to perform analysis within the given contex t. 11894 * Initialize a newly created task to perform analysis within the given contex t.
11901 * 11895 *
11902 * @param context the context in which the task is to be performed 11896 * @param context the context in which the task is to be performed
11903 * @param units the compilation units that comprise the library, with the defi ning compilation 11897 * @param units the compilation units that comprise the library, with the defi ning compilation
11904 * unit appearing first in the array 11898 * unit appearing first in the array
11905 * @param libraryElement the element model for the library being analyzed 11899 * @param libraryElement the element model for the library being analyzed
11906 */ 11900 */
11907 GenerateDartHintsTask(InternalAnalysisContext context, this._units, this.libra ryElement) : super(context); 11901 GenerateDartHintsTask(InternalAnalysisContext context, List<TimestampedData<Co mpilationUnit>> units, LibraryElement libraryElement) : super(context) {
11902 this._units = units;
11903 this.libraryElement = libraryElement;
11904 }
11908 11905
11909 @override 11906 @override
11910 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartHintsTask(this ); 11907 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartHintsTask(this );
11911 11908
11912 /** 11909 /**
11913 * Return a table mapping the sources that were analyzed to the hints that wer e generated for the 11910 * Return a table mapping the sources that were analyzed to the hints that wer e generated for the
11914 * sources, or `null` if the task has not been performed or if the analysis di d not complete 11911 * sources, or `null` if the task has not been performed or if the analysis di d not complete
11915 * normally. 11912 * normally.
11916 * 11913 *
11917 * @return a table mapping the sources that were analyzed to the hints that we re generated for the 11914 * @return a table mapping the sources that were analyzed to the hints that we re generated for the
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
11957 } 11954 }
11958 } 11955 }
11959 11956
11960 /** 11957 /**
11961 * Instances of the class `GetContentTask` get the contents of a source. 11958 * Instances of the class `GetContentTask` get the contents of a source.
11962 */ 11959 */
11963 class GetContentTask extends AnalysisTask { 11960 class GetContentTask extends AnalysisTask {
11964 /** 11961 /**
11965 * The source to be read. 11962 * The source to be read.
11966 */ 11963 */
11967 final Source source; 11964 Source source;
11968 11965
11969 /** 11966 /**
11970 * A flag indicating whether this task is complete. 11967 * A flag indicating whether this task is complete.
11971 */ 11968 */
11972 bool _complete = false; 11969 bool _complete = false;
11973 11970
11974 /** 11971 /**
11975 * The contents of the source. 11972 * The contents of the source.
11976 */ 11973 */
11977 String _content; 11974 String _content;
11978 11975
11979 /** 11976 /**
11980 * The time at which the contents of the source were last modified. 11977 * The time at which the contents of the source were last modified.
11981 */ 11978 */
11982 int _modificationTime = -1; 11979 int _modificationTime = -1;
11983 11980
11984 /** 11981 /**
11985 * Initialize a newly created task to perform analysis within the given contex t. 11982 * Initialize a newly created task to perform analysis within the given contex t.
11986 * 11983 *
11987 * @param context the context in which the task is to be performed 11984 * @param context the context in which the task is to be performed
11988 * @param source the source to be parsed 11985 * @param source the source to be parsed
11989 * @param contentData the time-stamped contents of the source 11986 * @param contentData the time-stamped contents of the source
11990 */ 11987 */
11991 GetContentTask(InternalAnalysisContext context, this.source) : super(context) { 11988 GetContentTask(InternalAnalysisContext context, Source source) : super(context ) {
11992 if (source == null) { 11989 if (source == null) {
11993 throw new IllegalArgumentException("Cannot get contents of null source"); 11990 throw new IllegalArgumentException("Cannot get contents of null source");
11994 } 11991 }
11992 this.source = source;
11995 } 11993 }
11996 11994
11997 @override 11995 @override
11998 accept(AnalysisTaskVisitor visitor) => visitor.visitGetContentTask(this); 11996 accept(AnalysisTaskVisitor visitor) => visitor.visitGetContentTask(this);
11999 11997
12000 /** 11998 /**
12001 * Return the contents of the source, or `null` if the task has not completed or if there 11999 * Return the contents of the source, or `null` if the task has not completed or if there
12002 * was an exception while getting the contents. 12000 * was an exception while getting the contents.
12003 * 12001 *
12004 * @return the contents of the source 12002 * @return the contents of the source
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
12040 } 12038 }
12041 } 12039 }
12042 12040
12043 /** 12041 /**
12044 * Instances of the class `IncrementalAnalysisTask` incrementally update existin g analysis. 12042 * Instances of the class `IncrementalAnalysisTask` incrementally update existin g analysis.
12045 */ 12043 */
12046 class IncrementalAnalysisTask extends AnalysisTask { 12044 class IncrementalAnalysisTask extends AnalysisTask {
12047 /** 12045 /**
12048 * The information used to perform incremental analysis. 12046 * The information used to perform incremental analysis.
12049 */ 12047 */
12050 final IncrementalAnalysisCache cache; 12048 IncrementalAnalysisCache cache;
12051 12049
12052 /** 12050 /**
12053 * The compilation unit that was produced by incrementally updating the existi ng unit. 12051 * The compilation unit that was produced by incrementally updating the existi ng unit.
12054 */ 12052 */
12055 CompilationUnit _updatedUnit; 12053 CompilationUnit _updatedUnit;
12056 12054
12057 /** 12055 /**
12058 * Initialize a newly created task to perform analysis within the given contex t. 12056 * Initialize a newly created task to perform analysis within the given contex t.
12059 * 12057 *
12060 * @param context the context in which the task is to be performed 12058 * @param context the context in which the task is to be performed
12061 * @param cache the incremental analysis cache used to perform the analysis 12059 * @param cache the incremental analysis cache used to perform the analysis
12062 */ 12060 */
12063 IncrementalAnalysisTask(InternalAnalysisContext context, this.cache) : super(c ontext); 12061 IncrementalAnalysisTask(InternalAnalysisContext context, IncrementalAnalysisCa che cache) : super(context) {
12062 this.cache = cache;
12063 }
12064 12064
12065 @override 12065 @override
12066 accept(AnalysisTaskVisitor visitor) => visitor.visitIncrementalAnalysisTask(th is); 12066 accept(AnalysisTaskVisitor visitor) => visitor.visitIncrementalAnalysisTask(th is);
12067 12067
12068 /** 12068 /**
12069 * Return the compilation unit that was produced by incrementally updating the existing 12069 * Return the compilation unit that was produced by incrementally updating the existing
12070 * compilation unit, or `null` if the task has not yet been performed, could n ot be 12070 * compilation unit, or `null` if the task has not yet been performed, could n ot be
12071 * performed, or if an exception occurred. 12071 * performed, or if an exception occurred.
12072 * 12072 *
12073 * @return the compilation unit 12073 * @return the compilation unit
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
12132 } 12132 }
12133 } 12133 }
12134 12134
12135 /** 12135 /**
12136 * Instances of the class `ParseDartTask` parse a specific source as a Dart file . 12136 * Instances of the class `ParseDartTask` parse a specific source as a Dart file .
12137 */ 12137 */
12138 class ParseDartTask extends AnalysisTask { 12138 class ParseDartTask extends AnalysisTask {
12139 /** 12139 /**
12140 * The source to be parsed. 12140 * The source to be parsed.
12141 */ 12141 */
12142 final Source source; 12142 Source source;
12143 12143
12144 /** 12144 /**
12145 * The time at which the contents of the source were last modified. 12145 * The time at which the contents of the source were last modified.
12146 */ 12146 */
12147 final int modificationTime; 12147 int modificationTime = 0;
12148 12148
12149 /** 12149 /**
12150 * The head of the token stream used for parsing. 12150 * The head of the token stream used for parsing.
12151 */ 12151 */
12152 final Token _tokenStream; 12152 Token _tokenStream;
12153 12153
12154 /** 12154 /**
12155 * The line information associated with the source. 12155 * The line information associated with the source.
12156 */ 12156 */
12157 final LineInfo lineInfo; 12157 LineInfo lineInfo;
12158 12158
12159 /** 12159 /**
12160 * The compilation unit that was produced by parsing the source. 12160 * The compilation unit that was produced by parsing the source.
12161 */ 12161 */
12162 CompilationUnit _unit; 12162 CompilationUnit _unit;
12163 12163
12164 /** 12164 /**
12165 * A flag indicating whether the source contains a 'library' directive.
12166 */
12167 bool _containsLibraryDirective = false;
12168
12169 /**
12165 * A flag indicating whether the source contains a 'part of' directive. 12170 * A flag indicating whether the source contains a 'part of' directive.
12166 */ 12171 */
12167 bool _containsPartOfDirective = false; 12172 bool _containsPartOfDirective = false;
12168 12173
12169 /** 12174 /**
12170 * A flag indicating whether the source contains any directive other than a 'p art of' directive.
12171 */
12172 bool _containsNonPartOfDirective = false;
12173
12174 /**
12175 * A set containing the sources referenced by 'export' directives. 12175 * A set containing the sources referenced by 'export' directives.
12176 */ 12176 */
12177 Set<Source> _exportedSources = new Set<Source>(); 12177 Set<Source> _exportedSources = new Set<Source>();
12178 12178
12179 /** 12179 /**
12180 * A set containing the sources referenced by 'import' directives. 12180 * A set containing the sources referenced by 'import' directives.
12181 */ 12181 */
12182 Set<Source> _importedSources = new Set<Source>(); 12182 Set<Source> _importedSources = new Set<Source>();
12183 12183
12184 /** 12184 /**
(...skipping 13 matching lines...) Expand all
12198 12198
12199 /** 12199 /**
12200 * Initialize a newly created task to perform analysis within the given contex t. 12200 * Initialize a newly created task to perform analysis within the given contex t.
12201 * 12201 *
12202 * @param context the context in which the task is to be performed 12202 * @param context the context in which the task is to be performed
12203 * @param source the source to be parsed 12203 * @param source the source to be parsed
12204 * @param modificationTime the time at which the contents of the source were l ast modified 12204 * @param modificationTime the time at which the contents of the source were l ast modified
12205 * @param tokenStream the head of the token stream used for parsing 12205 * @param tokenStream the head of the token stream used for parsing
12206 * @param lineInfo the line information associated with the source 12206 * @param lineInfo the line information associated with the source
12207 */ 12207 */
12208 ParseDartTask(InternalAnalysisContext context, this.source, this.modificationT ime, this._tokenStream, this.lineInfo) : super(context); 12208 ParseDartTask(InternalAnalysisContext context, Source source, int modification Time, Token tokenStream, LineInfo lineInfo) : super(context) {
12209 this.source = source;
12210 this.modificationTime = modificationTime;
12211 this._tokenStream = tokenStream;
12212 this.lineInfo = lineInfo;
12213 }
12209 12214
12210 @override 12215 @override
12211 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this); 12216 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this);
12212 12217
12213 /** 12218 /**
12214 * Return the compilation unit that was produced by parsing the source, or `nu ll` if the 12219 * Return the compilation unit that was produced by parsing the source, or `nu ll` if the
12215 * task has not yet been performed or if an exception occurred. 12220 * task has not yet been performed or if an exception occurred.
12216 * 12221 *
12217 * @return the compilation unit that was produced by parsing the source 12222 * @return the compilation unit that was produced by parsing the source
12218 */ 12223 */
(...skipping 25 matching lines...) Expand all
12244 12249
12245 /** 12250 /**
12246 * Return an array containing the sources referenced by 'part' directives, or an empty array if 12251 * Return an array containing the sources referenced by 'part' directives, or an empty array if
12247 * the task has not yet been performed or if an exception occurred. 12252 * the task has not yet been performed or if an exception occurred.
12248 * 12253 *
12249 * @return an array containing the sources referenced by 'part' directives 12254 * @return an array containing the sources referenced by 'part' directives
12250 */ 12255 */
12251 List<Source> get includedSources => _toArray(_includedSources); 12256 List<Source> get includedSources => _toArray(_includedSources);
12252 12257
12253 /** 12258 /**
12254 * Return `true` if the source contains any directive other than a 'part of' d irective, or 12259 * Return `true` if the source contains a 'library' directive, or `false` if t he task
12255 * `false` if the task has not yet been performed or if an exception occurred. 12260 * has not yet been performed or if an exception occurred.
12256 * 12261 *
12257 * @return `true` if the source contains any directive other than a 'part of' directive 12262 * @return `true` if the source contains a 'library' directive
12258 */ 12263 */
12259 bool get hasNonPartOfDirective => _containsNonPartOfDirective; 12264 bool get hasLibraryDirective => _containsLibraryDirective;
12260 12265
12261 /** 12266 /**
12262 * Return `true` if the source contains a 'part of' directive, or `false` if t he task 12267 * Return `true` if the source contains a 'part of' directive, or `false` if t he task
12263 * has not yet been performed or if an exception occurred. 12268 * has not yet been performed or if an exception occurred.
12264 * 12269 *
12265 * @return `true` if the source contains a 'part of' directive 12270 * @return `true` if the source contains a 'part of' directive
12266 */ 12271 */
12267 bool get hasPartOfDirective => _containsPartOfDirective; 12272 bool get hasPartOfDirective => _containsPartOfDirective;
12268 12273
12269 @override 12274 @override
12270 String get taskDescription { 12275 String get taskDescription {
12271 if (source == null) { 12276 if (source == null) {
12272 return "parse as dart null source"; 12277 return "parse as dart null source";
12273 } 12278 }
12274 return "parse as dart ${source.fullName}"; 12279 return "parse as dart ${source.fullName}";
12275 } 12280 }
12276 12281
12277 @override 12282 @override
12278 void internalPerform() { 12283 void internalPerform() {
12279 // 12284 //
12280 // Then parse the token stream. 12285 // Then parse the token stream.
12281 // 12286 //
12282 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse .start(); 12287 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse .start();
12283 try { 12288 try {
12284 RecordingErrorListener errorListener = new RecordingErrorListener(); 12289 RecordingErrorListener errorListener = new RecordingErrorListener();
12285 Parser parser = new Parser(source, errorListener); 12290 Parser parser = new Parser(source, errorListener);
12286 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies ; 12291 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies ;
12287 _unit = parser.parseCompilationUnit(_tokenStream); 12292 _unit = parser.parseCompilationUnit(_tokenStream);
12288 _unit.lineInfo = lineInfo; 12293 _unit.lineInfo = lineInfo;
12294 _errors = errorListener.getErrorsForSource(source);
12289 for (Directive directive in _unit.directives) { 12295 for (Directive directive in _unit.directives) {
12290 if (directive is PartOfDirective) { 12296 if (directive is ExportDirective) {
12297 Source exportSource = _resolveSource(source, directive, errorListener) ;
12298 if (exportSource != null) {
12299 _exportedSources.add(exportSource);
12300 }
12301 } else if (directive is ImportDirective) {
12302 Source importSource = _resolveSource(source, directive, errorListener) ;
12303 if (importSource != null) {
12304 _importedSources.add(importSource);
12305 }
12306 } else if (directive is LibraryDirective) {
12307 _containsLibraryDirective = true;
12308 } else if (directive is PartDirective) {
12309 Source partSource = _resolveSource(source, directive, errorListener);
12310 if (partSource != null && partSource != source) {
12311 _includedSources.add(partSource);
12312 }
12313 } else if (directive is PartOfDirective) {
12291 _containsPartOfDirective = true; 12314 _containsPartOfDirective = true;
12292 } else {
12293 _containsNonPartOfDirective = true;
12294 if (directive is ExportDirective) {
12295 Source exportSource = _resolveSource(source, directive, errorListene r);
12296 if (exportSource != null) {
12297 _exportedSources.add(exportSource);
12298 }
12299 } else if (directive is ImportDirective) {
12300 Source importSource = _resolveSource(source, directive, errorListene r);
12301 if (importSource != null) {
12302 _importedSources.add(importSource);
12303 }
12304 } else if (directive is PartDirective) {
12305 Source partSource = _resolveSource(source, directive, errorListener) ;
12306 if (partSource != null && partSource != source) {
12307 _includedSources.add(partSource);
12308 }
12309 }
12310 } 12315 }
12311 } 12316 }
12312 _errors = errorListener.getErrorsForSource(source);
12313 } finally { 12317 } finally {
12314 timeCounterParse.stop(); 12318 timeCounterParse.stop();
12315 } 12319 }
12316 } 12320 }
12317 12321
12318 /** 12322 /**
12319 * Return the result of resolving the URI of the given URI-based directive aga inst the URI of the 12323 * Return the result of resolving the URI of the given URI-based directive aga inst the URI of the
12320 * given library, or `null` if the URI is not valid. 12324 * given library, or `null` if the URI is not valid.
12321 * 12325 *
12322 * @param librarySource the source representing the library containing the dir ective 12326 * @param librarySource the source representing the library containing the dir ective
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
12366 } 12370 }
12367 } 12371 }
12368 12372
12369 /** 12373 /**
12370 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil e. 12374 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil e.
12371 */ 12375 */
12372 class ParseHtmlTask extends AnalysisTask { 12376 class ParseHtmlTask extends AnalysisTask {
12373 /** 12377 /**
12374 * The source to be parsed. 12378 * The source to be parsed.
12375 */ 12379 */
12376 final Source source; 12380 Source source;
12377 12381
12378 /** 12382 /**
12379 * The time at which the contents of the source were last modified. 12383 * The time at which the contents of the source were last modified.
12380 */ 12384 */
12381 final int modificationTime; 12385 int modificationTime = 0;
12382 12386
12383 /** 12387 /**
12384 * The contents of the source. 12388 * The contents of the source.
12385 */ 12389 */
12386 final String _content; 12390 String _content;
12387 12391
12388 /** 12392 /**
12389 * The line information that was produced. 12393 * The line information that was produced.
12390 */ 12394 */
12391 LineInfo _lineInfo; 12395 LineInfo _lineInfo;
12392 12396
12393 /** 12397 /**
12394 * The HTML unit that was produced by parsing the source. 12398 * The HTML unit that was produced by parsing the source.
12395 */ 12399 */
12396 ht.HtmlUnit _unit; 12400 ht.HtmlUnit _unit;
(...skipping 19 matching lines...) Expand all
12416 static String _TAG_SCRIPT = "script"; 12420 static String _TAG_SCRIPT = "script";
12417 12421
12418 /** 12422 /**
12419 * Initialize a newly created task to perform analysis within the given contex t. 12423 * Initialize a newly created task to perform analysis within the given contex t.
12420 * 12424 *
12421 * @param context the context in which the task is to be performed 12425 * @param context the context in which the task is to be performed
12422 * @param source the source to be parsed 12426 * @param source the source to be parsed
12423 * @param modificationTime the time at which the contents of the source were l ast modified 12427 * @param modificationTime the time at which the contents of the source were l ast modified
12424 * @param content the contents of the source 12428 * @param content the contents of the source
12425 */ 12429 */
12426 ParseHtmlTask(InternalAnalysisContext context, this.source, this.modificationT ime, this._content) : super(context); 12430 ParseHtmlTask(InternalAnalysisContext context, Source source, int modification Time, String content) : super(context) {
12431 this.source = source;
12432 this.modificationTime = modificationTime;
12433 this._content = content;
12434 }
12427 12435
12428 @override 12436 @override
12429 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this); 12437 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this);
12430 12438
12431 /** 12439 /**
12432 * Return the errors that were produced by scanning and parsing the source, or `null` if the 12440 * Return the errors that were produced by scanning and parsing the source, or `null` if the
12433 * task has not yet been performed or if an exception occurred. 12441 * task has not yet been performed or if an exception occurred.
12434 * 12442 *
12435 * @return the errors that were produced by scanning and parsing the source 12443 * @return the errors that were produced by scanning and parsing the source
12436 */ 12444 */
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
12528 } 12536 }
12529 12537
12530 /** 12538 /**
12531 * Instances of the class `ResolveAngularComponentTemplateTask` resolve HTML tem plate 12539 * Instances of the class `ResolveAngularComponentTemplateTask` resolve HTML tem plate
12532 * referenced by [AngularComponentElement]. 12540 * referenced by [AngularComponentElement].
12533 */ 12541 */
12534 class ResolveAngularComponentTemplateTask extends AnalysisTask { 12542 class ResolveAngularComponentTemplateTask extends AnalysisTask {
12535 /** 12543 /**
12536 * The source to be resolved. 12544 * The source to be resolved.
12537 */ 12545 */
12538 final Source source; 12546 Source source;
12539 12547
12540 /** 12548 /**
12541 * The time at which the contents of the source were last modified. 12549 * The time at which the contents of the source were last modified.
12542 */ 12550 */
12543 final int modificationTime; 12551 int modificationTime = 0;
12544 12552
12545 /** 12553 /**
12546 * The HTML unit to be resolved. 12554 * The HTML unit to be resolved.
12547 */ 12555 */
12548 final ht.HtmlUnit _unit; 12556 ht.HtmlUnit _unit;
12549 12557
12550 /** 12558 /**
12551 * The [AngularComponentElement] to resolve template for. 12559 * The [AngularComponentElement] to resolve template for.
12552 */ 12560 */
12553 final AngularComponentElement _component; 12561 AngularComponentElement _component;
12554 12562
12555 /** 12563 /**
12556 * The Angular application to resolve in context of. 12564 * The Angular application to resolve in context of.
12557 */ 12565 */
12558 final AngularApplication _application; 12566 AngularApplication _application;
12559 12567
12560 /** 12568 /**
12561 * The [HtmlUnit] that was resolved by this task. 12569 * The [HtmlUnit] that was resolved by this task.
12562 */ 12570 */
12563 ht.HtmlUnit _resolvedUnit; 12571 ht.HtmlUnit _resolvedUnit;
12564 12572
12565 /** 12573 /**
12566 * The resolution errors that were discovered while resolving the source. 12574 * The resolution errors that were discovered while resolving the source.
12567 */ 12575 */
12568 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; 12576 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS;
12569 12577
12570 /** 12578 /**
12571 * Initialize a newly created task to perform analysis within the given contex t. 12579 * Initialize a newly created task to perform analysis within the given contex t.
12572 * 12580 *
12573 * @param context the context in which the task is to be performed 12581 * @param context the context in which the task is to be performed
12574 * @param source the source to be resolved 12582 * @param source the source to be resolved
12575 * @param modificationTime the time at which the contents of the source were l ast modified 12583 * @param modificationTime the time at which the contents of the source were l ast modified
12576 * @param unit the HTML unit to be resolved 12584 * @param unit the HTML unit to be resolved
12577 * @param component the component that uses this HTML template, not `null` 12585 * @param component the component that uses this HTML template, not `null`
12578 * @param application the Angular application to resolve in context of 12586 * @param application the Angular application to resolve in context of
12579 */ 12587 */
12580 ResolveAngularComponentTemplateTask(InternalAnalysisContext context, this.sour ce, this.modificationTime, this._unit, this._component, this._application) : sup er(context); 12588 ResolveAngularComponentTemplateTask(InternalAnalysisContext context, Source so urce, int modificationTime, ht.HtmlUnit unit, AngularComponentElement component, AngularApplication application) : super(context) {
12589 this.source = source;
12590 this.modificationTime = modificationTime;
12591 this._unit = unit;
12592 this._component = component;
12593 this._application = application;
12594 }
12581 12595
12582 @override 12596 @override
12583 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularComponentTem plateTask(this); 12597 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularComponentTem plateTask(this);
12584 12598
12585 List<AnalysisError> get resolutionErrors => _resolutionErrors; 12599 List<AnalysisError> get resolutionErrors => _resolutionErrors;
12586 12600
12587 /** 12601 /**
12588 * Return the [HtmlUnit] that was resolved by this task. 12602 * Return the [HtmlUnit] that was resolved by this task.
12589 * 12603 *
12590 * @return the [HtmlUnit] that was resolved by this task 12604 * @return the [HtmlUnit] that was resolved by this task
(...skipping 26 matching lines...) Expand all
12617 } 12631 }
12618 12632
12619 /** 12633 /**
12620 * Instances of the class `ResolveAngularEntryHtmlTask` resolve a specific HTML file as an 12634 * Instances of the class `ResolveAngularEntryHtmlTask` resolve a specific HTML file as an
12621 * Angular entry point. 12635 * Angular entry point.
12622 */ 12636 */
12623 class ResolveAngularEntryHtmlTask extends AnalysisTask { 12637 class ResolveAngularEntryHtmlTask extends AnalysisTask {
12624 /** 12638 /**
12625 * The source to be resolved. 12639 * The source to be resolved.
12626 */ 12640 */
12627 final Source source; 12641 Source source;
12628 12642
12629 /** 12643 /**
12630 * The time at which the contents of the source were last modified. 12644 * The time at which the contents of the source were last modified.
12631 */ 12645 */
12632 final int modificationTime; 12646 int modificationTime = 0;
12633 12647
12634 /** 12648 /**
12635 * The HTML unit to be resolved. 12649 * The HTML unit to be resolved.
12636 */ 12650 */
12637 final ht.HtmlUnit _unit; 12651 ht.HtmlUnit _unit;
12638 12652
12639 /** 12653 /**
12640 * The listener to record errors. 12654 * The listener to record errors.
12641 */ 12655 */
12642 RecordingErrorListener _errorListener = new RecordingErrorListener(); 12656 RecordingErrorListener _errorListener = new RecordingErrorListener();
12643 12657
12644 /** 12658 /**
12645 * The [HtmlUnit] that was resolved by this task. 12659 * The [HtmlUnit] that was resolved by this task.
12646 */ 12660 */
12647 ht.HtmlUnit _resolvedUnit; 12661 ht.HtmlUnit _resolvedUnit;
12648 12662
12649 /** 12663 /**
12650 * The element produced by resolving the source. 12664 * The element produced by resolving the source.
12651 */ 12665 */
12652 HtmlElement _element = null; 12666 HtmlElement _element = null;
12653 12667
12654 /** 12668 /**
12655 * The Angular application to resolve in context of. 12669 * The Angular application to resolve in context of.
12656 */ 12670 */
12657 AngularApplication _application; 12671 AngularApplication _application;
12658 12672
12659 /** 12673 /**
12660 * Initialize a newly created task to perform analysis within the given contex t. 12674 * Initialize a newly created task to perform analysis within the given contex t.
12661 * 12675 *
12662 * @param context the context in which the task is to be performed 12676 * @param context the context in which the task is to be performed
12663 * @param source the source to be resolved 12677 * @param source the source to be resolved
12664 * @param modificationTime the time at which the contents of the source were l ast modified 12678 * @param modificationTime the time at which the contents of the source were l ast modified
12665 * @param unit the HTML unit to be resolved 12679 * @param unit the HTML unit to be resolved
12666 */ 12680 */
12667 ResolveAngularEntryHtmlTask(InternalAnalysisContext context, this.source, this .modificationTime, this._unit) : super(context); 12681 ResolveAngularEntryHtmlTask(InternalAnalysisContext context, Source source, in t modificationTime, ht.HtmlUnit unit) : super(context) {
12682 this.source = source;
12683 this.modificationTime = modificationTime;
12684 this._unit = unit;
12685 }
12668 12686
12669 @override 12687 @override
12670 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularEntryHtmlTas k(this); 12688 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularEntryHtmlTas k(this);
12671 12689
12672 /** 12690 /**
12673 * Returns the [AngularApplication] for the Web application with this Angular entry point, 12691 * Returns the [AngularApplication] for the Web application with this Angular entry point,
12674 * maybe `null` if not an Angular entry point. 12692 * maybe `null` if not an Angular entry point.
12675 */ 12693 */
12676 AngularApplication get application => _application; 12694 AngularApplication get application => _application;
12677 12695
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
12726 } 12744 }
12727 12745
12728 /** 12746 /**
12729 * Instances of the class `ResolveDartLibraryTask` resolve a specific Dart libra ry. 12747 * Instances of the class `ResolveDartLibraryTask` resolve a specific Dart libra ry.
12730 */ 12748 */
12731 class ResolveDartLibraryCycleTask extends AnalysisTask { 12749 class ResolveDartLibraryCycleTask extends AnalysisTask {
12732 /** 12750 /**
12733 * The source representing the file whose compilation unit is to be returned. TODO(brianwilkerson) 12751 * The source representing the file whose compilation unit is to be returned. TODO(brianwilkerson)
12734 * This should probably be removed, but is being left in for now to ease the t ransition. 12752 * This should probably be removed, but is being left in for now to ease the t ransition.
12735 */ 12753 */
12736 final Source unitSource; 12754 Source unitSource;
12737 12755
12738 /** 12756 /**
12739 * The source representing the library to be resolved. 12757 * The source representing the library to be resolved.
12740 */ 12758 */
12741 final Source librarySource; 12759 Source librarySource;
12742 12760
12743 /** 12761 /**
12744 * The libraries that are part of the cycle containing the library to be resol ved. 12762 * The libraries that are part of the cycle containing the library to be resol ved.
12745 */ 12763 */
12746 final List<ResolvableLibrary> _librariesInCycle; 12764 List<ResolvableLibrary> _librariesInCycle;
12747 12765
12748 /** 12766 /**
12749 * The library resolver holding information about the libraries that were reso lved. 12767 * The library resolver holding information about the libraries that were reso lved.
12750 */ 12768 */
12751 LibraryResolver2 _resolver; 12769 LibraryResolver2 _resolver;
12752 12770
12753 /** 12771 /**
12754 * Initialize a newly created task to perform analysis within the given contex t. 12772 * Initialize a newly created task to perform analysis within the given contex t.
12755 * 12773 *
12756 * @param context the context in which the task is to be performed 12774 * @param context the context in which the task is to be performed
12757 * @param unitSource the source representing the file whose compilation unit i s to be returned 12775 * @param unitSource the source representing the file whose compilation unit i s to be returned
12758 * @param librarySource the source representing the library to be resolved 12776 * @param librarySource the source representing the library to be resolved
12759 * @param librariesInCycle the libraries that are part of the cycle containing the library to be 12777 * @param librariesInCycle the libraries that are part of the cycle containing the library to be
12760 * resolved 12778 * resolved
12761 */ 12779 */
12762 ResolveDartLibraryCycleTask(InternalAnalysisContext context, this.unitSource, this.librarySource, this._librariesInCycle) : super(context); 12780 ResolveDartLibraryCycleTask(InternalAnalysisContext context, Source unitSource , Source librarySource, List<ResolvableLibrary> librariesInCycle) : super(contex t) {
12781 this.unitSource = unitSource;
12782 this.librarySource = librarySource;
12783 this._librariesInCycle = librariesInCycle;
12784 }
12763 12785
12764 @override 12786 @override
12765 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartLibraryCycleTas k(this); 12787 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartLibraryCycleTas k(this);
12766 12788
12767 /** 12789 /**
12768 * Return the library resolver holding information about the libraries that we re resolved. 12790 * Return the library resolver holding information about the libraries that we re resolved.
12769 * 12791 *
12770 * @return the library resolver holding information about the libraries that w ere resolved 12792 * @return the library resolver holding information about the libraries that w ere resolved
12771 */ 12793 */
12772 LibraryResolver2 get libraryResolver => _resolver; 12794 LibraryResolver2 get libraryResolver => _resolver;
(...skipping 13 matching lines...) Expand all
12786 } 12808 }
12787 } 12809 }
12788 12810
12789 /** 12811 /**
12790 * Instances of the class `ResolveDartLibraryTask` resolve a specific Dart libra ry. 12812 * Instances of the class `ResolveDartLibraryTask` resolve a specific Dart libra ry.
12791 */ 12813 */
12792 class ResolveDartLibraryTask extends AnalysisTask { 12814 class ResolveDartLibraryTask extends AnalysisTask {
12793 /** 12815 /**
12794 * The source representing the file whose compilation unit is to be returned. 12816 * The source representing the file whose compilation unit is to be returned.
12795 */ 12817 */
12796 final Source unitSource; 12818 Source unitSource;
12797 12819
12798 /** 12820 /**
12799 * The source representing the library to be resolved. 12821 * The source representing the library to be resolved.
12800 */ 12822 */
12801 final Source librarySource; 12823 Source librarySource;
12802 12824
12803 /** 12825 /**
12804 * The library resolver holding information about the libraries that were reso lved. 12826 * The library resolver holding information about the libraries that were reso lved.
12805 */ 12827 */
12806 LibraryResolver _resolver; 12828 LibraryResolver _resolver;
12807 12829
12808 /** 12830 /**
12809 * Initialize a newly created task to perform analysis within the given contex t. 12831 * Initialize a newly created task to perform analysis within the given contex t.
12810 * 12832 *
12811 * @param context the context in which the task is to be performed 12833 * @param context the context in which the task is to be performed
12812 * @param unitSource the source representing the file whose compilation unit i s to be returned 12834 * @param unitSource the source representing the file whose compilation unit i s to be returned
12813 * @param librarySource the source representing the library to be resolved 12835 * @param librarySource the source representing the library to be resolved
12814 */ 12836 */
12815 ResolveDartLibraryTask(InternalAnalysisContext context, this.unitSource, this. librarySource) : super(context); 12837 ResolveDartLibraryTask(InternalAnalysisContext context, Source unitSource, Sou rce librarySource) : super(context) {
12838 this.unitSource = unitSource;
12839 this.librarySource = librarySource;
12840 }
12816 12841
12817 @override 12842 @override
12818 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartLibraryTask(thi s); 12843 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartLibraryTask(thi s);
12819 12844
12820 /** 12845 /**
12821 * Return the library resolver holding information about the libraries that we re resolved. 12846 * Return the library resolver holding information about the libraries that we re resolved.
12822 * 12847 *
12823 * @return the library resolver holding information about the libraries that w ere resolved 12848 * @return the library resolver holding information about the libraries that w ere resolved
12824 */ 12849 */
12825 LibraryResolver get libraryResolver => _resolver; 12850 LibraryResolver get libraryResolver => _resolver;
(...skipping 14 matching lines...) Expand all
12840 } 12865 }
12841 12866
12842 /** 12867 /**
12843 * Instances of the class `ResolveDartUnitTask` resolve a single Dart file based on a existing 12868 * Instances of the class `ResolveDartUnitTask` resolve a single Dart file based on a existing
12844 * element model. 12869 * element model.
12845 */ 12870 */
12846 class ResolveDartUnitTask extends AnalysisTask { 12871 class ResolveDartUnitTask extends AnalysisTask {
12847 /** 12872 /**
12848 * The source that is to be resolved. 12873 * The source that is to be resolved.
12849 */ 12874 */
12850 final Source source; 12875 Source source;
12851 12876
12852 /** 12877 /**
12853 * The element model for the library containing the source. 12878 * The element model for the library containing the source.
12854 */ 12879 */
12855 final LibraryElement _libraryElement; 12880 LibraryElement _libraryElement;
12856 12881
12857 /** 12882 /**
12858 * The time at which the contents of the source were last modified. 12883 * The time at which the contents of the source were last modified.
12859 */ 12884 */
12860 int _modificationTime = -1; 12885 int _modificationTime = -1;
12861 12886
12862 /** 12887 /**
12863 * The compilation unit that was resolved by this task. 12888 * The compilation unit that was resolved by this task.
12864 */ 12889 */
12865 CompilationUnit _resolvedUnit; 12890 CompilationUnit _resolvedUnit;
12866 12891
12867 /** 12892 /**
12868 * Initialize a newly created task to perform analysis within the given contex t. 12893 * Initialize a newly created task to perform analysis within the given contex t.
12869 * 12894 *
12870 * @param context the context in which the task is to be performed 12895 * @param context the context in which the task is to be performed
12871 * @param source the source to be parsed 12896 * @param source the source to be parsed
12872 * @param libraryElement the element model for the library containing the sour ce 12897 * @param libraryElement the element model for the library containing the sour ce
12873 */ 12898 */
12874 ResolveDartUnitTask(InternalAnalysisContext context, this.source, this._librar yElement) : super(context); 12899 ResolveDartUnitTask(InternalAnalysisContext context, Source source, LibraryEle ment libraryElement) : super(context) {
12900 this.source = source;
12901 this._libraryElement = libraryElement;
12902 }
12875 12903
12876 @override 12904 @override
12877 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this); 12905 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this);
12878 12906
12879 /** 12907 /**
12880 * Return the source for the library containing the source that is to be resol ved. 12908 * Return the source for the library containing the source that is to be resol ved.
12881 * 12909 *
12882 * @return the source for the library containing the source that is to be reso lved 12910 * @return the source for the library containing the source that is to be reso lved
12883 */ 12911 */
12884 Source get librarySource => _libraryElement.source; 12912 Source get librarySource => _libraryElement.source;
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
12980 } 13008 }
12981 } 13009 }
12982 13010
12983 /** 13011 /**
12984 * Instances of the class `ResolveHtmlTask` resolve a specific source as an HTML file. 13012 * Instances of the class `ResolveHtmlTask` resolve a specific source as an HTML file.
12985 */ 13013 */
12986 class ResolveHtmlTask extends AnalysisTask { 13014 class ResolveHtmlTask extends AnalysisTask {
12987 /** 13015 /**
12988 * The source to be resolved. 13016 * The source to be resolved.
12989 */ 13017 */
12990 final Source source; 13018 Source source;
12991 13019
12992 /** 13020 /**
12993 * The time at which the contents of the source were last modified. 13021 * The time at which the contents of the source were last modified.
12994 */ 13022 */
12995 final int modificationTime; 13023 int modificationTime = 0;
12996 13024
12997 /** 13025 /**
12998 * The HTML unit to be resolved. 13026 * The HTML unit to be resolved.
12999 */ 13027 */
13000 final ht.HtmlUnit _unit; 13028 ht.HtmlUnit _unit;
13001 13029
13002 /** 13030 /**
13003 * The [HtmlUnit] that was resolved by this task. 13031 * The [HtmlUnit] that was resolved by this task.
13004 */ 13032 */
13005 ht.HtmlUnit _resolvedUnit; 13033 ht.HtmlUnit _resolvedUnit;
13006 13034
13007 /** 13035 /**
13008 * The element produced by resolving the source. 13036 * The element produced by resolving the source.
13009 */ 13037 */
13010 HtmlElement _element = null; 13038 HtmlElement _element = null;
13011 13039
13012 /** 13040 /**
13013 * The resolution errors that were discovered while resolving the source. 13041 * The resolution errors that were discovered while resolving the source.
13014 */ 13042 */
13015 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; 13043 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS;
13016 13044
13017 /** 13045 /**
13018 * Initialize a newly created task to perform analysis within the given contex t. 13046 * Initialize a newly created task to perform analysis within the given contex t.
13019 * 13047 *
13020 * @param context the context in which the task is to be performed 13048 * @param context the context in which the task is to be performed
13021 * @param source the source to be resolved 13049 * @param source the source to be resolved
13022 * @param modificationTime the time at which the contents of the source were l ast modified 13050 * @param modificationTime the time at which the contents of the source were l ast modified
13023 * @param unit the HTML unit to be resolved 13051 * @param unit the HTML unit to be resolved
13024 */ 13052 */
13025 ResolveHtmlTask(InternalAnalysisContext context, this.source, this.modificatio nTime, this._unit) : super(context); 13053 ResolveHtmlTask(InternalAnalysisContext context, Source source, int modificati onTime, ht.HtmlUnit unit) : super(context) {
13054 this.source = source;
13055 this.modificationTime = modificationTime;
13056 this._unit = unit;
13057 }
13026 13058
13027 @override 13059 @override
13028 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveHtmlTask(this); 13060 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveHtmlTask(this);
13029 13061
13030 HtmlElement get element => _element; 13062 HtmlElement get element => _element;
13031 13063
13032 List<AnalysisError> get resolutionErrors => _resolutionErrors; 13064 List<AnalysisError> get resolutionErrors => _resolutionErrors;
13033 13065
13034 /** 13066 /**
13035 * Return the [HtmlUnit] that was resolved by this task. 13067 * Return the [HtmlUnit] that was resolved by this task.
(...skipping 29 matching lines...) Expand all
13065 } 13097 }
13066 } 13098 }
13067 13099
13068 /** 13100 /**
13069 * Instances of the class `ScanDartTask` scan a specific source as a Dart file. 13101 * Instances of the class `ScanDartTask` scan a specific source as a Dart file.
13070 */ 13102 */
13071 class ScanDartTask extends AnalysisTask { 13103 class ScanDartTask extends AnalysisTask {
13072 /** 13104 /**
13073 * The source to be scanned. 13105 * The source to be scanned.
13074 */ 13106 */
13075 final Source source; 13107 Source source;
13076 13108
13077 /** 13109 /**
13078 * The time at which the contents of the source were last modified. 13110 * The time at which the contents of the source were last modified.
13079 */ 13111 */
13080 final int modificationTime; 13112 int modificationTime = 0;
13081 13113
13082 /** 13114 /**
13083 * The contents of the source. 13115 * The contents of the source.
13084 */ 13116 */
13085 final String _content; 13117 String _content;
13086 13118
13087 /** 13119 /**
13088 * The token stream that was produced by scanning the source. 13120 * The token stream that was produced by scanning the source.
13089 */ 13121 */
13090 Token _tokenStream; 13122 Token _tokenStream;
13091 13123
13092 /** 13124 /**
13093 * The line information that was produced. 13125 * The line information that was produced.
13094 */ 13126 */
13095 LineInfo _lineInfo; 13127 LineInfo _lineInfo;
13096 13128
13097 /** 13129 /**
13098 * The errors that were produced by scanning the source. 13130 * The errors that were produced by scanning the source.
13099 */ 13131 */
13100 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; 13132 List<AnalysisError> _errors = AnalysisError.NO_ERRORS;
13101 13133
13102 /** 13134 /**
13103 * Initialize a newly created task to perform analysis within the given contex t. 13135 * Initialize a newly created task to perform analysis within the given contex t.
13104 * 13136 *
13105 * @param context the context in which the task is to be performed 13137 * @param context the context in which the task is to be performed
13106 * @param source the source to be parsed 13138 * @param source the source to be parsed
13107 * @param modificationTime the time at which the contents of the source were l ast modified 13139 * @param modificationTime the time at which the contents of the source were l ast modified
13108 * @param content the contents of the source 13140 * @param content the contents of the source
13109 */ 13141 */
13110 ScanDartTask(InternalAnalysisContext context, this.source, this.modificationTi me, this._content) : super(context); 13142 ScanDartTask(InternalAnalysisContext context, Source source, int modificationT ime, String content) : super(context) {
13143 this.source = source;
13144 this.modificationTime = modificationTime;
13145 this._content = content;
13146 }
13111 13147
13112 @override 13148 @override
13113 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this); 13149 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this);
13114 13150
13115 /** 13151 /**
13116 * Return the errors that were produced by scanning the source, or `null` if t he task has 13152 * Return the errors that were produced by scanning the source, or `null` if t he task has
13117 * not yet been performed or if an exception occurred. 13153 * not yet been performed or if an exception occurred.
13118 * 13154 *
13119 * @return the errors that were produced by scanning the source 13155 * @return the errors that were produced by scanning the source
13120 */ 13156 */
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
13250 } 13286 }
13251 13287
13252 @override 13288 @override
13253 void logInformation(String message) { 13289 void logInformation(String message) {
13254 } 13290 }
13255 13291
13256 @override 13292 @override
13257 void logInformation2(String message, Exception exception) { 13293 void logInformation2(String message, Exception exception) {
13258 } 13294 }
13259 } 13295 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | pkg/analyzer/lib/src/generated/error.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698