| OLD | NEW |
| 1 // This code was auto-generated, is not intended to be edited, and is subject to | 1 // This code was auto-generated, is not intended to be edited, and is subject to |
| 2 // significant change. Please see the README file for more information. | 2 // significant change. Please see the README file for more information. |
| 3 library engine; | 3 library engine; |
| 4 import 'java_core.dart'; | 4 import 'java_core.dart'; |
| 5 import 'java_engine.dart'; | 5 import 'java_engine.dart'; |
| 6 import 'utilities_collection.dart'; | 6 import 'utilities_collection.dart'; |
| 7 import 'utilities_general.dart'; | 7 import 'utilities_general.dart'; |
| 8 import 'instrumentation.dart'; | 8 import 'instrumentation.dart'; |
| 9 import 'error.dart'; | 9 import 'error.dart'; |
| 10 import 'source.dart'; | 10 import 'source.dart'; |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1151 * The data descriptor representing the resolved AST structure. | 1151 * The data descriptor representing the resolved AST structure. |
| 1152 */ | 1152 */ |
| 1153 static final DataDescriptor<CompilationUnit> RESOLVED_UNIT = new DataDescripto
r<CompilationUnit>("DartEntry.RESOLVED_UNIT"); | 1153 static final DataDescriptor<CompilationUnit> RESOLVED_UNIT = new DataDescripto
r<CompilationUnit>("DartEntry.RESOLVED_UNIT"); |
| 1154 | 1154 |
| 1155 /** | 1155 /** |
| 1156 * The data descriptor representing the source kind. | 1156 * The data descriptor representing the source kind. |
| 1157 */ | 1157 */ |
| 1158 static final DataDescriptor<SourceKind> SOURCE_KIND = new DataDescriptor<Sourc
eKind>("DartEntry.SOURCE_KIND"); | 1158 static final DataDescriptor<SourceKind> SOURCE_KIND = new DataDescriptor<Sourc
eKind>("DartEntry.SOURCE_KIND"); |
| 1159 | 1159 |
| 1160 /** | 1160 /** |
| 1161 * The data descriptor representing the errors resulting from verifying the so
urce. |
| 1162 */ |
| 1163 static final DataDescriptor<List<AnalysisError>> VERIFICATION_ERRORS = new Dat
aDescriptor<List<AnalysisError>>("DartEntry.VERIFICATION_ERRORS"); |
| 1164 |
| 1165 /** |
| 1161 * Return all of the errors associated with the compilation unit that are curr
ently cached. | 1166 * Return all of the errors associated with the compilation unit that are curr
ently cached. |
| 1162 * | 1167 * |
| 1163 * @return all of the errors associated with the compilation unit | 1168 * @return all of the errors associated with the compilation unit |
| 1164 */ | 1169 */ |
| 1165 List<AnalysisError> get allErrors; | 1170 List<AnalysisError> get allErrors; |
| 1166 | 1171 |
| 1167 /** | 1172 /** |
| 1168 * Return a valid parsed compilation unit, either an unresolved AST structure
or the result of | 1173 * Return a valid parsed compilation unit, either an unresolved AST structure
or the result of |
| 1169 * resolving the AST structure in the context of some library, or `null` if th
ere is no | 1174 * resolving the AST structure in the context of some library, or `null` if th
ere is no |
| 1170 * parsed compilation unit available. | 1175 * parsed compilation unit available. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1350 List<AnalysisError> get allErrors { | 1355 List<AnalysisError> get allErrors { |
| 1351 List<AnalysisError> errors = new List<AnalysisError>(); | 1356 List<AnalysisError> errors = new List<AnalysisError>(); |
| 1352 for (AnalysisError error in _parseErrors) { | 1357 for (AnalysisError error in _parseErrors) { |
| 1353 errors.add(error); | 1358 errors.add(error); |
| 1354 } | 1359 } |
| 1355 DartEntryImpl_ResolutionState state = _resolutionState; | 1360 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1356 while (state != null) { | 1361 while (state != null) { |
| 1357 for (AnalysisError error in state._resolutionErrors) { | 1362 for (AnalysisError error in state._resolutionErrors) { |
| 1358 errors.add(error); | 1363 errors.add(error); |
| 1359 } | 1364 } |
| 1365 for (AnalysisError error in state._verificationErrors) { |
| 1366 errors.add(error); |
| 1367 } |
| 1360 for (AnalysisError error in state._hints) { | 1368 for (AnalysisError error in state._hints) { |
| 1361 errors.add(error); | 1369 errors.add(error); |
| 1362 } | 1370 } |
| 1363 state = state._nextState; | 1371 state = state._nextState; |
| 1364 } | 1372 } |
| 1365 ; | 1373 ; |
| 1366 if (errors.length == 0) { | 1374 if (errors.length == 0) { |
| 1367 return AnalysisError.NO_ERRORS; | 1375 return AnalysisError.NO_ERRORS; |
| 1368 } | 1376 } |
| 1369 return new List.from(errors); | 1377 return new List.from(errors); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1441 } | 1449 } |
| 1442 } | 1450 } |
| 1443 CacheState getState2(DataDescriptor descriptor, Source librarySource) { | 1451 CacheState getState2(DataDescriptor descriptor, Source librarySource) { |
| 1444 DartEntryImpl_ResolutionState state = _resolutionState; | 1452 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1445 while (state != null) { | 1453 while (state != null) { |
| 1446 if (librarySource == state._librarySource) { | 1454 if (librarySource == state._librarySource) { |
| 1447 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { | 1455 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { |
| 1448 return state._resolutionErrorsState; | 1456 return state._resolutionErrorsState; |
| 1449 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 1457 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 1450 return state._resolvedUnitState; | 1458 return state._resolvedUnitState; |
| 1459 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 1460 return state._verificationErrorsState; |
| 1451 } else if (identical(descriptor, DartEntry.HINTS)) { | 1461 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 1452 return state._hintsState; | 1462 return state._hintsState; |
| 1453 } else { | 1463 } else { |
| 1454 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); | 1464 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); |
| 1455 } | 1465 } |
| 1456 } | 1466 } |
| 1457 state = state._nextState; | 1467 state = state._nextState; |
| 1458 } | 1468 } |
| 1459 ; | 1469 ; |
| 1460 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS) || identical(descript
or, DartEntry.RESOLVED_UNIT) || identical(descriptor, DartEntry.HINTS)) { | 1470 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS) || identical(descript
or, DartEntry.RESOLVED_UNIT) || identical(descriptor, DartEntry.VERIFICATION_ERR
ORS) || identical(descriptor, DartEntry.HINTS)) { |
| 1461 return CacheState.INVALID; | 1471 return CacheState.INVALID; |
| 1462 } else { | 1472 } else { |
| 1463 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 1473 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 1464 } | 1474 } |
| 1465 } | 1475 } |
| 1466 Object getValue(DataDescriptor descriptor) { | 1476 Object getValue(DataDescriptor descriptor) { |
| 1467 if (identical(descriptor, DartEntry.ELEMENT)) { | 1477 if (identical(descriptor, DartEntry.ELEMENT)) { |
| 1468 return _element as Object; | 1478 return _element as Object; |
| 1469 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 1479 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 1470 return _exportedLibraries as Object; | 1480 return _exportedLibraries as Object; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1489 return super.getValue(descriptor); | 1499 return super.getValue(descriptor); |
| 1490 } | 1500 } |
| 1491 Object getValue2(DataDescriptor descriptor, Source librarySource) { | 1501 Object getValue2(DataDescriptor descriptor, Source librarySource) { |
| 1492 DartEntryImpl_ResolutionState state = _resolutionState; | 1502 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1493 while (state != null) { | 1503 while (state != null) { |
| 1494 if (librarySource == state._librarySource) { | 1504 if (librarySource == state._librarySource) { |
| 1495 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { | 1505 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { |
| 1496 return state._resolutionErrors as Object; | 1506 return state._resolutionErrors as Object; |
| 1497 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 1507 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 1498 return state._resolvedUnit as Object; | 1508 return state._resolvedUnit as Object; |
| 1509 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 1510 return state._verificationErrors as Object; |
| 1499 } else if (identical(descriptor, DartEntry.HINTS)) { | 1511 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 1500 return state._hints as Object; | 1512 return state._hints as Object; |
| 1501 } else { | 1513 } else { |
| 1502 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); | 1514 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); |
| 1503 } | 1515 } |
| 1504 } | 1516 } |
| 1505 state = state._nextState; | 1517 state = state._nextState; |
| 1506 } | 1518 } |
| 1507 ; | 1519 ; |
| 1508 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS) || identical(descript
or, DartEntry.HINTS)) { | 1520 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS) || identical(descript
or, DartEntry.VERIFICATION_ERRORS) || identical(descriptor, DartEntry.HINTS)) { |
| 1509 return AnalysisError.NO_ERRORS as Object; | 1521 return AnalysisError.NO_ERRORS as Object; |
| 1510 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 1522 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 1511 return null; | 1523 return null; |
| 1512 } else { | 1524 } else { |
| 1513 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 1525 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 1514 } | 1526 } |
| 1515 } | 1527 } |
| 1516 DartEntryImpl get writableCopy { | 1528 DartEntryImpl get writableCopy { |
| 1517 DartEntryImpl copy = new DartEntryImpl(); | 1529 DartEntryImpl copy = new DartEntryImpl(); |
| 1518 copy.copyFrom(this); | 1530 copy.copyFrom(this); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1772 * @param cacheState the new state of the data represented by the given descri
ptor | 1784 * @param cacheState the new state of the data represented by the given descri
ptor |
| 1773 */ | 1785 */ |
| 1774 void setState2(DataDescriptor descriptor, Source librarySource, CacheState cac
heState) { | 1786 void setState2(DataDescriptor descriptor, Source librarySource, CacheState cac
heState) { |
| 1775 DartEntryImpl_ResolutionState state = getOrCreateResolutionState(librarySour
ce); | 1787 DartEntryImpl_ResolutionState state = getOrCreateResolutionState(librarySour
ce); |
| 1776 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { | 1788 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { |
| 1777 state._resolutionErrors = updatedValue(cacheState, state._resolutionErrors
, AnalysisError.NO_ERRORS); | 1789 state._resolutionErrors = updatedValue(cacheState, state._resolutionErrors
, AnalysisError.NO_ERRORS); |
| 1778 state._resolutionErrorsState = cacheState; | 1790 state._resolutionErrorsState = cacheState; |
| 1779 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 1791 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 1780 state._resolvedUnit = updatedValue(cacheState, state._resolvedUnit, null); | 1792 state._resolvedUnit = updatedValue(cacheState, state._resolvedUnit, null); |
| 1781 state._resolvedUnitState = cacheState; | 1793 state._resolvedUnitState = cacheState; |
| 1794 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 1795 state._verificationErrors = updatedValue(cacheState, state._verificationEr
rors, AnalysisError.NO_ERRORS); |
| 1796 state._verificationErrorsState = cacheState; |
| 1782 } else if (identical(descriptor, DartEntry.HINTS)) { | 1797 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 1783 state._hints = updatedValue(cacheState, state._hints, AnalysisError.NO_ERR
ORS); | 1798 state._hints = updatedValue(cacheState, state._hints, AnalysisError.NO_ERR
ORS); |
| 1784 state._hintsState = cacheState; | 1799 state._hintsState = cacheState; |
| 1785 } else { | 1800 } else { |
| 1786 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 1801 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 1787 } | 1802 } |
| 1788 } | 1803 } |
| 1789 void setValue(DataDescriptor descriptor, Object value) { | 1804 void setValue(DataDescriptor descriptor, Object value) { |
| 1790 if (identical(descriptor, DartEntry.ELEMENT)) { | 1805 if (identical(descriptor, DartEntry.ELEMENT)) { |
| 1791 _element = value as LibraryElement; | 1806 _element = value as LibraryElement; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1833 * @param value the new value of the data represented by the given descriptor
and library | 1848 * @param value the new value of the data represented by the given descriptor
and library |
| 1834 */ | 1849 */ |
| 1835 void setValue2(DataDescriptor descriptor, Source librarySource, Object value)
{ | 1850 void setValue2(DataDescriptor descriptor, Source librarySource, Object value)
{ |
| 1836 DartEntryImpl_ResolutionState state = getOrCreateResolutionState(librarySour
ce); | 1851 DartEntryImpl_ResolutionState state = getOrCreateResolutionState(librarySour
ce); |
| 1837 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { | 1852 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { |
| 1838 state._resolutionErrors = value == null ? AnalysisError.NO_ERRORS : (value
as List<AnalysisError>); | 1853 state._resolutionErrors = value == null ? AnalysisError.NO_ERRORS : (value
as List<AnalysisError>); |
| 1839 state._resolutionErrorsState = CacheState.VALID; | 1854 state._resolutionErrorsState = CacheState.VALID; |
| 1840 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 1855 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 1841 state._resolvedUnit = value as CompilationUnit; | 1856 state._resolvedUnit = value as CompilationUnit; |
| 1842 state._resolvedUnitState = CacheState.VALID; | 1857 state._resolvedUnitState = CacheState.VALID; |
| 1858 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 1859 state._verificationErrors = value == null ? AnalysisError.NO_ERRORS : (val
ue as List<AnalysisError>); |
| 1860 state._verificationErrorsState = CacheState.VALID; |
| 1843 } else if (identical(descriptor, DartEntry.HINTS)) { | 1861 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 1844 state._hints = value == null ? AnalysisError.NO_ERRORS : (value as List<An
alysisError>); | 1862 state._hints = value == null ? AnalysisError.NO_ERRORS : (value as List<An
alysisError>); |
| 1845 state._hintsState = CacheState.VALID; | 1863 state._hintsState = CacheState.VALID; |
| 1846 } | 1864 } |
| 1847 } | 1865 } |
| 1848 void copyFrom(SourceEntryImpl entry) { | 1866 void copyFrom(SourceEntryImpl entry) { |
| 1849 super.copyFrom(entry); | 1867 super.copyFrom(entry); |
| 1850 DartEntryImpl other = entry as DartEntryImpl; | 1868 DartEntryImpl other = entry as DartEntryImpl; |
| 1851 _sourceKindState = other._sourceKindState; | 1869 _sourceKindState = other._sourceKindState; |
| 1852 _sourceKind = other._sourceKind; | 1870 _sourceKind = other._sourceKind; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1974 */ | 1992 */ |
| 1975 CacheState _resolutionErrorsState = CacheState.INVALID; | 1993 CacheState _resolutionErrorsState = CacheState.INVALID; |
| 1976 | 1994 |
| 1977 /** | 1995 /** |
| 1978 * The errors produced while resolving the compilation unit, or an empty array
if the errors are | 1996 * The errors produced while resolving the compilation unit, or an empty array
if the errors are |
| 1979 * not currently cached. | 1997 * not currently cached. |
| 1980 */ | 1998 */ |
| 1981 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; | 1999 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; |
| 1982 | 2000 |
| 1983 /** | 2001 /** |
| 2002 * The state of the cached verification errors. |
| 2003 */ |
| 2004 CacheState _verificationErrorsState = CacheState.INVALID; |
| 2005 |
| 2006 /** |
| 2007 * The errors produced while verifying the compilation unit, or an empty array
if the errors are |
| 2008 * not currently cached. |
| 2009 */ |
| 2010 List<AnalysisError> _verificationErrors = AnalysisError.NO_ERRORS; |
| 2011 |
| 2012 /** |
| 1984 * The state of the cached hints. | 2013 * The state of the cached hints. |
| 1985 */ | 2014 */ |
| 1986 CacheState _hintsState = CacheState.INVALID; | 2015 CacheState _hintsState = CacheState.INVALID; |
| 1987 | 2016 |
| 1988 /** | 2017 /** |
| 1989 * The hints produced while auditing the compilation unit, or an empty array i
f the hints are | 2018 * The hints produced while auditing the compilation unit, or an empty array i
f the hints are |
| 1990 * not currently cached. | 2019 * not currently cached. |
| 1991 */ | 2020 */ |
| 1992 List<AnalysisError> _hints = AnalysisError.NO_ERRORS; | 2021 List<AnalysisError> _hints = AnalysisError.NO_ERRORS; |
| 1993 | 2022 |
| 1994 /** | 2023 /** |
| 1995 * Set this state to be exactly like the given state, recursively copying the
next state as | 2024 * Set this state to be exactly like the given state, recursively copying the
next state as |
| 1996 * necessary. | 2025 * necessary. |
| 1997 * | 2026 * |
| 1998 * @param other the state to be copied | 2027 * @param other the state to be copied |
| 1999 */ | 2028 */ |
| 2000 void copyFrom(DartEntryImpl_ResolutionState other) { | 2029 void copyFrom(DartEntryImpl_ResolutionState other) { |
| 2001 _librarySource = other._librarySource; | 2030 _librarySource = other._librarySource; |
| 2002 _resolvedUnitState = other._resolvedUnitState; | 2031 _resolvedUnitState = other._resolvedUnitState; |
| 2003 _resolvedUnit = other._resolvedUnit; | 2032 _resolvedUnit = other._resolvedUnit; |
| 2004 _resolutionErrorsState = other._resolutionErrorsState; | 2033 _resolutionErrorsState = other._resolutionErrorsState; |
| 2005 _resolutionErrors = other._resolutionErrors; | 2034 _resolutionErrors = other._resolutionErrors; |
| 2035 _verificationErrorsState = other._verificationErrorsState; |
| 2036 _verificationErrors = other._verificationErrors; |
| 2006 _hintsState = other._hintsState; | 2037 _hintsState = other._hintsState; |
| 2007 _hints = other._hints; | 2038 _hints = other._hints; |
| 2008 if (other._nextState != null) { | 2039 if (other._nextState != null) { |
| 2009 _nextState = new DartEntryImpl_ResolutionState(); | 2040 _nextState = new DartEntryImpl_ResolutionState(); |
| 2010 _nextState.copyFrom(other._nextState); | 2041 _nextState.copyFrom(other._nextState); |
| 2011 } | 2042 } |
| 2012 } | 2043 } |
| 2013 | 2044 |
| 2014 /** | 2045 /** |
| 2015 * Flush any AST structures being maintained by this state. | 2046 * Flush any AST structures being maintained by this state. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2027 /** | 2058 /** |
| 2028 * Invalidate all of the resolution information associated with the compilatio
n unit. | 2059 * Invalidate all of the resolution information associated with the compilatio
n unit. |
| 2029 */ | 2060 */ |
| 2030 void invalidateAllResolutionInformation() { | 2061 void invalidateAllResolutionInformation() { |
| 2031 _nextState = null; | 2062 _nextState = null; |
| 2032 _librarySource = null; | 2063 _librarySource = null; |
| 2033 _resolvedUnitState = CacheState.INVALID; | 2064 _resolvedUnitState = CacheState.INVALID; |
| 2034 _resolvedUnit = null; | 2065 _resolvedUnit = null; |
| 2035 _resolutionErrorsState = CacheState.INVALID; | 2066 _resolutionErrorsState = CacheState.INVALID; |
| 2036 _resolutionErrors = AnalysisError.NO_ERRORS; | 2067 _resolutionErrors = AnalysisError.NO_ERRORS; |
| 2068 _verificationErrorsState = CacheState.INVALID; |
| 2069 _verificationErrors = AnalysisError.NO_ERRORS; |
| 2037 _hintsState = CacheState.INVALID; | 2070 _hintsState = CacheState.INVALID; |
| 2038 _hints = AnalysisError.NO_ERRORS; | 2071 _hints = AnalysisError.NO_ERRORS; |
| 2039 } | 2072 } |
| 2040 | 2073 |
| 2041 /** | 2074 /** |
| 2042 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 2075 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
| 2043 * entry. This will set the state of all resolution-based information as being
in error, but | 2076 * entry. This will set the state of all resolution-based information as being
in error, but |
| 2044 * will not change the state of any parse results. | 2077 * will not change the state of any parse results. |
| 2045 */ | 2078 */ |
| 2046 void recordResolutionError() { | 2079 void recordResolutionError() { |
| 2047 _nextState = null; | 2080 _nextState = null; |
| 2048 _librarySource = null; | 2081 _librarySource = null; |
| 2049 _resolvedUnitState = CacheState.ERROR; | 2082 _resolvedUnitState = CacheState.ERROR; |
| 2050 _resolvedUnit = null; | 2083 _resolvedUnit = null; |
| 2051 _resolutionErrorsState = CacheState.ERROR; | 2084 _resolutionErrorsState = CacheState.ERROR; |
| 2052 _resolutionErrors = AnalysisError.NO_ERRORS; | 2085 _resolutionErrors = AnalysisError.NO_ERRORS; |
| 2086 _verificationErrorsState = CacheState.ERROR; |
| 2087 _verificationErrors = AnalysisError.NO_ERRORS; |
| 2053 _hintsState = CacheState.ERROR; | 2088 _hintsState = CacheState.ERROR; |
| 2054 _hints = AnalysisError.NO_ERRORS; | 2089 _hints = AnalysisError.NO_ERRORS; |
| 2055 } | 2090 } |
| 2056 | 2091 |
| 2057 /** | 2092 /** |
| 2058 * Record that an in-process parse has stopped without recording results becau
se the results | 2093 * Record that an in-process parse has stopped without recording results becau
se the results |
| 2059 * were invalidated before they could be recorded. | 2094 * were invalidated before they could be recorded. |
| 2060 */ | 2095 */ |
| 2061 void recordResolutionNotInProcess() { | 2096 void recordResolutionNotInProcess() { |
| 2062 if (identical(_resolvedUnitState, CacheState.IN_PROCESS)) { | 2097 if (identical(_resolvedUnitState, CacheState.IN_PROCESS)) { |
| 2063 _resolvedUnitState = CacheState.INVALID; | 2098 _resolvedUnitState = CacheState.INVALID; |
| 2064 } | 2099 } |
| 2065 if (identical(_resolutionErrorsState, CacheState.IN_PROCESS)) { | 2100 if (identical(_resolutionErrorsState, CacheState.IN_PROCESS)) { |
| 2066 _resolutionErrorsState = CacheState.INVALID; | 2101 _resolutionErrorsState = CacheState.INVALID; |
| 2067 } | 2102 } |
| 2103 if (identical(_verificationErrorsState, CacheState.IN_PROCESS)) { |
| 2104 _verificationErrorsState = CacheState.INVALID; |
| 2105 } |
| 2068 if (identical(_hintsState, CacheState.IN_PROCESS)) { | 2106 if (identical(_hintsState, CacheState.IN_PROCESS)) { |
| 2069 _hintsState = CacheState.INVALID; | 2107 _hintsState = CacheState.INVALID; |
| 2070 } | 2108 } |
| 2071 if (_nextState != null) { | 2109 if (_nextState != null) { |
| 2072 _nextState.recordResolutionNotInProcess(); | 2110 _nextState.recordResolutionNotInProcess(); |
| 2073 } | 2111 } |
| 2074 } | 2112 } |
| 2075 | 2113 |
| 2076 /** | 2114 /** |
| 2077 * Write a textual representation of this state to the given builder. The resu
lt will only be | 2115 * Write a textual representation of this state to the given builder. The resu
lt will only be |
| 2078 * used for debugging purposes. | 2116 * used for debugging purposes. |
| 2079 * | 2117 * |
| 2080 * @param builder the builder to which the text should be written | 2118 * @param builder the builder to which the text should be written |
| 2081 */ | 2119 */ |
| 2082 void writeOn(JavaStringBuilder builder) { | 2120 void writeOn(JavaStringBuilder builder) { |
| 2083 if (_librarySource != null) { | 2121 if (_librarySource != null) { |
| 2084 builder.append("; resolvedUnit = "); | 2122 builder.append("; resolvedUnit = "); |
| 2085 builder.append(_resolvedUnitState); | 2123 builder.append(_resolvedUnitState); |
| 2086 builder.append("; resolutionErrors = "); | 2124 builder.append("; resolutionErrors = "); |
| 2087 builder.append(_resolutionErrorsState); | 2125 builder.append(_resolutionErrorsState); |
| 2126 builder.append("; verificationErrors = "); |
| 2127 builder.append(_verificationErrorsState); |
| 2088 builder.append("; hints = "); | 2128 builder.append("; hints = "); |
| 2089 builder.append(_hintsState); | 2129 builder.append(_hintsState); |
| 2090 if (_nextState != null) { | 2130 if (_nextState != null) { |
| 2091 _nextState.writeOn(builder); | 2131 _nextState.writeOn(builder); |
| 2092 } | 2132 } |
| 2093 } | 2133 } |
| 2094 } | 2134 } |
| 2095 } | 2135 } |
| 2096 /** | 2136 /** |
| 2097 * Instances of the class `DataDescriptor` are immutable constants representing
data that can | 2137 * Instances of the class `DataDescriptor` are immutable constants representing
data that can |
| (...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2781 List<AnalysisError> computeErrors(Source source) { | 2821 List<AnalysisError> computeErrors(Source source) { |
| 2782 bool enableHints = analysisOptions.hint; | 2822 bool enableHints = analysisOptions.hint; |
| 2783 SourceEntry sourceEntry = getReadableSourceEntry(source); | 2823 SourceEntry sourceEntry = getReadableSourceEntry(source); |
| 2784 if (sourceEntry is DartEntry) { | 2824 if (sourceEntry is DartEntry) { |
| 2785 List<AnalysisError> errors = new List<AnalysisError>(); | 2825 List<AnalysisError> errors = new List<AnalysisError>(); |
| 2786 DartEntry dartEntry = sourceEntry as DartEntry; | 2826 DartEntry dartEntry = sourceEntry as DartEntry; |
| 2787 ListUtilities.addAll(errors, getDartParseData(source, dartEntry, DartEntry
.PARSE_ERRORS)); | 2827 ListUtilities.addAll(errors, getDartParseData(source, dartEntry, DartEntry
.PARSE_ERRORS)); |
| 2788 dartEntry = getReadableDartEntry(source); | 2828 dartEntry = getReadableDartEntry(source); |
| 2789 if (identical(dartEntry.getValue(DartEntry.SOURCE_KIND), SourceKind.LIBRAR
Y)) { | 2829 if (identical(dartEntry.getValue(DartEntry.SOURCE_KIND), SourceKind.LIBRAR
Y)) { |
| 2790 ListUtilities.addAll(errors, getDartResolutionData(source, source, dartE
ntry, DartEntry.RESOLUTION_ERRORS)); | 2830 ListUtilities.addAll(errors, getDartResolutionData(source, source, dartE
ntry, DartEntry.RESOLUTION_ERRORS)); |
| 2831 ListUtilities.addAll(errors, getDartVerificationData(source, source, dar
tEntry, DartEntry.VERIFICATION_ERRORS)); |
| 2791 if (enableHints) { | 2832 if (enableHints) { |
| 2792 ListUtilities.addAll(errors, getDartHintData(source, source, dartEntry
, DartEntry.HINTS)); | 2833 ListUtilities.addAll(errors, getDartHintData(source, source, dartEntry
, DartEntry.HINTS)); |
| 2793 } | 2834 } |
| 2794 } else { | 2835 } else { |
| 2795 List<Source> libraries = getLibrariesContaining(source); | 2836 List<Source> libraries = getLibrariesContaining(source); |
| 2796 for (Source librarySource in libraries) { | 2837 for (Source librarySource in libraries) { |
| 2797 ListUtilities.addAll(errors, getDartResolutionData(source, librarySour
ce, dartEntry, DartEntry.RESOLUTION_ERRORS)); | 2838 ListUtilities.addAll(errors, getDartResolutionData(source, librarySour
ce, dartEntry, DartEntry.RESOLUTION_ERRORS)); |
| 2839 ListUtilities.addAll(errors, getDartVerificationData(source, librarySo
urce, dartEntry, DartEntry.VERIFICATION_ERRORS)); |
| 2798 if (enableHints) { | 2840 if (enableHints) { |
| 2799 ListUtilities.addAll(errors, getDartHintData(source, librarySource,
dartEntry, DartEntry.HINTS)); | 2841 ListUtilities.addAll(errors, getDartHintData(source, librarySource,
dartEntry, DartEntry.HINTS)); |
| 2800 } | 2842 } |
| 2801 } | 2843 } |
| 2802 } | 2844 } |
| 2803 if (errors.isEmpty) { | 2845 if (errors.isEmpty) { |
| 2804 return AnalysisError.NO_ERRORS; | 2846 return AnalysisError.NO_ERRORS; |
| 2805 } | 2847 } |
| 2806 return new List.from(errors); | 2848 return new List.from(errors); |
| 2807 } else if (sourceEntry is HtmlEntry) { | 2849 } else if (sourceEntry is HtmlEntry) { |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3109 /** | 3151 /** |
| 3110 * Return a list of the sources that would be processed by [performAnalysisTas
k]. This | 3152 * Return a list of the sources that would be processed by [performAnalysisTas
k]. This |
| 3111 * method duplicates, and must therefore be kept in sync with, [getNextTaskAna
lysisTask]. | 3153 * method duplicates, and must therefore be kept in sync with, [getNextTaskAna
lysisTask]. |
| 3112 * This method is intended to be used for testing purposes only. | 3154 * This method is intended to be used for testing purposes only. |
| 3113 * | 3155 * |
| 3114 * @return a list of the sources that would be processed by [performAnalysisTa
sk] | 3156 * @return a list of the sources that would be processed by [performAnalysisTa
sk] |
| 3115 */ | 3157 */ |
| 3116 List<Source> get sourcesNeedingProcessing { | 3158 List<Source> get sourcesNeedingProcessing { |
| 3117 Set<Source> sources = new Set<Source>(); | 3159 Set<Source> sources = new Set<Source>(); |
| 3118 { | 3160 { |
| 3161 bool hintsEnabled = analysisOptions.hint; |
| 3119 for (Source source in _cache.priorityOrder) { | 3162 for (Source source in _cache.priorityOrder) { |
| 3120 SourceEntry sourceEntry = _cache.get(source); | 3163 getSourcesNeedingProcessing2(source, _cache.get(source), true, hintsEnab
led, sources); |
| 3121 if (sourceEntry is DartEntry) { | |
| 3122 DartEntry dartEntry = sourceEntry as DartEntry; | |
| 3123 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERROR
S); | |
| 3124 if (identical(parseErrorsState, CacheState.INVALID) || identical(parse
ErrorsState, CacheState.FLUSHED)) { | |
| 3125 javaSetAdd(sources, source); | |
| 3126 } | |
| 3127 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit; | |
| 3128 if (parseUnit == null) { | |
| 3129 javaSetAdd(sources, source); | |
| 3130 } | |
| 3131 for (Source librarySource in getLibrariesContaining(source)) { | |
| 3132 SourceEntry libraryEntry = _cache.get(librarySource); | |
| 3133 if (libraryEntry is DartEntry) { | |
| 3134 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT)
; | |
| 3135 if (identical(elementState, CacheState.INVALID) || identical(eleme
ntState, CacheState.FLUSHED)) { | |
| 3136 javaSetAdd(sources, source); | |
| 3137 } | |
| 3138 CacheState resolvedUnitState = dartEntry.getState2(DartEntry.RESOL
VED_UNIT, librarySource); | |
| 3139 if (identical(resolvedUnitState, CacheState.INVALID) || identical(
resolvedUnitState, CacheState.FLUSHED)) { | |
| 3140 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.
ELEMENT); | |
| 3141 if (libraryElement != null) { | |
| 3142 javaSetAdd(sources, source); | |
| 3143 } | |
| 3144 } | |
| 3145 CacheState hintsState = dartEntry.getState2(DartEntry.HINTS, libra
rySource); | |
| 3146 if (identical(hintsState, CacheState.INVALID) || identical(hintsSt
ate, CacheState.FLUSHED)) { | |
| 3147 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.
ELEMENT); | |
| 3148 if (libraryElement != null) { | |
| 3149 javaSetAdd(sources, source); | |
| 3150 } | |
| 3151 } | |
| 3152 } | |
| 3153 } | |
| 3154 } else if (sourceEntry is HtmlEntry) { | |
| 3155 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; | |
| 3156 CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT)
; | |
| 3157 if (identical(parsedUnitState, CacheState.INVALID) || identical(parsed
UnitState, CacheState.FLUSHED)) { | |
| 3158 javaSetAdd(sources, source); | |
| 3159 } | |
| 3160 CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT); | |
| 3161 if (identical(elementState, CacheState.INVALID) || identical(elementSt
ate, CacheState.FLUSHED)) { | |
| 3162 javaSetAdd(sources, source); | |
| 3163 } | |
| 3164 } | |
| 3165 } | 3164 } |
| 3166 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 3165 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 3167 SourceEntry sourceEntry = entry.getValue(); | 3166 getSourcesNeedingProcessing2(entry.getKey(), entry.getValue(), false, hi
ntsEnabled, sources); |
| 3168 if (sourceEntry is DartEntry) { | |
| 3169 DartEntry dartEntry = sourceEntry as DartEntry; | |
| 3170 if (identical(dartEntry.getState(DartEntry.PARSED_UNIT), CacheState.IN
VALID)) { | |
| 3171 javaSetAdd(sources, entry.getKey()); | |
| 3172 } | |
| 3173 } else if (sourceEntry is HtmlEntry) { | |
| 3174 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; | |
| 3175 if (identical(htmlEntry.getState(HtmlEntry.PARSED_UNIT), CacheState.IN
VALID)) { | |
| 3176 javaSetAdd(sources, entry.getKey()); | |
| 3177 } | |
| 3178 } | |
| 3179 } | |
| 3180 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | |
| 3181 SourceEntry sourceEntry = entry.getValue(); | |
| 3182 if (sourceEntry is DartEntry) { | |
| 3183 DartEntry dartEntry = sourceEntry as DartEntry; | |
| 3184 if (identical(dartEntry.kind, SourceKind.LIBRARY) && identical(dartEnt
ry.getState(DartEntry.ELEMENT), CacheState.INVALID)) { | |
| 3185 javaSetAdd(sources, entry.getKey()); | |
| 3186 } else if (identical(dartEntry.getState2(DartEntry.HINTS, entry.getKey
()), CacheState.INVALID)) { | |
| 3187 javaSetAdd(sources, entry.getKey()); | |
| 3188 } | |
| 3189 } else if (sourceEntry is HtmlEntry) { | |
| 3190 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; | |
| 3191 if (identical(htmlEntry.getState(HtmlEntry.ELEMENT), CacheState.INVALI
D)) { | |
| 3192 javaSetAdd(sources, entry.getKey()); | |
| 3193 } | |
| 3194 } | |
| 3195 } | 3167 } |
| 3196 } | 3168 } |
| 3197 return new List<Source>.from(sources); | 3169 return new List<Source>.from(sources); |
| 3198 } | 3170 } |
| 3199 AnalysisContentStatistics get statistics { | 3171 AnalysisContentStatistics get statistics { |
| 3200 AnalysisContentStatisticsImpl statistics = new AnalysisContentStatisticsImpl
(); | 3172 AnalysisContentStatisticsImpl statistics = new AnalysisContentStatisticsImpl
(); |
| 3201 { | 3173 { |
| 3202 for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) { | 3174 for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) { |
| 3203 SourceEntry entry = mapEntry.getValue(); | 3175 SourceEntry entry = mapEntry.getValue(); |
| 3204 if (entry is DartEntry) { | 3176 if (entry is DartEntry) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 3215 statistics.putCacheItem(dartEntry, DartEntry.IMPORTED_LIBRARIES); | 3187 statistics.putCacheItem(dartEntry, DartEntry.IMPORTED_LIBRARIES); |
| 3216 statistics.putCacheItem(dartEntry, DartEntry.INCLUDED_PARTS); | 3188 statistics.putCacheItem(dartEntry, DartEntry.INCLUDED_PARTS); |
| 3217 statistics.putCacheItem(dartEntry, DartEntry.IS_CLIENT); | 3189 statistics.putCacheItem(dartEntry, DartEntry.IS_CLIENT); |
| 3218 statistics.putCacheItem(dartEntry, DartEntry.IS_LAUNCHABLE); | 3190 statistics.putCacheItem(dartEntry, DartEntry.IS_LAUNCHABLE); |
| 3219 } | 3191 } |
| 3220 List<Source> librarySources = getLibrariesContaining(source); | 3192 List<Source> librarySources = getLibrariesContaining(source); |
| 3221 for (Source librarySource in librarySources) { | 3193 for (Source librarySource in librarySources) { |
| 3222 statistics.putCacheItem2(dartEntry, librarySource, DartEntry.HINTS); | 3194 statistics.putCacheItem2(dartEntry, librarySource, DartEntry.HINTS); |
| 3223 statistics.putCacheItem2(dartEntry, librarySource, DartEntry.RESOLUT
ION_ERRORS); | 3195 statistics.putCacheItem2(dartEntry, librarySource, DartEntry.RESOLUT
ION_ERRORS); |
| 3224 statistics.putCacheItem2(dartEntry, librarySource, DartEntry.RESOLVE
D_UNIT); | 3196 statistics.putCacheItem2(dartEntry, librarySource, DartEntry.RESOLVE
D_UNIT); |
| 3197 statistics.putCacheItem2(dartEntry, librarySource, DartEntry.VERIFIC
ATION_ERRORS); |
| 3225 } | 3198 } |
| 3226 } | 3199 } |
| 3227 } | 3200 } |
| 3228 } | 3201 } |
| 3229 return statistics; | 3202 return statistics; |
| 3230 } | 3203 } |
| 3231 TimestampedData<CompilationUnit> internalResolveCompilationUnit(Source unitSou
rce, LibraryElement libraryElement) { | 3204 TimestampedData<CompilationUnit> internalResolveCompilationUnit(Source unitSou
rce, LibraryElement libraryElement) { |
| 3232 DartEntry dartEntry = getReadableDartEntry(unitSource); | 3205 DartEntry dartEntry = getReadableDartEntry(unitSource); |
| 3233 if (dartEntry == null) { | 3206 if (dartEntry == null) { |
| 3234 throw new AnalysisException.con1("internalResolveCompilationUnit invoked f
or non-Dart file: ${unitSource.fullName}"); | 3207 throw new AnalysisException.con1("internalResolveCompilationUnit invoked f
or non-Dart file: ${unitSource.fullName}"); |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3476 DartEntry cacheDartResolutionData(Source unitSource, Source librarySource, Dar
tEntry dartEntry, DataDescriptor descriptor) { | 3449 DartEntry cacheDartResolutionData(Source unitSource, Source librarySource, Dar
tEntry dartEntry, DataDescriptor descriptor) { |
| 3477 CacheState state = (identical(descriptor, DartEntry.ELEMENT)) ? dartEntry.ge
tState(descriptor) : dartEntry.getState2(descriptor, librarySource); | 3450 CacheState state = (identical(descriptor, DartEntry.ELEMENT)) ? dartEntry.ge
tState(descriptor) : dartEntry.getState2(descriptor, librarySource); |
| 3478 while (state != CacheState.ERROR && state != CacheState.VALID) { | 3451 while (state != CacheState.ERROR && state != CacheState.VALID) { |
| 3479 dartEntry = new ResolveDartLibraryTask(this, unitSource, librarySource).pe
rform(_resultRecorder) as DartEntry; | 3452 dartEntry = new ResolveDartLibraryTask(this, unitSource, librarySource).pe
rform(_resultRecorder) as DartEntry; |
| 3480 state = (identical(descriptor, DartEntry.ELEMENT)) ? dartEntry.getState(de
scriptor) : dartEntry.getState2(descriptor, librarySource); | 3453 state = (identical(descriptor, DartEntry.ELEMENT)) ? dartEntry.getState(de
scriptor) : dartEntry.getState2(descriptor, librarySource); |
| 3481 } | 3454 } |
| 3482 return dartEntry; | 3455 return dartEntry; |
| 3483 } | 3456 } |
| 3484 | 3457 |
| 3485 /** | 3458 /** |
| 3459 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which |
| 3460 * the data represented by the given descriptor is available. This method assu
mes that the data |
| 3461 * can be produced by verifying the source in the given library if the data is
not already cached. |
| 3462 * |
| 3463 * @param unitSource the source representing the Dart file |
| 3464 * @param librarySource the source representing the library containing the Dar
t file |
| 3465 * @param dartEntry the cache entry associated with the Dart file |
| 3466 * @param descriptor the descriptor representing the data to be returned |
| 3467 * @return a cache entry containing the required data |
| 3468 * @throws AnalysisException if data could not be returned because the source
could not be parsed |
| 3469 */ |
| 3470 DartEntry cacheDartVerificationData(Source unitSource, Source librarySource, D
artEntry dartEntry, DataDescriptor descriptor) { |
| 3471 CacheState state = dartEntry.getState2(descriptor, librarySource); |
| 3472 while (state != CacheState.ERROR && state != CacheState.VALID) { |
| 3473 dartEntry = new GenerateDartErrorsTask(this, unitSource, getLibraryElement
(librarySource)).perform(_resultRecorder) as DartEntry; |
| 3474 state = dartEntry.getState2(descriptor, librarySource); |
| 3475 } |
| 3476 return dartEntry; |
| 3477 } |
| 3478 |
| 3479 /** |
| 3486 * Given a source for an HTML file, return a cache entry in which all of the d
ata represented by | 3480 * Given a source for an HTML file, return a cache entry in which all of the d
ata represented by |
| 3487 * the given descriptors is available. This method assumes that the data can b
e produced by | 3481 * the given descriptors is available. This method assumes that the data can b
e produced by |
| 3488 * parsing the source if it is not already cached. | 3482 * parsing the source if it is not already cached. |
| 3489 * | 3483 * |
| 3490 * @param source the source representing the HTML file | 3484 * @param source the source representing the HTML file |
| 3491 * @param htmlEntry the cache entry associated with the HTML file | 3485 * @param htmlEntry the cache entry associated with the HTML file |
| 3492 * @param descriptor the descriptor representing the data to be returned | 3486 * @param descriptor the descriptor representing the data to be returned |
| 3493 * @return a cache entry containing the required data | 3487 * @return a cache entry containing the required data |
| 3494 * @throws AnalysisException if data could not be returned because the source
could not be | 3488 * @throws AnalysisException if data could not be returned because the source
could not be |
| 3495 * resolved | 3489 * resolved |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3708 */ | 3702 */ |
| 3709 Object getDartResolutionData2(Source unitSource, Source librarySource, DataDes
criptor descriptor, Object defaultValue) { | 3703 Object getDartResolutionData2(Source unitSource, Source librarySource, DataDes
criptor descriptor, Object defaultValue) { |
| 3710 DartEntry dartEntry = getReadableDartEntry(unitSource); | 3704 DartEntry dartEntry = getReadableDartEntry(unitSource); |
| 3711 if (dartEntry == null) { | 3705 if (dartEntry == null) { |
| 3712 return defaultValue; | 3706 return defaultValue; |
| 3713 } | 3707 } |
| 3714 return getDartResolutionData(unitSource, librarySource, dartEntry, descripto
r); | 3708 return getDartResolutionData(unitSource, librarySource, dartEntry, descripto
r); |
| 3715 } | 3709 } |
| 3716 | 3710 |
| 3717 /** | 3711 /** |
| 3712 * Given a source for a Dart file and the library that contains it, return the
data represented by |
| 3713 * the given descriptor that is associated with that source. This method assum
es that the data can |
| 3714 * be produced by verifying the source within the given library if it is not a
lready cached. |
| 3715 * |
| 3716 * @param unitSource the source representing the Dart file |
| 3717 * @param librarySource the source representing the library containing the Dar
t file |
| 3718 * @param dartEntry the entry representing the Dart file |
| 3719 * @param descriptor the descriptor representing the data to be returned |
| 3720 * @return the requested data about the given source |
| 3721 * @throws AnalysisException if data could not be returned because the source
could not be |
| 3722 * resolved |
| 3723 */ |
| 3724 Object getDartVerificationData(Source unitSource, Source librarySource, DartEn
try dartEntry, DataDescriptor descriptor) { |
| 3725 dartEntry = cacheDartVerificationData(unitSource, librarySource, dartEntry,
descriptor); |
| 3726 return dartEntry.getValue2(descriptor, librarySource); |
| 3727 } |
| 3728 |
| 3729 /** |
| 3718 * Given a source for an HTML file, return the data represented by the given d
escriptor that is | 3730 * Given a source for an HTML file, return the data represented by the given d
escriptor that is |
| 3719 * associated with that source, or the given default value if the source is no
t an HTML file. This | 3731 * associated with that source, or the given default value if the source is no
t an HTML file. This |
| 3720 * method assumes that the data can be produced by parsing the source if it is
not already cached. | 3732 * method assumes that the data can be produced by parsing the source if it is
not already cached. |
| 3721 * | 3733 * |
| 3722 * @param source the source representing the Dart file | 3734 * @param source the source representing the Dart file |
| 3723 * @param descriptor the descriptor representing the data to be returned | 3735 * @param descriptor the descriptor representing the data to be returned |
| 3724 * @param defaultValue the value to be returned if the source is not an HTML f
ile | 3736 * @param defaultValue the value to be returned if the source is not an HTML f
ile |
| 3725 * @return the requested data about the given source | 3737 * @return the requested data about the given source |
| 3726 * @throws AnalysisException if data could not be returned because the source
could not be parsed | 3738 * @throws AnalysisException if data could not be returned because the source
could not be parsed |
| 3727 */ | 3739 */ |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3773 } | 3785 } |
| 3774 | 3786 |
| 3775 /** | 3787 /** |
| 3776 * Look through the cache for a task that needs to be performed. Return the ta
sk that was found, | 3788 * Look through the cache for a task that needs to be performed. Return the ta
sk that was found, |
| 3777 * or `null` if there is no more work to be done. | 3789 * or `null` if there is no more work to be done. |
| 3778 * | 3790 * |
| 3779 * @return the next task that needs to be performed | 3791 * @return the next task that needs to be performed |
| 3780 */ | 3792 */ |
| 3781 AnalysisTask get nextTaskAnalysisTask { | 3793 AnalysisTask get nextTaskAnalysisTask { |
| 3782 { | 3794 { |
| 3783 bool enableHints = analysisOptions.hint; | 3795 bool hintsEnabled = analysisOptions.hint; |
| 3784 for (Source source in _cache.priorityOrder) { | 3796 for (Source source in _cache.priorityOrder) { |
| 3785 SourceEntry sourceEntry = _cache.get(source); | 3797 AnalysisTask task = getNextTaskAnalysisTask2(source, _cache.get(source),
true, hintsEnabled); |
| 3786 if (sourceEntry is DartEntry) { | 3798 if (task != null) { |
| 3787 DartEntry dartEntry = sourceEntry as DartEntry; | 3799 return task; |
| 3788 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERROR
S); | |
| 3789 if (identical(parseErrorsState, CacheState.INVALID) || identical(parse
ErrorsState, CacheState.FLUSHED)) { | |
| 3790 DartEntryImpl dartCopy = dartEntry.writableCopy; | |
| 3791 dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS); | |
| 3792 _cache.put(source, dartCopy); | |
| 3793 return new ParseDartTask(this, source); | |
| 3794 } | |
| 3795 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit; | |
| 3796 if (parseUnit == null) { | |
| 3797 DartEntryImpl dartCopy = dartEntry.writableCopy; | |
| 3798 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.IN_PROCESS); | |
| 3799 _cache.put(source, dartCopy); | |
| 3800 return new ParseDartTask(this, source); | |
| 3801 } | |
| 3802 for (Source librarySource in getLibrariesContaining(source)) { | |
| 3803 SourceEntry libraryEntry = _cache.get(librarySource); | |
| 3804 if (libraryEntry is DartEntry) { | |
| 3805 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT)
; | |
| 3806 if (identical(elementState, CacheState.INVALID) || identical(eleme
ntState, CacheState.FLUSHED)) { | |
| 3807 DartEntryImpl libraryCopy = ((libraryEntry as DartEntry)).writab
leCopy; | |
| 3808 libraryCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS); | |
| 3809 _cache.put(librarySource, libraryCopy); | |
| 3810 return new ResolveDartLibraryTask(this, source, librarySource); | |
| 3811 } | |
| 3812 CacheState resolvedUnitState = dartEntry.getState2(DartEntry.RESOL
VED_UNIT, librarySource); | |
| 3813 if (identical(resolvedUnitState, CacheState.INVALID) || identical(
resolvedUnitState, CacheState.FLUSHED)) { | |
| 3814 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.
ELEMENT); | |
| 3815 if (libraryElement != null) { | |
| 3816 DartEntryImpl dartCopy = dartEntry.writableCopy; | |
| 3817 dartCopy.setState2(DartEntry.RESOLVED_UNIT, librarySource, Cac
heState.IN_PROCESS); | |
| 3818 _cache.put(source, dartCopy); | |
| 3819 return new ResolveDartUnitTask(this, source, libraryElement); | |
| 3820 } | |
| 3821 } | |
| 3822 CacheState hintsState = dartEntry.getState2(DartEntry.HINTS, libra
rySource); | |
| 3823 if (enableHints && (identical(hintsState, CacheState.INVALID) || i
dentical(hintsState, CacheState.FLUSHED))) { | |
| 3824 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.
ELEMENT); | |
| 3825 if (libraryElement != null) { | |
| 3826 DartEntryImpl dartCopy = dartEntry.writableCopy; | |
| 3827 dartCopy.setState2(DartEntry.HINTS, librarySource, CacheState.
IN_PROCESS); | |
| 3828 _cache.put(source, dartCopy); | |
| 3829 return new GenerateDartHintsTask(this, libraryElement); | |
| 3830 } | |
| 3831 } | |
| 3832 } | |
| 3833 } | |
| 3834 } else if (sourceEntry is HtmlEntry) { | |
| 3835 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; | |
| 3836 CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT)
; | |
| 3837 if (identical(parsedUnitState, CacheState.INVALID) || identical(parsed
UnitState, CacheState.FLUSHED)) { | |
| 3838 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | |
| 3839 htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.IN_PROCESS); | |
| 3840 _cache.put(source, htmlCopy); | |
| 3841 return new ParseHtmlTask(this, source); | |
| 3842 } | |
| 3843 CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT); | |
| 3844 if (identical(elementState, CacheState.INVALID) || identical(elementSt
ate, CacheState.FLUSHED)) { | |
| 3845 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | |
| 3846 htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.IN_PROCESS); | |
| 3847 _cache.put(source, htmlCopy); | |
| 3848 return new ResolveHtmlTask(this, source); | |
| 3849 } | |
| 3850 } | 3800 } |
| 3851 } | 3801 } |
| 3852 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 3802 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 3853 SourceEntry sourceEntry = entry.getValue(); | 3803 AnalysisTask task = getNextTaskAnalysisTask2(entry.getKey(), entry.getVa
lue(), false, hintsEnabled); |
| 3854 if (sourceEntry is DartEntry) { | 3804 if (task != null) { |
| 3855 DartEntry dartEntry = sourceEntry as DartEntry; | 3805 return task; |
| 3856 if (identical(dartEntry.getState(DartEntry.PARSED_UNIT), CacheState.IN
VALID)) { | |
| 3857 Source source = entry.getKey(); | |
| 3858 DartEntryImpl dartCopy = dartEntry.writableCopy; | |
| 3859 dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS); | |
| 3860 _cache.put(source, dartCopy); | |
| 3861 return new ParseDartTask(this, source); | |
| 3862 } | |
| 3863 } else if (sourceEntry is HtmlEntry) { | |
| 3864 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; | |
| 3865 if (identical(htmlEntry.getState(HtmlEntry.PARSED_UNIT), CacheState.IN
VALID)) { | |
| 3866 Source source = entry.getKey(); | |
| 3867 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | |
| 3868 htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.IN_PROCESS); | |
| 3869 _cache.put(source, htmlCopy); | |
| 3870 return new ParseHtmlTask(this, source); | |
| 3871 } | |
| 3872 } | |
| 3873 } | |
| 3874 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | |
| 3875 SourceEntry sourceEntry = entry.getValue(); | |
| 3876 if (sourceEntry is DartEntry) { | |
| 3877 Source source = entry.getKey(); | |
| 3878 DartEntry dartEntry = sourceEntry as DartEntry; | |
| 3879 if (identical(dartEntry.kind, SourceKind.LIBRARY) && identical(dartEnt
ry.getState(DartEntry.ELEMENT), CacheState.INVALID)) { | |
| 3880 DartEntryImpl dartCopy = dartEntry.writableCopy; | |
| 3881 dartCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS); | |
| 3882 _cache.put(source, dartCopy); | |
| 3883 return new ResolveDartLibraryTask(this, source, source); | |
| 3884 } else if (enableHints && identical(dartEntry.getState2(DartEntry.HINT
S, source), CacheState.INVALID)) { | |
| 3885 LibraryElement libraryElement = dartEntry.getValue(DartEntry.ELEMENT
); | |
| 3886 if (libraryElement != null) { | |
| 3887 DartEntryImpl dartCopy = dartEntry.writableCopy; | |
| 3888 dartCopy.setState2(DartEntry.HINTS, source, CacheState.IN_PROCESS)
; | |
| 3889 _cache.put(source, dartCopy); | |
| 3890 return new GenerateDartHintsTask(this, libraryElement); | |
| 3891 } | |
| 3892 } | |
| 3893 } else if (sourceEntry is HtmlEntry) { | |
| 3894 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; | |
| 3895 if (identical(htmlEntry.getState(HtmlEntry.ELEMENT), CacheState.INVALI
D)) { | |
| 3896 Source source = entry.getKey(); | |
| 3897 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | |
| 3898 htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.IN_PROCESS); | |
| 3899 _cache.put(source, htmlCopy); | |
| 3900 return new ResolveHtmlTask(this, source); | |
| 3901 } | |
| 3902 } | 3806 } |
| 3903 } | 3807 } |
| 3904 return null; | 3808 return null; |
| 3905 } | 3809 } |
| 3906 } | 3810 } |
| 3907 | 3811 |
| 3908 /** | 3812 /** |
| 3813 * Look at the given source to see whether a task needs to be performed relate
d to it. Return the |
| 3814 * task that should be performed, or `null` if there is no more work to be don
e for the |
| 3815 * source. |
| 3816 * |
| 3817 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 3818 * |
| 3819 * @param source the source to be checked |
| 3820 * @param sourceEntry the cache entry associated with the source |
| 3821 * @param isPriority `true` if the source is a priority source |
| 3822 * @param hintsEnabled `true` if hints are currently enabled |
| 3823 * @return the next task that needs to be performed for the given source |
| 3824 */ |
| 3825 AnalysisTask getNextTaskAnalysisTask2(Source source, SourceEntry sourceEntry,
bool isPriority, bool hintsEnabled) { |
| 3826 if (sourceEntry is DartEntry) { |
| 3827 DartEntry dartEntry = sourceEntry as DartEntry; |
| 3828 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS); |
| 3829 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { |
| 3830 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 3831 dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS); |
| 3832 _cache.put(source, dartCopy); |
| 3833 return new ParseDartTask(this, source); |
| 3834 } |
| 3835 if (isPriority) { |
| 3836 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit; |
| 3837 if (parseUnit == null) { |
| 3838 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 3839 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.IN_PROCESS); |
| 3840 _cache.put(source, dartCopy); |
| 3841 return new ParseDartTask(this, source); |
| 3842 } |
| 3843 } |
| 3844 for (Source librarySource in getLibrariesContaining(source)) { |
| 3845 SourceEntry libraryEntry = _cache.get(librarySource); |
| 3846 if (libraryEntry is DartEntry) { |
| 3847 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT); |
| 3848 if (identical(elementState, CacheState.INVALID) || (isPriority && iden
tical(elementState, CacheState.FLUSHED))) { |
| 3849 DartEntryImpl libraryCopy = ((libraryEntry as DartEntry)).writableCo
py; |
| 3850 libraryCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS); |
| 3851 _cache.put(librarySource, libraryCopy); |
| 3852 return new ResolveDartLibraryTask(this, source, librarySource); |
| 3853 } |
| 3854 CacheState resolvedUnitState = dartEntry.getState2(DartEntry.RESOLVED_
UNIT, librarySource); |
| 3855 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority &&
identical(resolvedUnitState, CacheState.FLUSHED))) { |
| 3856 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEM
ENT); |
| 3857 if (libraryElement != null) { |
| 3858 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 3859 dartCopy.setState2(DartEntry.RESOLVED_UNIT, librarySource, CacheSt
ate.IN_PROCESS); |
| 3860 _cache.put(source, dartCopy); |
| 3861 return new ResolveDartUnitTask(this, source, libraryElement); |
| 3862 } |
| 3863 } |
| 3864 CacheState verificationErrorsState = dartEntry.getState2(DartEntry.VER
IFICATION_ERRORS, librarySource); |
| 3865 if (identical(verificationErrorsState, CacheState.INVALID) || (isPrior
ity && identical(verificationErrorsState, CacheState.FLUSHED))) { |
| 3866 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEM
ENT); |
| 3867 if (libraryElement != null) { |
| 3868 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 3869 dartCopy.setState2(DartEntry.VERIFICATION_ERRORS, librarySource, C
acheState.IN_PROCESS); |
| 3870 _cache.put(source, dartCopy); |
| 3871 return new GenerateDartErrorsTask(this, source, libraryElement); |
| 3872 } |
| 3873 } |
| 3874 if (hintsEnabled) { |
| 3875 CacheState hintsState = dartEntry.getState2(DartEntry.HINTS, library
Source); |
| 3876 if (identical(hintsState, CacheState.INVALID) || (isPriority && iden
tical(hintsState, CacheState.FLUSHED))) { |
| 3877 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL
EMENT); |
| 3878 if (libraryElement != null) { |
| 3879 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 3880 dartCopy.setState2(DartEntry.HINTS, librarySource, CacheState.IN
_PROCESS); |
| 3881 _cache.put(source, dartCopy); |
| 3882 return new GenerateDartHintsTask(this, libraryElement); |
| 3883 } |
| 3884 } |
| 3885 } |
| 3886 } |
| 3887 } |
| 3888 } else if (sourceEntry is HtmlEntry) { |
| 3889 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; |
| 3890 CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT); |
| 3891 if (identical(parsedUnitState, CacheState.INVALID) || (isPriority && ident
ical(parsedUnitState, CacheState.FLUSHED))) { |
| 3892 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 3893 htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.IN_PROCESS); |
| 3894 _cache.put(source, htmlCopy); |
| 3895 return new ParseHtmlTask(this, source); |
| 3896 } |
| 3897 CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT); |
| 3898 if (identical(elementState, CacheState.INVALID) || (isPriority && identica
l(elementState, CacheState.FLUSHED))) { |
| 3899 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 3900 htmlCopy.setState(HtmlEntry.ELEMENT, CacheState.IN_PROCESS); |
| 3901 _cache.put(source, htmlCopy); |
| 3902 return new ResolveHtmlTask(this, source); |
| 3903 } |
| 3904 } |
| 3905 return null; |
| 3906 } |
| 3907 |
| 3908 /** |
| 3909 * Return a change notice for the given source, creating one if one does not a
lready exist. | 3909 * Return a change notice for the given source, creating one if one does not a
lready exist. |
| 3910 * | 3910 * |
| 3911 * @param source the source for which changes are being reported | 3911 * @param source the source for which changes are being reported |
| 3912 * @return a change notice for the given source | 3912 * @return a change notice for the given source |
| 3913 */ | 3913 */ |
| 3914 ChangeNoticeImpl getNotice(Source source) { | 3914 ChangeNoticeImpl getNotice(Source source) { |
| 3915 ChangeNoticeImpl notice = _pendingNotices[source]; | 3915 ChangeNoticeImpl notice = _pendingNotices[source]; |
| 3916 if (notice == null) { | 3916 if (notice == null) { |
| 3917 notice = new ChangeNoticeImpl(source); | 3917 notice = new ChangeNoticeImpl(source); |
| 3918 _pendingNotices[source] = notice; | 3918 _pendingNotices[source] = notice; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3994 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 3994 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 3995 if (identical(entry.getValue().kind, kind)) { | 3995 if (identical(entry.getValue().kind, kind)) { |
| 3996 sources.add(entry.getKey()); | 3996 sources.add(entry.getKey()); |
| 3997 } | 3997 } |
| 3998 } | 3998 } |
| 3999 } | 3999 } |
| 4000 return new List.from(sources); | 4000 return new List.from(sources); |
| 4001 } | 4001 } |
| 4002 | 4002 |
| 4003 /** | 4003 /** |
| 4004 * Look at the given source to see whether a task needs to be performed relate
d to it. If so, add |
| 4005 * the source to the set of sources that need to be processed. This method dup
licates, and must |
| 4006 * therefore be kept in sync with, |
| 4007 * [getNextTaskAnalysisTask]. This method is |
| 4008 * intended to be used for testing purposes only. |
| 4009 * |
| 4010 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 4011 * |
| 4012 * @param source the source to be checked |
| 4013 * @param sourceEntry the cache entry associated with the source |
| 4014 * @param isPriority `true` if the source is a priority source |
| 4015 * @param hintsEnabled `true` if hints are currently enabled |
| 4016 * @param sources the set to which sources should be added |
| 4017 */ |
| 4018 void getSourcesNeedingProcessing2(Source source, SourceEntry sourceEntry, bool
isPriority, bool hintsEnabled, Set<Source> sources) { |
| 4019 if (sourceEntry is DartEntry) { |
| 4020 DartEntry dartEntry = sourceEntry as DartEntry; |
| 4021 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS); |
| 4022 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { |
| 4023 javaSetAdd(sources, source); |
| 4024 return; |
| 4025 } |
| 4026 if (isPriority) { |
| 4027 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit; |
| 4028 if (parseUnit == null) { |
| 4029 javaSetAdd(sources, source); |
| 4030 return; |
| 4031 } |
| 4032 } |
| 4033 for (Source librarySource in getLibrariesContaining(source)) { |
| 4034 SourceEntry libraryEntry = _cache.get(librarySource); |
| 4035 if (libraryEntry is DartEntry) { |
| 4036 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT); |
| 4037 if (identical(elementState, CacheState.INVALID) || (isPriority && iden
tical(elementState, CacheState.FLUSHED))) { |
| 4038 javaSetAdd(sources, source); |
| 4039 return; |
| 4040 } |
| 4041 CacheState resolvedUnitState = dartEntry.getState2(DartEntry.RESOLVED_
UNIT, librarySource); |
| 4042 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority &&
identical(resolvedUnitState, CacheState.FLUSHED))) { |
| 4043 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEM
ENT); |
| 4044 if (libraryElement != null) { |
| 4045 javaSetAdd(sources, source); |
| 4046 return; |
| 4047 } |
| 4048 } |
| 4049 CacheState verificationErrorsState = dartEntry.getState2(DartEntry.VER
IFICATION_ERRORS, librarySource); |
| 4050 if (identical(verificationErrorsState, CacheState.INVALID) || (isPrior
ity && identical(verificationErrorsState, CacheState.FLUSHED))) { |
| 4051 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEM
ENT); |
| 4052 if (libraryElement != null) { |
| 4053 javaSetAdd(sources, source); |
| 4054 return; |
| 4055 } |
| 4056 } |
| 4057 if (hintsEnabled) { |
| 4058 CacheState hintsState = dartEntry.getState2(DartEntry.HINTS, library
Source); |
| 4059 if (identical(hintsState, CacheState.INVALID) || (isPriority && iden
tical(hintsState, CacheState.FLUSHED))) { |
| 4060 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL
EMENT); |
| 4061 if (libraryElement != null) { |
| 4062 javaSetAdd(sources, source); |
| 4063 return; |
| 4064 } |
| 4065 } |
| 4066 } |
| 4067 } |
| 4068 } |
| 4069 } else if (sourceEntry is HtmlEntry) { |
| 4070 HtmlEntry htmlEntry = sourceEntry as HtmlEntry; |
| 4071 CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT); |
| 4072 if (identical(parsedUnitState, CacheState.INVALID) || (isPriority && ident
ical(parsedUnitState, CacheState.FLUSHED))) { |
| 4073 javaSetAdd(sources, source); |
| 4074 return; |
| 4075 } |
| 4076 CacheState elementState = htmlEntry.getState(HtmlEntry.ELEMENT); |
| 4077 if (identical(elementState, CacheState.INVALID) || (isPriority && identica
l(elementState, CacheState.FLUSHED))) { |
| 4078 javaSetAdd(sources, source); |
| 4079 return; |
| 4080 } |
| 4081 } |
| 4082 } |
| 4083 |
| 4084 /** |
| 4004 * Invalidate all of the resolution results computed by this context. | 4085 * Invalidate all of the resolution results computed by this context. |
| 4005 * | 4086 * |
| 4006 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 4087 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 4007 */ | 4088 */ |
| 4008 void invalidateAllResolutionInformation() { | 4089 void invalidateAllResolutionInformation() { |
| 4009 for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) { | 4090 for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) { |
| 4010 SourceEntry sourceEntry = mapEntry.getValue(); | 4091 SourceEntry sourceEntry = mapEntry.getValue(); |
| 4011 if (sourceEntry is HtmlEntry) { | 4092 if (sourceEntry is HtmlEntry) { |
| 4012 HtmlEntryImpl htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy; | 4093 HtmlEntryImpl htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy; |
| 4013 htmlCopy.invalidateAllResolutionInformation(); | 4094 htmlCopy.invalidateAllResolutionInformation(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4091 List<Source> unitSources = new List<Source>(); | 4172 List<Source> unitSources = new List<Source>(); |
| 4092 unitSources.add(library.definingCompilationUnit.source); | 4173 unitSources.add(library.definingCompilationUnit.source); |
| 4093 for (CompilationUnitElement part in library.parts) { | 4174 for (CompilationUnitElement part in library.parts) { |
| 4094 Source partSource = part.source; | 4175 Source partSource = part.source; |
| 4095 unitSources.add(partSource); | 4176 unitSources.add(partSource); |
| 4096 } | 4177 } |
| 4097 dartCopy.setValue(DartEntry.INCLUDED_PARTS, new List.from(unitSources)); | 4178 dartCopy.setValue(DartEntry.INCLUDED_PARTS, new List.from(unitSources)); |
| 4098 } | 4179 } |
| 4099 | 4180 |
| 4100 /** | 4181 /** |
| 4182 * Record the results produced by performing a [GenerateDartErrorsTask]. If th
e results were |
| 4183 * computed from data that is now out-of-date, then the results will not be re
corded. |
| 4184 * |
| 4185 * @param task the task that was performed |
| 4186 * @return an entry containing the computed results |
| 4187 * @throws AnalysisException if the results could not be recorded |
| 4188 */ |
| 4189 DartEntry recordGenerateDartErrorsTask(GenerateDartErrorsTask task) { |
| 4190 Source source = task.source; |
| 4191 Source librarySource = task.libraryElement.source; |
| 4192 AnalysisException thrownException = task.exception; |
| 4193 DartEntry dartEntry = null; |
| 4194 { |
| 4195 SourceEntry sourceEntry = _cache.get(source); |
| 4196 if (sourceEntry is! DartEntry) { |
| 4197 throw new AnalysisException.con1("Internal error: attempting to verify n
on-Dart file as a Dart file: ${source.fullName}"); |
| 4198 } |
| 4199 dartEntry = sourceEntry as DartEntry; |
| 4200 _cache.accessed(source); |
| 4201 int sourceTime = source.modificationStamp; |
| 4202 int resultTime = task.modificationTime; |
| 4203 if (sourceTime == resultTime) { |
| 4204 if (dartEntry.modificationTime != sourceTime) { |
| 4205 sourceChanged(source); |
| 4206 dartEntry = getReadableDartEntry(source); |
| 4207 if (dartEntry == null) { |
| 4208 throw new AnalysisException.con1("A Dart file became a non-Dart file
: ${source.fullName}"); |
| 4209 } |
| 4210 } |
| 4211 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4212 if (thrownException == null) { |
| 4213 dartCopy.setValue2(DartEntry.VERIFICATION_ERRORS, librarySource, task.
errors); |
| 4214 ChangeNoticeImpl notice = getNotice(source); |
| 4215 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LIN
E_INFO)); |
| 4216 } else { |
| 4217 dartCopy.setState2(DartEntry.VERIFICATION_ERRORS, librarySource, Cache
State.ERROR); |
| 4218 } |
| 4219 dartCopy.exception = thrownException; |
| 4220 _cache.put(source, dartCopy); |
| 4221 dartEntry = dartCopy; |
| 4222 } else { |
| 4223 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4224 if (thrownException == null || resultTime >= 0) { |
| 4225 dartCopy.setState2(DartEntry.VERIFICATION_ERRORS, librarySource, Cache
State.INVALID); |
| 4226 } else { |
| 4227 dartCopy.setState2(DartEntry.VERIFICATION_ERRORS, librarySource, Cache
State.ERROR); |
| 4228 } |
| 4229 dartCopy.exception = thrownException; |
| 4230 _cache.put(source, dartCopy); |
| 4231 dartEntry = dartCopy; |
| 4232 } |
| 4233 } |
| 4234 if (thrownException != null) { |
| 4235 throw thrownException; |
| 4236 } |
| 4237 return dartEntry; |
| 4238 } |
| 4239 |
| 4240 /** |
| 4101 * Record the results produced by performing a [GenerateDartHintsTask]. If the
results were | 4241 * Record the results produced by performing a [GenerateDartHintsTask]. If the
results were |
| 4102 * computed from data that is now out-of-date, then the results will not be re
corded. | 4242 * computed from data that is now out-of-date, then the results will not be re
corded. |
| 4103 * | 4243 * |
| 4104 * @param task the task that was performed | 4244 * @param task the task that was performed |
| 4105 * @return an entry containing the computed results | 4245 * @return an entry containing the computed results |
| 4106 * @throws AnalysisException if the results could not be recorded | 4246 * @throws AnalysisException if the results could not be recorded |
| 4107 */ | 4247 */ |
| 4108 DartEntry recordGenerateDartHintsTask(GenerateDartHintsTask task) { | 4248 DartEntry recordGenerateDartHintsTask(GenerateDartHintsTask task) { |
| 4109 Source librarySource = task.libraryElement.source; | 4249 Source librarySource = task.libraryElement.source; |
| 4110 AnalysisException thrownException = task.exception; | 4250 AnalysisException thrownException = task.exception; |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4217 if (task.hasPartOfDirective() && !task.hasLibraryDirective()) { | 4357 if (task.hasPartOfDirective() && !task.hasLibraryDirective()) { |
| 4218 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.PART); | 4358 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.PART); |
| 4219 } else { | 4359 } else { |
| 4220 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); | 4360 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); |
| 4221 } | 4361 } |
| 4222 dartCopy.setValue(DartEntry.PARSED_UNIT, task.compilationUnit); | 4362 dartCopy.setValue(DartEntry.PARSED_UNIT, task.compilationUnit); |
| 4223 dartCopy.setValue(DartEntry.PARSE_ERRORS, task.errors); | 4363 dartCopy.setValue(DartEntry.PARSE_ERRORS, task.errors); |
| 4224 dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, task.exportedSources); | 4364 dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, task.exportedSources); |
| 4225 dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources); | 4365 dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources); |
| 4226 dartCopy.setValue(DartEntry.INCLUDED_PARTS, task.includedSources); | 4366 dartCopy.setValue(DartEntry.INCLUDED_PARTS, task.includedSources); |
| 4367 ChangeNoticeImpl notice = getNotice(source); |
| 4368 notice.setErrors(dartEntry.allErrors, lineInfo); |
| 4227 } else { | 4369 } else { |
| 4228 dartCopy.recordParseError(); | 4370 dartCopy.recordParseError(); |
| 4229 } | 4371 } |
| 4230 dartCopy.exception = thrownException; | 4372 dartCopy.exception = thrownException; |
| 4231 _cache.put(source, dartCopy); | 4373 _cache.put(source, dartCopy); |
| 4232 dartEntry = dartCopy; | 4374 dartEntry = dartCopy; |
| 4233 } else { | 4375 } else { |
| 4234 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4376 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4235 if (thrownException == null || resultTime >= 0) { | 4377 if (thrownException == null || resultTime >= 0) { |
| 4236 dartCopy.recordParseNotInProcess(); | 4378 dartCopy.recordParseNotInProcess(); |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4562 */ | 4704 */ |
| 4563 void sourceChanged(Source source) { | 4705 void sourceChanged(Source source) { |
| 4564 SourceEntry sourceEntry = _cache.get(source); | 4706 SourceEntry sourceEntry = _cache.get(source); |
| 4565 if (sourceEntry is HtmlEntry) { | 4707 if (sourceEntry is HtmlEntry) { |
| 4566 HtmlEntryImpl htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy; | 4708 HtmlEntryImpl htmlCopy = ((sourceEntry as HtmlEntry)).writableCopy; |
| 4567 htmlCopy.modificationTime = source.modificationStamp; | 4709 htmlCopy.modificationTime = source.modificationStamp; |
| 4568 htmlCopy.invalidateAllInformation(); | 4710 htmlCopy.invalidateAllInformation(); |
| 4569 _cache.put(source, htmlCopy); | 4711 _cache.put(source, htmlCopy); |
| 4570 } else if (sourceEntry is DartEntry) { | 4712 } else if (sourceEntry is DartEntry) { |
| 4571 List<Source> containingLibraries = getLibrariesContaining(source); | 4713 List<Source> containingLibraries = getLibrariesContaining(source); |
| 4572 for (Source library in containingLibraries) { | 4714 Set<Source> librariesToInvalidate = new Set<Source>(); |
| 4715 for (Source containingLibrary in containingLibraries) { |
| 4716 javaSetAdd(librariesToInvalidate, containingLibrary); |
| 4717 for (Source dependentLibrary in getLibrariesDependingOn(containingLibrar
y)) { |
| 4718 javaSetAdd(librariesToInvalidate, dependentLibrary); |
| 4719 } |
| 4720 } |
| 4721 for (Source library in librariesToInvalidate) { |
| 4573 invalidateLibraryResolution(library); | 4722 invalidateLibraryResolution(library); |
| 4574 } | 4723 } |
| 4575 DartEntryImpl dartCopy = ((sourceEntry as DartEntry)).writableCopy; | 4724 DartEntryImpl dartCopy = ((sourceEntry as DartEntry)).writableCopy; |
| 4576 dartCopy.modificationTime = source.modificationStamp; | 4725 dartCopy.modificationTime = source.modificationStamp; |
| 4577 dartCopy.invalidateAllInformation(); | 4726 dartCopy.invalidateAllInformation(); |
| 4578 _cache.put(source, dartCopy); | 4727 _cache.put(source, dartCopy); |
| 4579 } | 4728 } |
| 4580 } | 4729 } |
| 4581 | 4730 |
| 4582 /** | 4731 /** |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4601 _cache.remove(source); | 4750 _cache.remove(source); |
| 4602 } | 4751 } |
| 4603 } | 4752 } |
| 4604 /** | 4753 /** |
| 4605 * Instances of the class `AnalysisTaskResultRecorder` are used by an analysis c
ontext to | 4754 * Instances of the class `AnalysisTaskResultRecorder` are used by an analysis c
ontext to |
| 4606 * record the results of a task. | 4755 * record the results of a task. |
| 4607 */ | 4756 */ |
| 4608 class AnalysisContextImpl_AnalysisTaskResultRecorder implements AnalysisTaskVisi
tor<SourceEntry> { | 4757 class AnalysisContextImpl_AnalysisTaskResultRecorder implements AnalysisTaskVisi
tor<SourceEntry> { |
| 4609 final AnalysisContextImpl AnalysisContextImpl_this; | 4758 final AnalysisContextImpl AnalysisContextImpl_this; |
| 4610 AnalysisContextImpl_AnalysisTaskResultRecorder(this.AnalysisContextImpl_this); | 4759 AnalysisContextImpl_AnalysisTaskResultRecorder(this.AnalysisContextImpl_this); |
| 4760 SourceEntry visitGenerateDartErrorsTask(GenerateDartErrorsTask task) => Analys
isContextImpl_this.recordGenerateDartErrorsTask(task); |
| 4611 SourceEntry visitGenerateDartHintsTask(GenerateDartHintsTask task) => Analysis
ContextImpl_this.recordGenerateDartHintsTask(task); | 4761 SourceEntry visitGenerateDartHintsTask(GenerateDartHintsTask task) => Analysis
ContextImpl_this.recordGenerateDartHintsTask(task); |
| 4612 DartEntry visitParseDartTask(ParseDartTask task) => AnalysisContextImpl_this.r
ecordParseDartTaskResults(task); | 4762 DartEntry visitParseDartTask(ParseDartTask task) => AnalysisContextImpl_this.r
ecordParseDartTaskResults(task); |
| 4613 HtmlEntry visitParseHtmlTask(ParseHtmlTask task) => AnalysisContextImpl_this.r
ecordParseHtmlTaskResults(task); | 4763 HtmlEntry visitParseHtmlTask(ParseHtmlTask task) => AnalysisContextImpl_this.r
ecordParseHtmlTaskResults(task); |
| 4614 DartEntry visitResolveDartLibraryTask(ResolveDartLibraryTask task) => Analysis
ContextImpl_this.recordResolveDartLibraryTaskResults(task); | 4764 DartEntry visitResolveDartLibraryTask(ResolveDartLibraryTask task) => Analysis
ContextImpl_this.recordResolveDartLibraryTaskResults(task); |
| 4615 SourceEntry visitResolveDartUnitTask(ResolveDartUnitTask task) => AnalysisCont
extImpl_this.recordResolveDartUnitTaskResults(task); | 4765 SourceEntry visitResolveDartUnitTask(ResolveDartUnitTask task) => AnalysisCont
extImpl_this.recordResolveDartUnitTaskResults(task); |
| 4616 SourceEntry visitResolveHtmlTask(ResolveHtmlTask task) => AnalysisContextImpl_
this.recordResolveHtmlTaskResults(task); | 4766 SourceEntry visitResolveHtmlTask(ResolveHtmlTask task) => AnalysisContextImpl_
this.recordResolveHtmlTaskResults(task); |
| 4617 } | 4767 } |
| 4618 /** | 4768 /** |
| 4619 * Instances of the class `AnalysisErrorInfoImpl` represent the analysis errors
and line info | 4769 * Instances of the class `AnalysisErrorInfoImpl` represent the analysis errors
and line info |
| 4620 * associated with a source. | 4770 * associated with a source. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4807 * Set the errors that changed as a result of the analysis to the given errors
and set the line | 4957 * Set the errors that changed as a result of the analysis to the given errors
and set the line |
| 4808 * information to the given line information. | 4958 * information to the given line information. |
| 4809 * | 4959 * |
| 4810 * @param errors the errors that changed as a result of the analysis | 4960 * @param errors the errors that changed as a result of the analysis |
| 4811 * @param lineInfo the line information associated with the source | 4961 * @param lineInfo the line information associated with the source |
| 4812 */ | 4962 */ |
| 4813 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { | 4963 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { |
| 4814 this._errors = errors; | 4964 this._errors = errors; |
| 4815 this._lineInfo = lineInfo; | 4965 this._lineInfo = lineInfo; |
| 4816 } | 4966 } |
| 4967 String toString() => "Changes for ${_source.fullName}"; |
| 4817 } | 4968 } |
| 4818 /** | 4969 /** |
| 4819 * Instances of the class `DelegatingAnalysisContextImpl` extend [AnalysisContex
tImpl | 4970 * Instances of the class `DelegatingAnalysisContextImpl` extend [AnalysisContex
tImpl |
| 4820 ] to delegate sources to the appropriate analysis context. For instance, if the | 4971 ] to delegate sources to the appropriate analysis context. For instance, if the |
| 4821 * source is in a system library then the analysis context from the [DartSdk] is
used. | 4972 * source is in a system library then the analysis context from the [DartSdk] is
used. |
| 4822 * | 4973 * |
| 4823 * @coverage dart.engine | 4974 * @coverage dart.engine |
| 4824 */ | 4975 */ |
| 4825 class DelegatingAnalysisContextImpl extends AnalysisContextImpl { | 4976 class DelegatingAnalysisContextImpl extends AnalysisContextImpl { |
| 4826 | 4977 |
| (...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5988 * Perform this analysis task, ensuring that all exceptions are wrapped in an | 6139 * Perform this analysis task, ensuring that all exceptions are wrapped in an |
| 5989 * [AnalysisException]. | 6140 * [AnalysisException]. |
| 5990 * | 6141 * |
| 5991 * @throws AnalysisException if any exception occurs while performing the task | 6142 * @throws AnalysisException if any exception occurs while performing the task |
| 5992 */ | 6143 */ |
| 5993 void safelyPerform() { | 6144 void safelyPerform() { |
| 5994 try { | 6145 try { |
| 5995 internalPerform(); | 6146 internalPerform(); |
| 5996 } on AnalysisException catch (exception) { | 6147 } on AnalysisException catch (exception) { |
| 5997 throw exception; | 6148 throw exception; |
| 5998 } catch (exception) { | 6149 } on JavaException catch (exception) { |
| 5999 throw new AnalysisException.con3(exception); | 6150 throw new AnalysisException.con3(exception); |
| 6000 } | 6151 } |
| 6001 } | 6152 } |
| 6002 } | 6153 } |
| 6003 /** | 6154 /** |
| 6004 * The interface `AnalysisTaskVisitor` defines the behavior of objects that can
visit tasks. | 6155 * The interface `AnalysisTaskVisitor` defines the behavior of objects that can
visit tasks. |
| 6005 * While tasks are not structured in any interesting way, this class provides th
e ability to | 6156 * While tasks are not structured in any interesting way, this class provides th
e ability to |
| 6006 * dispatch to an appropriate method. | 6157 * dispatch to an appropriate method. |
| 6007 */ | 6158 */ |
| 6008 abstract class AnalysisTaskVisitor<E> { | 6159 abstract class AnalysisTaskVisitor<E> { |
| 6009 | 6160 |
| 6010 /** | 6161 /** |
| 6162 * Visit a [GenerateDartErrorsTask]. |
| 6163 * |
| 6164 * @param task the task to be visited |
| 6165 * @return the result of visiting the task |
| 6166 * @throws AnalysisException if the visitor throws an exception for some reaso
n |
| 6167 */ |
| 6168 E visitGenerateDartErrorsTask(GenerateDartErrorsTask task); |
| 6169 |
| 6170 /** |
| 6011 * Visit a [GenerateDartHintsTask]. | 6171 * Visit a [GenerateDartHintsTask]. |
| 6012 * | 6172 * |
| 6013 * @param task the task to be visited | 6173 * @param task the task to be visited |
| 6014 * @return the result of visiting the task | 6174 * @return the result of visiting the task |
| 6015 * @throws AnalysisException if the visitor throws an exception for some reaso
n | 6175 * @throws AnalysisException if the visitor throws an exception for some reaso
n |
| 6016 */ | 6176 */ |
| 6017 E visitGenerateDartHintsTask(GenerateDartHintsTask task); | 6177 E visitGenerateDartHintsTask(GenerateDartHintsTask task); |
| 6018 | 6178 |
| 6019 /** | 6179 /** |
| 6020 * Visit a [ParseDartTask]. | 6180 * Visit a [ParseDartTask]. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6055 /** | 6215 /** |
| 6056 * Visit a [ResolveHtmlTask]. | 6216 * Visit a [ResolveHtmlTask]. |
| 6057 * | 6217 * |
| 6058 * @param task the task to be visited | 6218 * @param task the task to be visited |
| 6059 * @return the result of visiting the task | 6219 * @return the result of visiting the task |
| 6060 * @throws AnalysisException if the visitor throws an exception for some reaso
n | 6220 * @throws AnalysisException if the visitor throws an exception for some reaso
n |
| 6061 */ | 6221 */ |
| 6062 E visitResolveHtmlTask(ResolveHtmlTask task); | 6222 E visitResolveHtmlTask(ResolveHtmlTask task); |
| 6063 } | 6223 } |
| 6064 /** | 6224 /** |
| 6225 * Instances of the class `GenerateDartErrorsTask` generate errors and warnings
for a single |
| 6226 * Dart source. |
| 6227 */ |
| 6228 class GenerateDartErrorsTask extends AnalysisTask { |
| 6229 |
| 6230 /** |
| 6231 * The source for which errors and warnings are to be produced. |
| 6232 */ |
| 6233 Source source; |
| 6234 |
| 6235 /** |
| 6236 * The element model for the library containing the source. |
| 6237 */ |
| 6238 LibraryElement libraryElement; |
| 6239 |
| 6240 /** |
| 6241 * The time at which the contents of the source were last modified. |
| 6242 */ |
| 6243 int modificationTime = -1; |
| 6244 |
| 6245 /** |
| 6246 * The errors that were generated for the source. |
| 6247 */ |
| 6248 List<AnalysisError> errors; |
| 6249 |
| 6250 /** |
| 6251 * Initialize a newly created task to perform analysis within the given contex
t. |
| 6252 * |
| 6253 * @param context the context in which the task is to be performed |
| 6254 * @param source the source for which errors and warnings are to be produced |
| 6255 * @param libraryElement the element model for the library containing the sour
ce |
| 6256 */ |
| 6257 GenerateDartErrorsTask(InternalAnalysisContext context, Source source, Library
Element libraryElement) : super(context) { |
| 6258 this.source = source; |
| 6259 this.libraryElement = libraryElement; |
| 6260 } |
| 6261 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartErrorsTask(thi
s); |
| 6262 String get taskDescription => "generate errors and warnings for ${source.fullN
ame}"; |
| 6263 void internalPerform() { |
| 6264 TimeCounter_TimeCounterHandle timeCounter = PerformanceStatistics.errors.sta
rt(); |
| 6265 try { |
| 6266 InternalAnalysisContext context = this.context; |
| 6267 TimestampedData<CompilationUnit> data = context.internalResolveCompilation
Unit(source, libraryElement); |
| 6268 modificationTime = data.modificationTime; |
| 6269 CompilationUnit unit = data.data; |
| 6270 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 6271 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
| 6272 Source coreSource = context.sourceFactory.forUri(DartSdk.DART_CORE); |
| 6273 LibraryElement coreLibrary = context.getLibraryElement(coreSource); |
| 6274 TypeProvider typeProvider = new TypeProviderImpl(coreLibrary); |
| 6275 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, ty
peProvider); |
| 6276 unit.accept(constantVerifier); |
| 6277 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, libraryElem
ent, typeProvider, new InheritanceManager(libraryElement)); |
| 6278 unit.accept(errorVerifier); |
| 6279 errors = errorListener.getErrors2(source); |
| 6280 } finally { |
| 6281 timeCounter.stop(); |
| 6282 } |
| 6283 } |
| 6284 } |
| 6285 /** |
| 6065 * Instances of the class `GenerateDartHintsTask` generate hints for a single Da
rt library. | 6286 * Instances of the class `GenerateDartHintsTask` generate hints for a single Da
rt library. |
| 6066 */ | 6287 */ |
| 6067 class GenerateDartHintsTask extends AnalysisTask { | 6288 class GenerateDartHintsTask extends AnalysisTask { |
| 6068 | 6289 |
| 6069 /** | 6290 /** |
| 6070 * The element model for the library being analyzed. | 6291 * The element model for the library being analyzed. |
| 6071 */ | 6292 */ |
| 6072 LibraryElement libraryElement; | 6293 LibraryElement libraryElement; |
| 6073 | 6294 |
| 6074 /** | 6295 /** |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6242 } | 6463 } |
| 6243 return "parse as dart ${source.fullName}"; | 6464 return "parse as dart ${source.fullName}"; |
| 6244 } | 6465 } |
| 6245 void internalPerform() { | 6466 void internalPerform() { |
| 6246 RecordingErrorListener errorListener = new RecordingErrorListener(); | 6467 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 6247 List<Token> token = [null]; | 6468 List<Token> token = [null]; |
| 6248 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); | 6469 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); |
| 6249 Source_ContentReceiver receiver = new Source_ContentReceiver_9(this, errorLi
stener, token); | 6470 Source_ContentReceiver receiver = new Source_ContentReceiver_9(this, errorLi
stener, token); |
| 6250 try { | 6471 try { |
| 6251 source.getContents(receiver); | 6472 source.getContents(receiver); |
| 6252 } catch (exception) { | 6473 } on JavaException catch (exception) { |
| 6253 modificationTime = source.modificationStamp; | 6474 modificationTime = source.modificationStamp; |
| 6254 throw new AnalysisException.con3(exception); | 6475 throw new AnalysisException.con3(exception); |
| 6255 } | 6476 } |
| 6256 timeCounterScan.stop(); | 6477 timeCounterScan.stop(); |
| 6257 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); | 6478 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); |
| 6258 Parser parser = new Parser(source, errorListener); | 6479 Parser parser = new Parser(source, errorListener); |
| 6259 compilationUnit = parser.parseCompilationUnit(token[0]); | 6480 compilationUnit = parser.parseCompilationUnit(token[0]); |
| 6260 errors = errorListener.getErrors2(source); | 6481 errors = errorListener.getErrors2(source); |
| 6261 for (Directive directive in compilationUnit.directives) { | 6482 for (Directive directive in compilationUnit.directives) { |
| 6262 if (directive is ExportDirective) { | 6483 if (directive is ExportDirective) { |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6407 String get taskDescription { | 6628 String get taskDescription { |
| 6408 if (source == null) { | 6629 if (source == null) { |
| 6409 return "parse as html null source"; | 6630 return "parse as html null source"; |
| 6410 } | 6631 } |
| 6411 return "parse as html ${source.fullName}"; | 6632 return "parse as html ${source.fullName}"; |
| 6412 } | 6633 } |
| 6413 void internalPerform() { | 6634 void internalPerform() { |
| 6414 HtmlScanner scanner = new HtmlScanner(source); | 6635 HtmlScanner scanner = new HtmlScanner(source); |
| 6415 try { | 6636 try { |
| 6416 source.getContents(scanner); | 6637 source.getContents(scanner); |
| 6417 } catch (exception) { | 6638 } on JavaException catch (exception) { |
| 6418 throw new AnalysisException.con3(exception); | 6639 throw new AnalysisException.con3(exception); |
| 6419 } | 6640 } |
| 6420 HtmlScanResult scannerResult = scanner.result; | 6641 HtmlScanResult scannerResult = scanner.result; |
| 6421 modificationTime = scannerResult.modificationTime; | 6642 modificationTime = scannerResult.modificationTime; |
| 6422 lineInfo = new LineInfo(scannerResult.lineStarts); | 6643 lineInfo = new LineInfo(scannerResult.lineStarts); |
| 6423 HtmlParseResult result = new HtmlParser(source).parse(scannerResult); | 6644 HtmlParseResult result = new HtmlParser(source).parse(scannerResult); |
| 6424 htmlUnit = result.htmlUnit; | 6645 htmlUnit = result.htmlUnit; |
| 6425 referencedLibraries = librarySources; | 6646 referencedLibraries = librarySources; |
| 6426 } | 6647 } |
| 6427 | 6648 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 6454 if (javaStringEqualsIgnoreCase(attribute.text, ParseHtmlTask._TYPE_DAR
T)) { | 6675 if (javaStringEqualsIgnoreCase(attribute.text, ParseHtmlTask._TYPE_DAR
T)) { |
| 6455 isDartScript = true; | 6676 isDartScript = true; |
| 6456 } | 6677 } |
| 6457 } | 6678 } |
| 6458 } | 6679 } |
| 6459 if (isDartScript && scriptAttribute != null) { | 6680 if (isDartScript && scriptAttribute != null) { |
| 6460 try { | 6681 try { |
| 6461 Uri uri = new Uri(path: scriptAttribute.text); | 6682 Uri uri = new Uri(path: scriptAttribute.text); |
| 6462 String fileName = uri.path; | 6683 String fileName = uri.path; |
| 6463 Source librarySource = ParseHtmlTask_this.context.sourceFactory.resolv
eUri(ParseHtmlTask_this.source, fileName); | 6684 Source librarySource = ParseHtmlTask_this.context.sourceFactory.resolv
eUri(ParseHtmlTask_this.source, fileName); |
| 6464 if (librarySource.exists()) { | 6685 if (librarySource != null && librarySource.exists()) { |
| 6465 libraries.add(librarySource); | 6686 libraries.add(librarySource); |
| 6466 } | 6687 } |
| 6467 } catch (exception) { | 6688 } on URISyntaxException catch (e) { |
| 6468 AnalysisEngine.instance.logger.logInformation2("Invalid URL ('${script
Attribute.text}') in script tag in '${ParseHtmlTask_this.source.fullName}'", exc
eption); | |
| 6469 } | 6689 } |
| 6470 } | 6690 } |
| 6471 } | 6691 } |
| 6472 return super.visitXmlTagNode(node); | 6692 return super.visitXmlTagNode(node); |
| 6473 } | 6693 } |
| 6474 } | 6694 } |
| 6475 /** | 6695 /** |
| 6476 * Instances of the class `ResolveDartLibraryTask` parse a specific Dart library
. | 6696 * Instances of the class `ResolveDartLibraryTask` parse a specific Dart library
. |
| 6477 */ | 6697 */ |
| 6478 class ResolveDartLibraryTask extends AnalysisTask { | 6698 class ResolveDartLibraryTask extends AnalysisTask { |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6732 } | 6952 } |
| 6733 void logError2(String message, Exception exception) { | 6953 void logError2(String message, Exception exception) { |
| 6734 } | 6954 } |
| 6735 void logError3(Exception exception) { | 6955 void logError3(Exception exception) { |
| 6736 } | 6956 } |
| 6737 void logInformation(String message) { | 6957 void logInformation(String message) { |
| 6738 } | 6958 } |
| 6739 void logInformation2(String message, Exception exception) { | 6959 void logInformation2(String message, Exception exception) { |
| 6740 } | 6960 } |
| 6741 } | 6961 } |
| OLD | NEW |