| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine; | 8 library engine; |
| 9 | 9 |
| 10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
| (...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 this._notices = notices; | 879 this._notices = notices; |
| 880 } | 880 } |
| 881 | 881 |
| 882 /** | 882 /** |
| 883 * Return the change notices associated with this result, or `null` if there w
ere no changes | 883 * Return the change notices associated with this result, or `null` if there w
ere no changes |
| 884 * and there is no more work to be done. | 884 * and there is no more work to be done. |
| 885 * | 885 * |
| 886 * @return the change notices associated with this result | 886 * @return the change notices associated with this result |
| 887 */ | 887 */ |
| 888 List<ChangeNotice> get changeNotices => _notices; | 888 List<ChangeNotice> get changeNotices => _notices; |
| 889 |
| 890 /** |
| 891 * Return `true` if there is more to be performed after the task that was perf
ormed. |
| 892 * |
| 893 * @return `true` if there is more to be performed after the task that was per
formed |
| 894 */ |
| 895 bool get hasMoreWork => _notices != null; |
| 889 } | 896 } |
| 890 | 897 |
| 891 /** | 898 /** |
| 892 * The interface `ChangeNotice` defines the behavior of objects that represent a
change to the | 899 * The interface `ChangeNotice` defines the behavior of objects that represent a
change to the |
| 893 * analysis results associated with a given source. | 900 * analysis results associated with a given source. |
| 894 */ | 901 */ |
| 895 abstract class ChangeNotice implements AnalysisErrorInfo { | 902 abstract class ChangeNotice implements AnalysisErrorInfo { |
| 896 /** | 903 /** |
| 897 * Return the fully resolved AST that changed as a result of the analysis, or
`null` if the | 904 * Return the fully resolved AST that changed as a result of the analysis, or
`null` if the |
| 898 * AST was not changed. | 905 * AST was not changed. |
| (...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 * The data descriptor representing the errors reported during Angular resolut
ion. | 1370 * The data descriptor representing the errors reported during Angular resolut
ion. |
| 1364 */ | 1371 */ |
| 1365 static final DataDescriptor<List<AnalysisError>> ANGULAR_ERRORS = new DataDesc
riptor<List<AnalysisError>>("DartEntry.ANGULAR_ERRORS"); | 1372 static final DataDescriptor<List<AnalysisError>> ANGULAR_ERRORS = new DataDesc
riptor<List<AnalysisError>>("DartEntry.ANGULAR_ERRORS"); |
| 1366 | 1373 |
| 1367 /** | 1374 /** |
| 1368 * The data descriptor representing the list of libraries that contain this co
mpilation unit. | 1375 * The data descriptor representing the list of libraries that contain this co
mpilation unit. |
| 1369 */ | 1376 */ |
| 1370 static final DataDescriptor<List<Source>> CONTAINING_LIBRARIES = new DataDescr
iptor<List<Source>>("DartEntry.CONTAINING_LIBRARIES"); | 1377 static final DataDescriptor<List<Source>> CONTAINING_LIBRARIES = new DataDescr
iptor<List<Source>>("DartEntry.CONTAINING_LIBRARIES"); |
| 1371 | 1378 |
| 1372 /** | 1379 /** |
| 1380 * The data descriptor representing the errors reported during the resolution
of directives. |
| 1381 */ |
| 1382 static final DataDescriptor<List<AnalysisError>> DIRECTIVE_ERRORS = new DataDe
scriptor<List<AnalysisError>>("DartEntry.DIRECTIVE_ERRORS"); |
| 1383 |
| 1384 /** |
| 1373 * The data descriptor representing the library element for the library. This
data is only | 1385 * The data descriptor representing the library element for the library. This
data is only |
| 1374 * available for Dart files that are the defining compilation unit of a librar
y. | 1386 * available for Dart files that are the defining compilation unit of a librar
y. |
| 1375 */ | 1387 */ |
| 1376 static final DataDescriptor<LibraryElement> ELEMENT = new DataDescriptor<Libra
ryElement>("DartEntry.ELEMENT"); | 1388 static final DataDescriptor<LibraryElement> ELEMENT = new DataDescriptor<Libra
ryElement>("DartEntry.ELEMENT"); |
| 1377 | 1389 |
| 1378 /** | 1390 /** |
| 1379 * The data descriptor representing the list of exported libraries. This data
is only available | 1391 * The data descriptor representing the list of exported libraries. This data
is only available |
| 1380 * for Dart files that are the defining compilation unit of a library. | 1392 * for Dart files that are the defining compilation unit of a library. |
| 1381 */ | 1393 */ |
| 1382 static final DataDescriptor<List<Source>> EXPORTED_LIBRARIES = new DataDescrip
tor<List<Source>>("DartEntry.EXPORTED_LIBRARIES"); | 1394 static final DataDescriptor<List<Source>> EXPORTED_LIBRARIES = new DataDescrip
tor<List<Source>>("DartEntry.EXPORTED_LIBRARIES"); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 * The head of the token stream, or `null` if the token stream is not currentl
y cached. | 1546 * The head of the token stream, or `null` if the token stream is not currentl
y cached. |
| 1535 */ | 1547 */ |
| 1536 Token _tokenStream; | 1548 Token _tokenStream; |
| 1537 | 1549 |
| 1538 /** | 1550 /** |
| 1539 * The state of the cached scan errors. | 1551 * The state of the cached scan errors. |
| 1540 */ | 1552 */ |
| 1541 CacheState _scanErrorsState = CacheState.INVALID; | 1553 CacheState _scanErrorsState = CacheState.INVALID; |
| 1542 | 1554 |
| 1543 /** | 1555 /** |
| 1544 * The errors produced while scanning the compilation unit, or `null` if the e
rrors are not | 1556 * The errors produced while scanning the compilation unit, or an empty array
if the errors are |
| 1545 * currently cached. | 1557 * not currently cached. |
| 1546 */ | 1558 */ |
| 1547 List<AnalysisError> _scanErrors = AnalysisError.NO_ERRORS; | 1559 List<AnalysisError> _scanErrors = AnalysisError.NO_ERRORS; |
| 1548 | 1560 |
| 1549 /** | 1561 /** |
| 1550 * The state of the cached source kind. | 1562 * The state of the cached source kind. |
| 1551 */ | 1563 */ |
| 1552 CacheState _sourceKindState = CacheState.INVALID; | 1564 CacheState _sourceKindState = CacheState.INVALID; |
| 1553 | 1565 |
| 1554 /** | 1566 /** |
| 1555 * The kind of this source. | 1567 * The kind of this source. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1572 * cached. | 1584 * cached. |
| 1573 */ | 1585 */ |
| 1574 CompilationUnit _parsedUnit; | 1586 CompilationUnit _parsedUnit; |
| 1575 | 1587 |
| 1576 /** | 1588 /** |
| 1577 * The state of the cached parse errors. | 1589 * The state of the cached parse errors. |
| 1578 */ | 1590 */ |
| 1579 CacheState _parseErrorsState = CacheState.INVALID; | 1591 CacheState _parseErrorsState = CacheState.INVALID; |
| 1580 | 1592 |
| 1581 /** | 1593 /** |
| 1582 * The errors produced while parsing the compilation unit, or `null` if the er
rors are not | 1594 * The errors produced while parsing the compilation unit, or an empty array i
f the errors are not |
| 1583 * currently cached. | 1595 * currently cached. |
| 1584 */ | 1596 */ |
| 1585 List<AnalysisError> _parseErrors = AnalysisError.NO_ERRORS; | 1597 List<AnalysisError> _parseErrors = AnalysisError.NO_ERRORS; |
| 1586 | 1598 |
| 1587 /** | 1599 /** |
| 1588 * The state of the cached list of imported libraries. | 1600 * The state of the cached list of imported libraries. |
| 1589 */ | 1601 */ |
| 1590 CacheState _importedLibrariesState = CacheState.INVALID; | 1602 CacheState _importedLibrariesState = CacheState.INVALID; |
| 1591 | 1603 |
| 1592 /** | 1604 /** |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1611 */ | 1623 */ |
| 1612 CacheState _includedPartsState = CacheState.INVALID; | 1624 CacheState _includedPartsState = CacheState.INVALID; |
| 1613 | 1625 |
| 1614 /** | 1626 /** |
| 1615 * The list of parts included in the library, or an empty array if the list is
not currently | 1627 * The list of parts included in the library, or an empty array if the list is
not currently |
| 1616 * cached. The list will be empty if the Dart file is a part rather than a lib
rary. | 1628 * cached. The list will be empty if the Dart file is a part rather than a lib
rary. |
| 1617 */ | 1629 */ |
| 1618 List<Source> _includedParts = Source.EMPTY_ARRAY; | 1630 List<Source> _includedParts = Source.EMPTY_ARRAY; |
| 1619 | 1631 |
| 1620 /** | 1632 /** |
| 1633 * The state of the cached directive errors. |
| 1634 */ |
| 1635 CacheState _directiveErrorsState = CacheState.INVALID; |
| 1636 |
| 1637 /** |
| 1638 * The errors produced while resolving the directives, or an empty array if th
e errors are not |
| 1639 * currently cached. |
| 1640 */ |
| 1641 List<AnalysisError> _directiveErrors = AnalysisError.NO_ERRORS; |
| 1642 |
| 1643 /** |
| 1621 * The list of libraries that contain this compilation unit. The list will be
empty if there are | 1644 * The list of libraries that contain this compilation unit. The list will be
empty if there are |
| 1622 * no known libraries that contain this compilation unit. | 1645 * no known libraries that contain this compilation unit. |
| 1623 */ | 1646 */ |
| 1624 List<Source> _containingLibraries = new List<Source>(); | 1647 List<Source> _containingLibraries = new List<Source>(); |
| 1625 | 1648 |
| 1626 /** | 1649 /** |
| 1627 * The information known as a result of resolving this compilation unit as par
t of the library | 1650 * The information known as a result of resolving this compilation unit as par
t of the library |
| 1628 * that contains this unit. This field will never be `null`. | 1651 * that contains this unit. This field will never be `null`. |
| 1629 */ | 1652 */ |
| 1630 DartEntryImpl_ResolutionState _resolutionState = new DartEntryImpl_ResolutionS
tate(); | 1653 DartEntryImpl_ResolutionState _resolutionState = new DartEntryImpl_ResolutionS
tate(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 _parsedUnit = null; | 1730 _parsedUnit = null; |
| 1708 } | 1731 } |
| 1709 _resolutionState.flushAstStructures(); | 1732 _resolutionState.flushAstStructures(); |
| 1710 } | 1733 } |
| 1711 | 1734 |
| 1712 @override | 1735 @override |
| 1713 List<AnalysisError> get allErrors { | 1736 List<AnalysisError> get allErrors { |
| 1714 List<AnalysisError> errors = new List<AnalysisError>(); | 1737 List<AnalysisError> errors = new List<AnalysisError>(); |
| 1715 ListUtilities.addAll(errors, _scanErrors); | 1738 ListUtilities.addAll(errors, _scanErrors); |
| 1716 ListUtilities.addAll(errors, _parseErrors); | 1739 ListUtilities.addAll(errors, _parseErrors); |
| 1740 ListUtilities.addAll(errors, _directiveErrors); |
| 1717 DartEntryImpl_ResolutionState state = _resolutionState; | 1741 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1718 while (state != null) { | 1742 while (state != null) { |
| 1719 ListUtilities.addAll(errors, state._resolutionErrors); | 1743 ListUtilities.addAll(errors, state._resolutionErrors); |
| 1720 ListUtilities.addAll(errors, state._verificationErrors); | 1744 ListUtilities.addAll(errors, state._verificationErrors); |
| 1721 ListUtilities.addAll(errors, state._hints); | 1745 ListUtilities.addAll(errors, state._hints); |
| 1722 state = state._nextState; | 1746 state = state._nextState; |
| 1723 } | 1747 } |
| 1724 ListUtilities.addAll(errors, _angularErrors); | 1748 ListUtilities.addAll(errors, _angularErrors); |
| 1725 if (errors.length == 0) { | 1749 if (errors.length == 0) { |
| 1726 return AnalysisError.NO_ERRORS; | 1750 return AnalysisError.NO_ERRORS; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1791 return state._resolvedUnit.accept(new AstCloner()) as CompilationUnit; | 1815 return state._resolvedUnit.accept(new AstCloner()) as CompilationUnit; |
| 1792 } | 1816 } |
| 1793 state = state._nextState; | 1817 state = state._nextState; |
| 1794 } | 1818 } |
| 1795 ; | 1819 ; |
| 1796 return null; | 1820 return null; |
| 1797 } | 1821 } |
| 1798 | 1822 |
| 1799 @override | 1823 @override |
| 1800 CacheState getState(DataDescriptor descriptor) { | 1824 CacheState getState(DataDescriptor descriptor) { |
| 1801 if (identical(descriptor, DartEntry.ELEMENT)) { | 1825 if (identical(descriptor, DartEntry.DIRECTIVE_ERRORS)) { |
| 1826 return _directiveErrorsState; |
| 1827 } else if (identical(descriptor, DartEntry.ELEMENT)) { |
| 1802 return _elementState; | 1828 return _elementState; |
| 1803 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 1829 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 1804 return _exportedLibrariesState; | 1830 return _exportedLibrariesState; |
| 1805 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 1831 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 1806 return _importedLibrariesState; | 1832 return _importedLibrariesState; |
| 1807 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 1833 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| 1808 return _includedPartsState; | 1834 return _includedPartsState; |
| 1809 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { | 1835 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { |
| 1810 return _clientServerState; | 1836 return _clientServerState; |
| 1811 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) { | 1837 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1853 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 1879 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 1854 } | 1880 } |
| 1855 } | 1881 } |
| 1856 | 1882 |
| 1857 @override | 1883 @override |
| 1858 Object getValue(DataDescriptor descriptor) { | 1884 Object getValue(DataDescriptor descriptor) { |
| 1859 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { | 1885 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { |
| 1860 return _angularErrors; | 1886 return _angularErrors; |
| 1861 } else if (identical(descriptor, DartEntry.CONTAINING_LIBRARIES)) { | 1887 } else if (identical(descriptor, DartEntry.CONTAINING_LIBRARIES)) { |
| 1862 return new List.from(_containingLibraries); | 1888 return new List.from(_containingLibraries); |
| 1889 } else if (identical(descriptor, DartEntry.DIRECTIVE_ERRORS)) { |
| 1890 return _directiveErrors; |
| 1863 } else if (identical(descriptor, DartEntry.ELEMENT)) { | 1891 } else if (identical(descriptor, DartEntry.ELEMENT)) { |
| 1864 return _element; | 1892 return _element; |
| 1865 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 1893 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 1866 return _exportedLibraries; | 1894 return _exportedLibraries; |
| 1867 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 1895 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 1868 return _importedLibraries; | 1896 return _importedLibraries; |
| 1869 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 1897 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| 1870 return _includedParts; | 1898 return _includedParts; |
| 1871 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { | 1899 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { |
| 1872 return BooleanArray.get(_bitmask, _CLIENT_CODE_INDEX); | 1900 return BooleanArray.get(_bitmask, _CLIENT_CODE_INDEX); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1920 | 1948 |
| 1921 @override | 1949 @override |
| 1922 DartEntryImpl get writableCopy { | 1950 DartEntryImpl get writableCopy { |
| 1923 DartEntryImpl copy = new DartEntryImpl(); | 1951 DartEntryImpl copy = new DartEntryImpl(); |
| 1924 copy.copyFrom(this); | 1952 copy.copyFrom(this); |
| 1925 return copy; | 1953 return copy; |
| 1926 } | 1954 } |
| 1927 | 1955 |
| 1928 @override | 1956 @override |
| 1929 bool hasInvalidData(DataDescriptor descriptor) { | 1957 bool hasInvalidData(DataDescriptor descriptor) { |
| 1930 if (identical(descriptor, DartEntry.ELEMENT)) { | 1958 if (identical(descriptor, DartEntry.DIRECTIVE_ERRORS)) { |
| 1959 return identical(_directiveErrorsState, CacheState.INVALID); |
| 1960 } else if (identical(descriptor, DartEntry.ELEMENT)) { |
| 1931 return identical(_elementState, CacheState.INVALID); | 1961 return identical(_elementState, CacheState.INVALID); |
| 1932 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 1962 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 1933 return identical(_exportedLibrariesState, CacheState.INVALID); | 1963 return identical(_exportedLibrariesState, CacheState.INVALID); |
| 1934 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 1964 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 1935 return identical(_importedLibrariesState, CacheState.INVALID); | 1965 return identical(_importedLibrariesState, CacheState.INVALID); |
| 1936 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 1966 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| 1937 return identical(_includedPartsState, CacheState.INVALID); | 1967 return identical(_includedPartsState, CacheState.INVALID); |
| 1938 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { | 1968 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { |
| 1939 return identical(_clientServerState, CacheState.INVALID); | 1969 return identical(_clientServerState, CacheState.INVALID); |
| 1940 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) { | 1970 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 * Record that an error occurred while attempting to resolve the directives in
the source | 2059 * Record that an error occurred while attempting to resolve the directives in
the source |
| 2030 * represented by this entry. | 2060 * represented by this entry. |
| 2031 */ | 2061 */ |
| 2032 void recordDependencyError() { | 2062 void recordDependencyError() { |
| 2033 _exportedLibraries = Source.EMPTY_ARRAY; | 2063 _exportedLibraries = Source.EMPTY_ARRAY; |
| 2034 _exportedLibrariesState = CacheState.ERROR; | 2064 _exportedLibrariesState = CacheState.ERROR; |
| 2035 _importedLibraries = Source.EMPTY_ARRAY; | 2065 _importedLibraries = Source.EMPTY_ARRAY; |
| 2036 _importedLibrariesState = CacheState.ERROR; | 2066 _importedLibrariesState = CacheState.ERROR; |
| 2037 _includedParts = Source.EMPTY_ARRAY; | 2067 _includedParts = Source.EMPTY_ARRAY; |
| 2038 _includedPartsState = CacheState.ERROR; | 2068 _includedPartsState = CacheState.ERROR; |
| 2069 _directiveErrors = AnalysisError.NO_ERRORS; |
| 2070 _directiveErrorsState = CacheState.ERROR; |
| 2039 } | 2071 } |
| 2040 | 2072 |
| 2041 /** | 2073 /** |
| 2042 * Record that the information related to resolving dependencies for the assoc
iated source is | 2074 * Record that the information related to resolving dependencies for the assoc
iated source is |
| 2043 * about to be computed by the current thread. | 2075 * about to be computed by the current thread. |
| 2044 */ | 2076 */ |
| 2045 void recordDependencyInProcess() { | 2077 void recordDependencyInProcess() { |
| 2046 if (_exportedLibrariesState != CacheState.VALID) { | 2078 if (_exportedLibrariesState != CacheState.VALID) { |
| 2047 _exportedLibrariesState = CacheState.IN_PROCESS; | 2079 _exportedLibrariesState = CacheState.IN_PROCESS; |
| 2048 } | 2080 } |
| 2049 if (_importedLibrariesState != CacheState.VALID) { | 2081 if (_importedLibrariesState != CacheState.VALID) { |
| 2050 _importedLibrariesState = CacheState.IN_PROCESS; | 2082 _importedLibrariesState = CacheState.IN_PROCESS; |
| 2051 } | 2083 } |
| 2052 if (_includedPartsState != CacheState.VALID) { | 2084 if (_includedPartsState != CacheState.VALID) { |
| 2053 _includedPartsState = CacheState.IN_PROCESS; | 2085 _includedPartsState = CacheState.IN_PROCESS; |
| 2054 } | 2086 } |
| 2087 if (_directiveErrorsState != CacheState.VALID) { |
| 2088 _directiveErrorsState = CacheState.IN_PROCESS; |
| 2089 } |
| 2055 } | 2090 } |
| 2056 | 2091 |
| 2057 /** | 2092 /** |
| 2058 * Record that an in-process dependency resolution has stopped without recordi
ng results because | 2093 * Record that an in-process dependency resolution has stopped without recordi
ng results because |
| 2059 * the results were invalidated before they could be recorded. | 2094 * the results were invalidated before they could be recorded. |
| 2060 */ | 2095 */ |
| 2061 void recordDependencyNotInProcess() { | 2096 void recordDependencyNotInProcess() { |
| 2062 if (identical(_exportedLibrariesState, CacheState.IN_PROCESS)) { | 2097 if (identical(_exportedLibrariesState, CacheState.IN_PROCESS)) { |
| 2063 _exportedLibrariesState = CacheState.INVALID; | 2098 _exportedLibrariesState = CacheState.INVALID; |
| 2064 } | 2099 } |
| 2065 if (identical(_importedLibrariesState, CacheState.IN_PROCESS)) { | 2100 if (identical(_importedLibrariesState, CacheState.IN_PROCESS)) { |
| 2066 _importedLibrariesState = CacheState.INVALID; | 2101 _importedLibrariesState = CacheState.INVALID; |
| 2067 } | 2102 } |
| 2068 if (identical(_includedPartsState, CacheState.IN_PROCESS)) { | 2103 if (identical(_includedPartsState, CacheState.IN_PROCESS)) { |
| 2069 _includedPartsState = CacheState.INVALID; | 2104 _includedPartsState = CacheState.INVALID; |
| 2070 } | 2105 } |
| 2106 if (identical(_directiveErrorsState, CacheState.IN_PROCESS)) { |
| 2107 _directiveErrorsState = CacheState.INVALID; |
| 2108 } |
| 2071 } | 2109 } |
| 2072 | 2110 |
| 2073 /** | 2111 /** |
| 2074 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 2112 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
| 2075 * entry. This will set the state of all information, including any resolution
-based information, | 2113 * entry. This will set the state of all information, including any resolution
-based information, |
| 2076 * as being in error. | 2114 * as being in error. |
| 2077 */ | 2115 */ |
| 2078 void recordParseError() { | 2116 void recordParseError() { |
| 2079 _sourceKind = SourceKind.UNKNOWN; | 2117 _sourceKind = SourceKind.UNKNOWN; |
| 2080 _sourceKindState = CacheState.ERROR; | 2118 _sourceKindState = CacheState.ERROR; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2250 * | 2288 * |
| 2251 * @param librarySource the source of the single library that the list should
contain | 2289 * @param librarySource the source of the single library that the list should
contain |
| 2252 */ | 2290 */ |
| 2253 void set containingLibrary(Source librarySource) { | 2291 void set containingLibrary(Source librarySource) { |
| 2254 _containingLibraries.clear(); | 2292 _containingLibraries.clear(); |
| 2255 _containingLibraries.add(librarySource); | 2293 _containingLibraries.add(librarySource); |
| 2256 } | 2294 } |
| 2257 | 2295 |
| 2258 @override | 2296 @override |
| 2259 void setState(DataDescriptor descriptor, CacheState state) { | 2297 void setState(DataDescriptor descriptor, CacheState state) { |
| 2260 if (identical(descriptor, DartEntry.ELEMENT)) { | 2298 if (identical(descriptor, DartEntry.DIRECTIVE_ERRORS)) { |
| 2299 _directiveErrors = updatedValue(state, _directiveErrors, null); |
| 2300 _directiveErrorsState = state; |
| 2301 } else if (identical(descriptor, DartEntry.ELEMENT)) { |
| 2261 _element = updatedValue(state, _element, null); | 2302 _element = updatedValue(state, _element, null); |
| 2262 _elementState = state; | 2303 _elementState = state; |
| 2263 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 2304 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 2264 _exportedLibraries = updatedValue(state, _exportedLibraries, Source.EMPTY_
ARRAY); | 2305 _exportedLibraries = updatedValue(state, _exportedLibraries, Source.EMPTY_
ARRAY); |
| 2265 _exportedLibrariesState = state; | 2306 _exportedLibrariesState = state; |
| 2266 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 2307 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 2267 _importedLibraries = updatedValue(state, _importedLibraries, Source.EMPTY_
ARRAY); | 2308 _importedLibraries = updatedValue(state, _importedLibraries, Source.EMPTY_
ARRAY); |
| 2268 _importedLibrariesState = state; | 2309 _importedLibrariesState = state; |
| 2269 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 2310 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| 2270 _includedParts = updatedValue(state, _includedParts, Source.EMPTY_ARRAY); | 2311 _includedParts = updatedValue(state, _includedParts, Source.EMPTY_ARRAY); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2327 state._hintsState = cacheState; | 2368 state._hintsState = cacheState; |
| 2328 } else { | 2369 } else { |
| 2329 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 2370 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 2330 } | 2371 } |
| 2331 } | 2372 } |
| 2332 | 2373 |
| 2333 @override | 2374 @override |
| 2334 void setValue(DataDescriptor descriptor, Object value) { | 2375 void setValue(DataDescriptor descriptor, Object value) { |
| 2335 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { | 2376 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { |
| 2336 _angularErrors = value == null ? AnalysisError.NO_ERRORS : (value as List<
AnalysisError>); | 2377 _angularErrors = value == null ? AnalysisError.NO_ERRORS : (value as List<
AnalysisError>); |
| 2378 } else if (identical(descriptor, DartEntry.DIRECTIVE_ERRORS)) { |
| 2379 _directiveErrors = value as List<AnalysisError>; |
| 2380 _directiveErrorsState = CacheState.VALID; |
| 2337 } else if (identical(descriptor, DartEntry.ELEMENT)) { | 2381 } else if (identical(descriptor, DartEntry.ELEMENT)) { |
| 2338 _element = value as LibraryElement; | 2382 _element = value as LibraryElement; |
| 2339 _elementState = CacheState.VALID; | 2383 _elementState = CacheState.VALID; |
| 2340 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 2384 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 2341 _exportedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S
ource>); | 2385 _exportedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S
ource>); |
| 2342 _exportedLibrariesState = CacheState.VALID; | 2386 _exportedLibrariesState = CacheState.VALID; |
| 2343 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 2387 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 2344 _importedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S
ource>); | 2388 _importedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S
ource>); |
| 2345 _importedLibrariesState = CacheState.VALID; | 2389 _importedLibrariesState = CacheState.VALID; |
| 2346 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 2390 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2416 _parsedUnit = other._parsedUnit; | 2460 _parsedUnit = other._parsedUnit; |
| 2417 _parsedUnitAccessed = other._parsedUnitAccessed; | 2461 _parsedUnitAccessed = other._parsedUnitAccessed; |
| 2418 _parseErrorsState = other._parseErrorsState; | 2462 _parseErrorsState = other._parseErrorsState; |
| 2419 _parseErrors = other._parseErrors; | 2463 _parseErrors = other._parseErrors; |
| 2420 _includedPartsState = other._includedPartsState; | 2464 _includedPartsState = other._includedPartsState; |
| 2421 _includedParts = other._includedParts; | 2465 _includedParts = other._includedParts; |
| 2422 _exportedLibrariesState = other._exportedLibrariesState; | 2466 _exportedLibrariesState = other._exportedLibrariesState; |
| 2423 _exportedLibraries = other._exportedLibraries; | 2467 _exportedLibraries = other._exportedLibraries; |
| 2424 _importedLibrariesState = other._importedLibrariesState; | 2468 _importedLibrariesState = other._importedLibrariesState; |
| 2425 _importedLibraries = other._importedLibraries; | 2469 _importedLibraries = other._importedLibraries; |
| 2470 _directiveErrorsState = other._directiveErrorsState; |
| 2471 _directiveErrors = other._directiveErrors; |
| 2426 _containingLibraries = new List<Source>.from(other._containingLibraries); | 2472 _containingLibraries = new List<Source>.from(other._containingLibraries); |
| 2427 _resolutionState.copyFrom(other._resolutionState); | 2473 _resolutionState.copyFrom(other._resolutionState); |
| 2428 _elementState = other._elementState; | 2474 _elementState = other._elementState; |
| 2429 _element = other._element; | 2475 _element = other._element; |
| 2430 _publicNamespaceState = other._publicNamespaceState; | 2476 _publicNamespaceState = other._publicNamespaceState; |
| 2431 _publicNamespace = other._publicNamespace; | 2477 _publicNamespace = other._publicNamespace; |
| 2432 _clientServerState = other._clientServerState; | 2478 _clientServerState = other._clientServerState; |
| 2433 _launchableState = other._launchableState; | 2479 _launchableState = other._launchableState; |
| 2434 _bitmask = other._bitmask; | 2480 _bitmask = other._bitmask; |
| 2435 _angularErrors = other._angularErrors; | 2481 _angularErrors = other._angularErrors; |
| 2436 } | 2482 } |
| 2437 | 2483 |
| 2438 @override | 2484 @override |
| 2439 bool get hasErrorState => super.hasErrorState || identical(_scanErrorsState, C
acheState.ERROR) || identical(_tokenStreamState, CacheState.ERROR) || identical(
_sourceKindState, CacheState.ERROR) || identical(_parsedUnitState, CacheState.ER
ROR) || identical(_parseErrorsState, CacheState.ERROR) || identical(_importedLib
rariesState, CacheState.ERROR) || identical(_exportedLibrariesState, CacheState.
ERROR) || identical(_includedPartsState, CacheState.ERROR) || identical(_element
State, CacheState.ERROR) || identical(_publicNamespaceState, CacheState.ERROR) |
| identical(_clientServerState, CacheState.ERROR) || identical(_launchableState,
CacheState.ERROR) || _resolutionState.hasErrorState; | 2485 bool get hasErrorState => super.hasErrorState || identical(_scanErrorsState, C
acheState.ERROR) || identical(_tokenStreamState, CacheState.ERROR) || identical(
_sourceKindState, CacheState.ERROR) || identical(_parsedUnitState, CacheState.ER
ROR) || identical(_parseErrorsState, CacheState.ERROR) || identical(_importedLib
rariesState, CacheState.ERROR) || identical(_exportedLibrariesState, CacheState.
ERROR) || identical(_includedPartsState, CacheState.ERROR) || identical(_directi
veErrorsState, CacheState.ERROR) || identical(_elementState, CacheState.ERROR) |
| identical(_publicNamespaceState, CacheState.ERROR) || identical(_clientServerS
tate, CacheState.ERROR) || identical(_launchableState, CacheState.ERROR) || _res
olutionState.hasErrorState; |
| 2440 | 2486 |
| 2441 @override | 2487 @override |
| 2442 void writeOn(JavaStringBuilder builder) { | 2488 void writeOn(JavaStringBuilder builder) { |
| 2443 builder.append("Dart: "); | 2489 builder.append("Dart: "); |
| 2444 super.writeOn(builder); | 2490 super.writeOn(builder); |
| 2445 builder.append("; tokenStream = "); | 2491 builder.append("; tokenStream = "); |
| 2446 builder.append(_tokenStreamState); | 2492 builder.append(_tokenStreamState); |
| 2447 builder.append("; scanErrors = "); | 2493 builder.append("; scanErrors = "); |
| 2448 builder.append(_scanErrorsState); | 2494 builder.append(_scanErrorsState); |
| 2449 builder.append("; sourceKind = "); | 2495 builder.append("; sourceKind = "); |
| 2450 builder.append(_sourceKindState); | 2496 builder.append(_sourceKindState); |
| 2451 builder.append("; parsedUnit = "); | 2497 builder.append("; parsedUnit = "); |
| 2452 builder.append(_parsedUnitState); | 2498 builder.append(_parsedUnitState); |
| 2453 builder.append(" ("); | 2499 builder.append(" ("); |
| 2454 builder.append(_parsedUnitAccessed ? "T" : "F"); | 2500 builder.append(_parsedUnitAccessed ? "T" : "F"); |
| 2455 builder.append("); parseErrors = "); | 2501 builder.append("); parseErrors = "); |
| 2456 builder.append(_parseErrorsState); | 2502 builder.append(_parseErrorsState); |
| 2457 builder.append("; exportedLibraries = "); | 2503 builder.append("; exportedLibraries = "); |
| 2458 builder.append(_exportedLibrariesState); | 2504 builder.append(_exportedLibrariesState); |
| 2459 builder.append("; importedLibraries = "); | 2505 builder.append("; importedLibraries = "); |
| 2460 builder.append(_importedLibrariesState); | 2506 builder.append(_importedLibrariesState); |
| 2461 builder.append("; includedParts = "); | 2507 builder.append("; includedParts = "); |
| 2462 builder.append(_includedPartsState); | 2508 builder.append(_includedPartsState); |
| 2509 builder.append("; directiveErrors = "); |
| 2510 builder.append(_directiveErrorsState); |
| 2463 builder.append("; element = "); | 2511 builder.append("; element = "); |
| 2464 builder.append(_elementState); | 2512 builder.append(_elementState); |
| 2465 builder.append("; publicNamespace = "); | 2513 builder.append("; publicNamespace = "); |
| 2466 builder.append(_publicNamespaceState); | 2514 builder.append(_publicNamespaceState); |
| 2467 builder.append("; clientServer = "); | 2515 builder.append("; clientServer = "); |
| 2468 builder.append(_clientServerState); | 2516 builder.append(_clientServerState); |
| 2469 builder.append("; launchable = "); | 2517 builder.append("; launchable = "); |
| 2470 builder.append(_launchableState); | 2518 builder.append(_launchableState); |
| 2471 // builder.append("; angularElements = "); | 2519 // builder.append("; angularElements = "); |
| 2472 _resolutionState.writeOn(builder); | 2520 _resolutionState.writeOn(builder); |
| 2473 } | 2521 } |
| 2474 | 2522 |
| 2475 /** | 2523 /** |
| 2476 * Invalidate all of the resolution information associated with the compilatio
n unit. | 2524 * Invalidate all of the resolution information associated with the compilatio
n unit. |
| 2477 */ | 2525 */ |
| 2478 void _discardCachedResolutionInformation() { | 2526 void _discardCachedResolutionInformation() { |
| 2479 _element = null; | 2527 _element = null; |
| 2480 _elementState = CacheState.INVALID; | 2528 _elementState = CacheState.INVALID; |
| 2481 _includedParts = Source.EMPTY_ARRAY; | 2529 _includedParts = Source.EMPTY_ARRAY; |
| 2482 _includedPartsState = CacheState.INVALID; | 2530 _includedPartsState = CacheState.INVALID; |
| 2483 _exportedLibraries = Source.EMPTY_ARRAY; | 2531 _exportedLibraries = Source.EMPTY_ARRAY; |
| 2484 _exportedLibrariesState = CacheState.INVALID; | 2532 _exportedLibrariesState = CacheState.INVALID; |
| 2485 _importedLibraries = Source.EMPTY_ARRAY; | 2533 _importedLibraries = Source.EMPTY_ARRAY; |
| 2486 _importedLibrariesState = CacheState.INVALID; | 2534 _importedLibrariesState = CacheState.INVALID; |
| 2535 _directiveErrors = AnalysisError.NO_ERRORS; |
| 2536 _directiveErrorsState = CacheState.INVALID; |
| 2487 _bitmask = 0; | 2537 _bitmask = 0; |
| 2488 _clientServerState = CacheState.INVALID; | 2538 _clientServerState = CacheState.INVALID; |
| 2489 _launchableState = CacheState.INVALID; | 2539 _launchableState = CacheState.INVALID; |
| 2490 _publicNamespace = null; | 2540 _publicNamespace = null; |
| 2491 _publicNamespaceState = CacheState.INVALID; | 2541 _publicNamespaceState = CacheState.INVALID; |
| 2492 _resolutionState.invalidateAllResolutionInformation(); | 2542 _resolutionState.invalidateAllResolutionInformation(); |
| 2493 } | 2543 } |
| 2494 | 2544 |
| 2495 /** | 2545 /** |
| 2496 * Return a resolution state for the specified library, creating one as necess
ary. | 2546 * Return a resolution state for the specified library, creating one as necess
ary. |
| (...skipping 2340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4837 // | 4887 // |
| 4838 // Check to see whether we already have the information being requested. | 4888 // Check to see whether we already have the information being requested. |
| 4839 // | 4889 // |
| 4840 CacheState state = dartEntry.getState(descriptor); | 4890 CacheState state = dartEntry.getState(descriptor); |
| 4841 while (state != CacheState.ERROR && state != CacheState.VALID) { | 4891 while (state != CacheState.ERROR && state != CacheState.VALID) { |
| 4842 // | 4892 // |
| 4843 // If not, compute the information. Unless the modification date of the so
urce continues to | 4893 // If not, compute the information. Unless the modification date of the so
urce continues to |
| 4844 // change, this loop will eventually terminate. | 4894 // change, this loop will eventually terminate. |
| 4845 // | 4895 // |
| 4846 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); | 4896 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); |
| 4847 dartEntry = new ResolveDartDependenciesTask(this, source, dartEntry.modifi
cationTime, dartEntry.anyParsedCompilationUnit).perform(_resultRecorder) as Dart
Entry; | 4897 CompilationUnit unit = dartEntry.anyParsedCompilationUnit; |
| 4898 if (unit == null) { |
| 4899 throw new AnalysisException.con2("Could not cache Dart dependency data:
no parse unit", dartEntry.exception); |
| 4900 } |
| 4901 dartEntry = new ResolveDartDependenciesTask(this, source, dartEntry.modifi
cationTime, unit).perform(_resultRecorder) as DartEntry; |
| 4848 state = dartEntry.getState(descriptor); | 4902 state = dartEntry.getState(descriptor); |
| 4849 } | 4903 } |
| 4850 return dartEntry; | 4904 return dartEntry; |
| 4851 } | 4905 } |
| 4852 | 4906 |
| 4853 /** | 4907 /** |
| 4854 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which | 4908 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which |
| 4855 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or | 4909 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or |
| 4856 * [CacheState#ERROR]. This method assumes that the data can be produced by ge
nerating hints | 4910 * [CacheState#ERROR]. This method assumes that the data can be produced by ge
nerating hints |
| 4857 * for the library if the data is not already cached. | 4911 * for the library if the data is not already cached. |
| (...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6894 DartEntry partEntry = _getReadableDartEntry(partSource); | 6948 DartEntry partEntry = _getReadableDartEntry(partSource); |
| 6895 if (partEntry != null && partEntry != dartEntry) { | 6949 if (partEntry != null && partEntry != dartEntry) { |
| 6896 DartEntryImpl partCopy = partEntry.writableCopy; | 6950 DartEntryImpl partCopy = partEntry.writableCopy; |
| 6897 partCopy.addContainingLibrary(source); | 6951 partCopy.addContainingLibrary(source); |
| 6898 _cache.put(partSource, partCopy); | 6952 _cache.put(partSource, partCopy); |
| 6899 } | 6953 } |
| 6900 } | 6954 } |
| 6901 dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, task.exportedSources); | 6955 dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, task.exportedSources); |
| 6902 dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources); | 6956 dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources); |
| 6903 dartCopy.setValue(DartEntry.INCLUDED_PARTS, newParts); | 6957 dartCopy.setValue(DartEntry.INCLUDED_PARTS, newParts); |
| 6958 dartCopy.setValue(DartEntry.DIRECTIVE_ERRORS, task.errors); |
| 6904 } else { | 6959 } else { |
| 6905 dartCopy.recordDependencyError(); | 6960 dartCopy.recordDependencyError(); |
| 6906 } | 6961 } |
| 6907 dartCopy.exception = thrownException; | 6962 dartCopy.exception = thrownException; |
| 6908 _cache.put(source, dartCopy); | 6963 _cache.put(source, dartCopy); |
| 6909 dartEntry = dartCopy; | 6964 dartEntry = dartCopy; |
| 6910 } else { | 6965 } else { |
| 6911 _logInformation2("Dependency resolution results discarded for ${_debugging
String(source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTi
me = ${dartEntry.modificationTime}", thrownException); | 6966 _logInformation2("Dependency resolution results discarded for ${_debugging
String(source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTi
me = ${dartEntry.modificationTime}", thrownException); |
| 6912 DartEntryImpl dartCopy = dartEntry.writableCopy; | 6967 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 6913 if (thrownException == null || resultTime >= 0) { | 6968 if (thrownException == null || resultTime >= 0) { |
| (...skipping 4367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11281 | 11336 |
| 11282 /** | 11337 /** |
| 11283 * Return the compilation unit that was produced by parsing the source, or `nu
ll` if the | 11338 * Return the compilation unit that was produced by parsing the source, or `nu
ll` if the |
| 11284 * task has not yet been performed or if an exception occurred. | 11339 * task has not yet been performed or if an exception occurred. |
| 11285 * | 11340 * |
| 11286 * @return the compilation unit that was produced by parsing the source | 11341 * @return the compilation unit that was produced by parsing the source |
| 11287 */ | 11342 */ |
| 11288 CompilationUnit get compilationUnit => _unit; | 11343 CompilationUnit get compilationUnit => _unit; |
| 11289 | 11344 |
| 11290 /** | 11345 /** |
| 11291 * Return the errors that were produced by scanning and parsing the source, or
`null` if the | 11346 * Return the errors that were produced by scanning and parsing the source, or
an empty array if |
| 11292 * task has not yet been performed or if an exception occurred. | 11347 * the task has not yet been performed or if an exception occurred. |
| 11293 * | 11348 * |
| 11294 * @return the errors that were produced by scanning and parsing the source | 11349 * @return the errors that were produced by scanning and parsing the source |
| 11295 */ | 11350 */ |
| 11296 List<AnalysisError> get errors => _errors; | 11351 List<AnalysisError> get errors => _errors; |
| 11297 | 11352 |
| 11298 /** | 11353 /** |
| 11299 * Return `true` if the source contains a 'library' directive, or `false` if t
he task | 11354 * Return `true` if the source contains a 'library' directive, or `false` if t
he task |
| 11300 * has not yet been performed or if an exception occurred. | 11355 * has not yet been performed or if an exception occurred. |
| 11301 * | 11356 * |
| 11302 * @return `true` if the source contains a 'library' directive | 11357 * @return `true` if the source contains a 'library' directive |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11742 * A set containing the sources referenced by 'import' directives. | 11797 * A set containing the sources referenced by 'import' directives. |
| 11743 */ | 11798 */ |
| 11744 Set<Source> _importedSources = new Set<Source>(); | 11799 Set<Source> _importedSources = new Set<Source>(); |
| 11745 | 11800 |
| 11746 /** | 11801 /** |
| 11747 * A set containing the sources referenced by 'part' directives. | 11802 * A set containing the sources referenced by 'part' directives. |
| 11748 */ | 11803 */ |
| 11749 Set<Source> _includedSources = new Set<Source>(); | 11804 Set<Source> _includedSources = new Set<Source>(); |
| 11750 | 11805 |
| 11751 /** | 11806 /** |
| 11807 * The errors that were produced by resolving the directives. |
| 11808 */ |
| 11809 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; |
| 11810 |
| 11811 /** |
| 11812 * The prefix of a URI using the `dart-ext` scheme to reference a native code
library. |
| 11813 */ |
| 11814 static String _DART_EXT_SCHEME = "dart-ext:"; |
| 11815 |
| 11816 /** |
| 11752 * Initialize a newly created task to perform analysis within the given contex
t. | 11817 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11753 * | 11818 * |
| 11754 * @param context the context in which the task is to be performed | 11819 * @param context the context in which the task is to be performed |
| 11755 * @param source the source to be parsed | 11820 * @param source the source to be parsed |
| 11756 * @param modificationTime the time at which the contents of the source were l
ast modified | 11821 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 11757 * @param unit the compilation unit used to resolve the dependencies | 11822 * @param unit the compilation unit used to resolve the dependencies |
| 11758 */ | 11823 */ |
| 11759 ResolveDartDependenciesTask(InternalAnalysisContext context, this.source, this
.modificationTime, CompilationUnit unit) : super(context) { | 11824 ResolveDartDependenciesTask(InternalAnalysisContext context, this.source, this
.modificationTime, CompilationUnit unit) : super(context) { |
| 11760 this._unit = unit; | 11825 this._unit = unit; |
| 11761 } | 11826 } |
| 11762 | 11827 |
| 11763 @override | 11828 @override |
| 11764 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartDependenciesTas
k(this); | 11829 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartDependenciesTas
k(this); |
| 11765 | 11830 |
| 11766 /** | 11831 /** |
| 11832 * Return the errors that were produced by resolving the directives, or an emp
ty array if the task |
| 11833 * has not yet been performed or if an exception occurred. |
| 11834 * |
| 11835 * @return the errors that were produced by resolving the directives. |
| 11836 */ |
| 11837 List<AnalysisError> get errors => _errors; |
| 11838 |
| 11839 /** |
| 11767 * Return an array containing the sources referenced by 'export' directives, o
r an empty array if | 11840 * Return an array containing the sources referenced by 'export' directives, o
r an empty array if |
| 11768 * the task has not yet been performed or if an exception occurred. | 11841 * the task has not yet been performed or if an exception occurred. |
| 11769 * | 11842 * |
| 11770 * @return an array containing the sources referenced by 'export' directives | 11843 * @return an array containing the sources referenced by 'export' directives |
| 11771 */ | 11844 */ |
| 11772 List<Source> get exportedSources => _toArray(_exportedSources); | 11845 List<Source> get exportedSources => _toArray(_exportedSources); |
| 11773 | 11846 |
| 11774 /** | 11847 /** |
| 11775 * Return an array containing the sources referenced by 'import' directives, o
r an empty array if | 11848 * Return an array containing the sources referenced by 'import' directives, o
r an empty array if |
| 11776 * the task has not yet been performed or if an exception occurred. | 11849 * the task has not yet been performed or if an exception occurred. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 11792 if (source == null) { | 11865 if (source == null) { |
| 11793 return "resolve dart dependencies null source"; | 11866 return "resolve dart dependencies null source"; |
| 11794 } | 11867 } |
| 11795 return "resolve dart dependencies ${source.fullName}"; | 11868 return "resolve dart dependencies ${source.fullName}"; |
| 11796 } | 11869 } |
| 11797 | 11870 |
| 11798 @override | 11871 @override |
| 11799 void internalPerform() { | 11872 void internalPerform() { |
| 11800 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); | 11873 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); |
| 11801 try { | 11874 try { |
| 11875 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 11802 for (Directive directive in _unit.directives) { | 11876 for (Directive directive in _unit.directives) { |
| 11803 if (directive is ExportDirective) { | 11877 if (directive is ExportDirective) { |
| 11804 Source exportSource = _resolveSource(source, directive); | 11878 Source exportSource = _resolveSource(source, directive, errorListener)
; |
| 11805 if (exportSource != null) { | 11879 if (exportSource != null) { |
| 11806 _exportedSources.add(exportSource); | 11880 _exportedSources.add(exportSource); |
| 11807 } | 11881 } |
| 11808 } else if (directive is ImportDirective) { | 11882 } else if (directive is ImportDirective) { |
| 11809 Source importSource = _resolveSource(source, directive); | 11883 Source importSource = _resolveSource(source, directive, errorListener)
; |
| 11810 if (importSource != null) { | 11884 if (importSource != null) { |
| 11811 _importedSources.add(importSource); | 11885 _importedSources.add(importSource); |
| 11812 } | 11886 } |
| 11813 } else if (directive is PartDirective) { | 11887 } else if (directive is PartDirective) { |
| 11814 Source partSource = _resolveSource(source, directive); | 11888 Source partSource = _resolveSource(source, directive, errorListener); |
| 11815 if (partSource != null) { | 11889 if (partSource != null) { |
| 11816 _includedSources.add(partSource); | 11890 _includedSources.add(partSource); |
| 11817 } | 11891 } |
| 11818 } | 11892 } |
| 11819 } | 11893 } |
| 11894 _errors = errorListener.errors; |
| 11820 } finally { | 11895 } finally { |
| 11821 timeCounterParse.stop(); | 11896 timeCounterParse.stop(); |
| 11822 } | 11897 } |
| 11823 } | 11898 } |
| 11824 | 11899 |
| 11825 /** | 11900 /** |
| 11826 * Return the result of resolving the URI of the given URI-based directive aga
inst the URI of the | 11901 * Return the result of resolving the URI of the given URI-based directive aga
inst the URI of the |
| 11827 * given library, or `null` if the URI is not valid. | 11902 * given library, or `null` if the URI is not valid. |
| 11828 * | 11903 * |
| 11829 * @param librarySource the source representing the library containing the dir
ective | 11904 * @param librarySource the source representing the library containing the dir
ective |
| 11830 * @param directive the directive which URI should be resolved | 11905 * @param directive the directive which URI should be resolved |
| 11906 * @param errorListener the error listener to which errors should be reported |
| 11831 * @return the result of resolving the URI against the URI of the library | 11907 * @return the result of resolving the URI against the URI of the library |
| 11832 */ | 11908 */ |
| 11833 Source _resolveSource(Source librarySource, UriBasedDirective directive) { | 11909 Source _resolveSource(Source librarySource, UriBasedDirective directive, Analy
sisErrorListener errorListener) { |
| 11834 StringLiteral uriLiteral = directive.uri; | 11910 StringLiteral uriLiteral = directive.uri; |
| 11835 if (uriLiteral is StringInterpolation) { | 11911 if (uriLiteral is StringInterpolation) { |
| 11912 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION, [])); |
| 11836 return null; | 11913 return null; |
| 11837 } | 11914 } |
| 11838 String uriContent = uriLiteral.stringValue.trim(); | 11915 String uriContent = uriLiteral.stringValue.trim(); |
| 11839 if (uriContent == null) { | 11916 directive.uriContent = uriContent; |
| 11917 if (directive is ImportDirective && uriContent.startsWith(_DART_EXT_SCHEME))
{ |
| 11840 return null; | 11918 return null; |
| 11841 } | 11919 } |
| 11842 uriContent = Uri.encodeFull(uriContent); | |
| 11843 try { | 11920 try { |
| 11844 parseUriWithException(uriContent); | 11921 String encodedUriContent = Uri.encodeFull(uriContent); |
| 11845 return context.sourceFactory.resolveUri(librarySource, uriContent); | 11922 parseUriWithException(encodedUriContent); |
| 11923 AnalysisContext analysisContext = context; |
| 11924 Source source = analysisContext.sourceFactory.resolveUri(librarySource, en
codedUriContent); |
| 11925 if (!analysisContext.exists(source)) { |
| 11926 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.o
ffset, uriLiteral.length, CompileTimeErrorCode.URI_DOES_NOT_EXIST, [uriContent])
); |
| 11927 } |
| 11928 directive.source = source; |
| 11929 return source; |
| 11846 } on URISyntaxException catch (exception) { | 11930 } on URISyntaxException catch (exception) { |
| 11847 return null; | 11931 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); |
| 11848 } | 11932 } |
| 11933 return null; |
| 11849 } | 11934 } |
| 11850 | 11935 |
| 11851 /** | 11936 /** |
| 11852 * Efficiently convert the given set of sources to an array. | 11937 * Efficiently convert the given set of sources to an array. |
| 11853 * | 11938 * |
| 11854 * @param sources the set to be converted | 11939 * @param sources the set to be converted |
| 11855 * @return an array containing all of the sources in the given set | 11940 * @return an array containing all of the sources in the given set |
| 11856 */ | 11941 */ |
| 11857 List<Source> _toArray(Set<Source> sources) { | 11942 List<Source> _toArray(Set<Source> sources) { |
| 11858 int size = sources.length; | 11943 int size = sources.length; |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12333 } | 12418 } |
| 12334 | 12419 |
| 12335 @override | 12420 @override |
| 12336 void logInformation(String message) { | 12421 void logInformation(String message) { |
| 12337 } | 12422 } |
| 12338 | 12423 |
| 12339 @override | 12424 @override |
| 12340 void logInformation2(String message, Exception exception) { | 12425 void logInformation2(String message, Exception exception) { |
| 12341 } | 12426 } |
| 12342 } | 12427 } |
| OLD | NEW |