| 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 994 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1005 * Record that the specified source has been removed. | 1005 * Record that the specified source has been removed. |
| 1006 * | 1006 * |
| 1007 * @param source the source that was removed | 1007 * @param source the source that was removed |
| 1008 */ | 1008 */ |
| 1009 void removedSource(Source source) { | 1009 void removedSource(Source source) { |
| 1010 if (source != null) { | 1010 if (source != null) { |
| 1011 _removed.add(source); | 1011 _removed.add(source); |
| 1012 } | 1012 } |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 @override |
| 1015 String toString() { | 1016 String toString() { |
| 1016 JavaStringBuilder builder = new JavaStringBuilder(); | 1017 JavaStringBuilder builder = new JavaStringBuilder(); |
| 1017 bool needsSeparator = _appendSources(builder, _added, false, "added"); | 1018 bool needsSeparator = _appendSources(builder, _added, false, "added"); |
| 1018 needsSeparator = _appendSources(builder, _changed, needsSeparator, "changed"
); | 1019 needsSeparator = _appendSources(builder, _changed, needsSeparator, "changed"
); |
| 1019 _appendSources(builder, _removed, needsSeparator, "removed"); | 1020 _appendSources(builder, _removed, needsSeparator, "removed"); |
| 1020 int count = removedContainers.length; | 1021 int count = removedContainers.length; |
| 1021 if (count > 0) { | 1022 if (count > 0) { |
| 1022 if (_removed.isEmpty) { | 1023 if (_removed.isEmpty) { |
| 1023 if (needsSeparator) { | 1024 if (needsSeparator) { |
| 1024 builder.append("; "); | 1025 builder.append("; "); |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1494 * Return the value of the data represented by the given descriptor in the con
text of the given | 1495 * Return the value of the data represented by the given descriptor in the con
text of the given |
| 1495 * library, or `null` if the data represented by the descriptor is not in the
cache. | 1496 * library, or `null` if the data represented by the descriptor is not in the
cache. |
| 1496 * | 1497 * |
| 1497 * @param descriptor the descriptor representing which data is to be returned | 1498 * @param descriptor the descriptor representing which data is to be returned |
| 1498 * @param librarySource the source of the defining compilation unit of the lib
rary that is the | 1499 * @param librarySource the source of the defining compilation unit of the lib
rary that is the |
| 1499 * context for the data | 1500 * context for the data |
| 1500 * @return the value of the data represented by the given descriptor and libra
ry | 1501 * @return the value of the data represented by the given descriptor and libra
ry |
| 1501 */ | 1502 */ |
| 1502 Object getValueInLibrary(DataDescriptor descriptor, Source librarySource); | 1503 Object getValueInLibrary(DataDescriptor descriptor, Source librarySource); |
| 1503 | 1504 |
| 1505 @override |
| 1504 DartEntryImpl get writableCopy; | 1506 DartEntryImpl get writableCopy; |
| 1505 | 1507 |
| 1506 /** | 1508 /** |
| 1507 * Return `true` if the data represented by the given descriptor is marked as
being invalid. | 1509 * Return `true` if the data represented by the given descriptor is marked as
being invalid. |
| 1508 * If the descriptor represents library-specific data then this method will re
turn `true` if | 1510 * If the descriptor represents library-specific data then this method will re
turn `true` if |
| 1509 * the data associated with any library it marked as invalid. | 1511 * the data associated with any library it marked as invalid. |
| 1510 * | 1512 * |
| 1511 * @param descriptor the descriptor representing which data is being tested | 1513 * @param descriptor the descriptor representing which data is being tested |
| 1512 * @return `true` if the data is marked as being invalid | 1514 * @return `true` if the data is marked as being invalid |
| 1513 */ | 1515 */ |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1700 _tokenStream = null; | 1702 _tokenStream = null; |
| 1701 } | 1703 } |
| 1702 if (identical(_parsedUnitState, CacheState.VALID)) { | 1704 if (identical(_parsedUnitState, CacheState.VALID)) { |
| 1703 _parsedUnitState = CacheState.FLUSHED; | 1705 _parsedUnitState = CacheState.FLUSHED; |
| 1704 _parsedUnitAccessed = false; | 1706 _parsedUnitAccessed = false; |
| 1705 _parsedUnit = null; | 1707 _parsedUnit = null; |
| 1706 } | 1708 } |
| 1707 _resolutionState.flushAstStructures(); | 1709 _resolutionState.flushAstStructures(); |
| 1708 } | 1710 } |
| 1709 | 1711 |
| 1712 @override |
| 1710 List<AnalysisError> get allErrors { | 1713 List<AnalysisError> get allErrors { |
| 1711 List<AnalysisError> errors = new List<AnalysisError>(); | 1714 List<AnalysisError> errors = new List<AnalysisError>(); |
| 1712 ListUtilities.addAll(errors, _scanErrors); | 1715 ListUtilities.addAll(errors, _scanErrors); |
| 1713 ListUtilities.addAll(errors, _parseErrors); | 1716 ListUtilities.addAll(errors, _parseErrors); |
| 1714 DartEntryImpl_ResolutionState state = _resolutionState; | 1717 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1715 while (state != null) { | 1718 while (state != null) { |
| 1716 ListUtilities.addAll(errors, state._resolutionErrors); | 1719 ListUtilities.addAll(errors, state._resolutionErrors); |
| 1717 ListUtilities.addAll(errors, state._verificationErrors); | 1720 ListUtilities.addAll(errors, state._verificationErrors); |
| 1718 ListUtilities.addAll(errors, state._hints); | 1721 ListUtilities.addAll(errors, state._hints); |
| 1719 state = state._nextState; | 1722 state = state._nextState; |
| 1720 } | 1723 } |
| 1721 ListUtilities.addAll(errors, _angularErrors); | 1724 ListUtilities.addAll(errors, _angularErrors); |
| 1722 if (errors.length == 0) { | 1725 if (errors.length == 0) { |
| 1723 return AnalysisError.NO_ERRORS; | 1726 return AnalysisError.NO_ERRORS; |
| 1724 } | 1727 } |
| 1725 return new List.from(errors); | 1728 return new List.from(errors); |
| 1726 } | 1729 } |
| 1727 | 1730 |
| 1731 @override |
| 1728 CompilationUnit get anyParsedCompilationUnit { | 1732 CompilationUnit get anyParsedCompilationUnit { |
| 1729 if (identical(_parsedUnitState, CacheState.VALID)) { | 1733 if (identical(_parsedUnitState, CacheState.VALID)) { |
| 1730 _parsedUnitAccessed = true; | 1734 _parsedUnitAccessed = true; |
| 1731 return _parsedUnit; | 1735 return _parsedUnit; |
| 1732 } | 1736 } |
| 1733 return anyResolvedCompilationUnit; | 1737 return anyResolvedCompilationUnit; |
| 1734 } | 1738 } |
| 1735 | 1739 |
| 1740 @override |
| 1736 CompilationUnit get anyResolvedCompilationUnit { | 1741 CompilationUnit get anyResolvedCompilationUnit { |
| 1737 DartEntryImpl_ResolutionState state = _resolutionState; | 1742 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1738 while (state != null) { | 1743 while (state != null) { |
| 1739 if (identical(state._resolvedUnitState, CacheState.VALID)) { | 1744 if (identical(state._resolvedUnitState, CacheState.VALID)) { |
| 1740 return state._resolvedUnit; | 1745 return state._resolvedUnit; |
| 1741 } | 1746 } |
| 1742 state = state._nextState; | 1747 state = state._nextState; |
| 1743 } | 1748 } |
| 1744 ; | 1749 ; |
| 1745 return null; | 1750 return null; |
| 1746 } | 1751 } |
| 1747 | 1752 |
| 1753 @override |
| 1748 SourceKind get kind => _sourceKind; | 1754 SourceKind get kind => _sourceKind; |
| 1749 | 1755 |
| 1750 /** | 1756 /** |
| 1751 * Answer an array of library sources containing the receiver's source. | 1757 * Answer an array of library sources containing the receiver's source. |
| 1752 */ | 1758 */ |
| 1753 List<Source> get librariesContaining { | 1759 List<Source> get librariesContaining { |
| 1754 DartEntryImpl_ResolutionState state = _resolutionState; | 1760 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1755 List<Source> result = new List<Source>(); | 1761 List<Source> result = new List<Source>(); |
| 1756 while (state != null) { | 1762 while (state != null) { |
| 1757 if (state._librarySource != null) { | 1763 if (state._librarySource != null) { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1783 while (state != null) { | 1789 while (state != null) { |
| 1784 if (identical(state._resolvedUnitState, CacheState.VALID)) { | 1790 if (identical(state._resolvedUnitState, CacheState.VALID)) { |
| 1785 return state._resolvedUnit.accept(new AstCloner()) as CompilationUnit; | 1791 return state._resolvedUnit.accept(new AstCloner()) as CompilationUnit; |
| 1786 } | 1792 } |
| 1787 state = state._nextState; | 1793 state = state._nextState; |
| 1788 } | 1794 } |
| 1789 ; | 1795 ; |
| 1790 return null; | 1796 return null; |
| 1791 } | 1797 } |
| 1792 | 1798 |
| 1799 @override |
| 1793 CacheState getState(DataDescriptor descriptor) { | 1800 CacheState getState(DataDescriptor descriptor) { |
| 1794 if (identical(descriptor, DartEntry.ELEMENT)) { | 1801 if (identical(descriptor, DartEntry.ELEMENT)) { |
| 1795 return _elementState; | 1802 return _elementState; |
| 1796 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 1803 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 1797 return _exportedLibrariesState; | 1804 return _exportedLibrariesState; |
| 1798 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 1805 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 1799 return _importedLibrariesState; | 1806 return _importedLibrariesState; |
| 1800 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 1807 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| 1801 return _includedPartsState; | 1808 return _includedPartsState; |
| 1802 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { | 1809 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1813 return _scanErrorsState; | 1820 return _scanErrorsState; |
| 1814 } else if (identical(descriptor, DartEntry.SOURCE_KIND)) { | 1821 } else if (identical(descriptor, DartEntry.SOURCE_KIND)) { |
| 1815 return _sourceKindState; | 1822 return _sourceKindState; |
| 1816 } else if (identical(descriptor, DartEntry.TOKEN_STREAM)) { | 1823 } else if (identical(descriptor, DartEntry.TOKEN_STREAM)) { |
| 1817 return _tokenStreamState; | 1824 return _tokenStreamState; |
| 1818 } else { | 1825 } else { |
| 1819 return super.getState(descriptor); | 1826 return super.getState(descriptor); |
| 1820 } | 1827 } |
| 1821 } | 1828 } |
| 1822 | 1829 |
| 1830 @override |
| 1823 CacheState getStateInLibrary(DataDescriptor descriptor, Source librarySource)
{ | 1831 CacheState getStateInLibrary(DataDescriptor descriptor, Source librarySource)
{ |
| 1824 DartEntryImpl_ResolutionState state = _resolutionState; | 1832 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1825 while (state != null) { | 1833 while (state != null) { |
| 1826 if (librarySource == state._librarySource) { | 1834 if (librarySource == state._librarySource) { |
| 1827 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { | 1835 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { |
| 1828 return state._resolutionErrorsState; | 1836 return state._resolutionErrorsState; |
| 1829 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 1837 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 1830 return state._resolvedUnitState; | 1838 return state._resolvedUnitState; |
| 1831 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { | 1839 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 1832 return state._verificationErrorsState; | 1840 return state._verificationErrorsState; |
| 1833 } else if (identical(descriptor, DartEntry.HINTS)) { | 1841 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 1834 return state._hintsState; | 1842 return state._hintsState; |
| 1835 } else { | 1843 } else { |
| 1836 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); | 1844 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); |
| 1837 } | 1845 } |
| 1838 } | 1846 } |
| 1839 state = state._nextState; | 1847 state = state._nextState; |
| 1840 } | 1848 } |
| 1841 ; | 1849 ; |
| 1842 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS) || identical(descript
or, DartEntry.RESOLVED_UNIT) || identical(descriptor, DartEntry.VERIFICATION_ERR
ORS) || identical(descriptor, DartEntry.HINTS)) { | 1850 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS) || identical(descript
or, DartEntry.RESOLVED_UNIT) || identical(descriptor, DartEntry.VERIFICATION_ERR
ORS) || identical(descriptor, DartEntry.HINTS)) { |
| 1843 return CacheState.INVALID; | 1851 return CacheState.INVALID; |
| 1844 } else { | 1852 } else { |
| 1845 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 1853 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 1846 } | 1854 } |
| 1847 } | 1855 } |
| 1848 | 1856 |
| 1857 @override |
| 1849 Object getValue(DataDescriptor descriptor) { | 1858 Object getValue(DataDescriptor descriptor) { |
| 1850 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { | 1859 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { |
| 1851 return _angularErrors; | 1860 return _angularErrors; |
| 1852 } else if (identical(descriptor, DartEntry.CONTAINING_LIBRARIES)) { | 1861 } else if (identical(descriptor, DartEntry.CONTAINING_LIBRARIES)) { |
| 1853 return new List.from(_containingLibraries); | 1862 return new List.from(_containingLibraries); |
| 1854 } else if (identical(descriptor, DartEntry.ELEMENT)) { | 1863 } else if (identical(descriptor, DartEntry.ELEMENT)) { |
| 1855 return _element; | 1864 return _element; |
| 1856 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 1865 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 1857 return _exportedLibraries; | 1866 return _exportedLibraries; |
| 1858 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 1867 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1873 } else if (identical(descriptor, DartEntry.SCAN_ERRORS)) { | 1882 } else if (identical(descriptor, DartEntry.SCAN_ERRORS)) { |
| 1874 return _scanErrors; | 1883 return _scanErrors; |
| 1875 } else if (identical(descriptor, DartEntry.SOURCE_KIND)) { | 1884 } else if (identical(descriptor, DartEntry.SOURCE_KIND)) { |
| 1876 return _sourceKind; | 1885 return _sourceKind; |
| 1877 } else if (identical(descriptor, DartEntry.TOKEN_STREAM)) { | 1886 } else if (identical(descriptor, DartEntry.TOKEN_STREAM)) { |
| 1878 return _tokenStream; | 1887 return _tokenStream; |
| 1879 } | 1888 } |
| 1880 return super.getValue(descriptor); | 1889 return super.getValue(descriptor); |
| 1881 } | 1890 } |
| 1882 | 1891 |
| 1892 @override |
| 1883 Object getValueInLibrary(DataDescriptor descriptor, Source librarySource) { | 1893 Object getValueInLibrary(DataDescriptor descriptor, Source librarySource) { |
| 1884 DartEntryImpl_ResolutionState state = _resolutionState; | 1894 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1885 while (state != null) { | 1895 while (state != null) { |
| 1886 if (librarySource == state._librarySource) { | 1896 if (librarySource == state._librarySource) { |
| 1887 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { | 1897 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS)) { |
| 1888 return state._resolutionErrors; | 1898 return state._resolutionErrors; |
| 1889 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 1899 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 1890 return state._resolvedUnit; | 1900 return state._resolvedUnit; |
| 1891 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { | 1901 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 1892 return state._verificationErrors; | 1902 return state._verificationErrors; |
| 1893 } else if (identical(descriptor, DartEntry.HINTS)) { | 1903 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 1894 return state._hints; | 1904 return state._hints; |
| 1895 } else { | 1905 } else { |
| 1896 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); | 1906 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"
); |
| 1897 } | 1907 } |
| 1898 } | 1908 } |
| 1899 state = state._nextState; | 1909 state = state._nextState; |
| 1900 } | 1910 } |
| 1901 ; | 1911 ; |
| 1902 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS) || identical(descript
or, DartEntry.VERIFICATION_ERRORS) || identical(descriptor, DartEntry.HINTS)) { | 1912 if (identical(descriptor, DartEntry.RESOLUTION_ERRORS) || identical(descript
or, DartEntry.VERIFICATION_ERRORS) || identical(descriptor, DartEntry.HINTS)) { |
| 1903 return AnalysisError.NO_ERRORS; | 1913 return AnalysisError.NO_ERRORS; |
| 1904 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { | 1914 } else if (identical(descriptor, DartEntry.RESOLVED_UNIT)) { |
| 1905 return null; | 1915 return null; |
| 1906 } else { | 1916 } else { |
| 1907 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 1917 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 1908 } | 1918 } |
| 1909 } | 1919 } |
| 1910 | 1920 |
| 1921 @override |
| 1911 DartEntryImpl get writableCopy { | 1922 DartEntryImpl get writableCopy { |
| 1912 DartEntryImpl copy = new DartEntryImpl(); | 1923 DartEntryImpl copy = new DartEntryImpl(); |
| 1913 copy.copyFrom(this); | 1924 copy.copyFrom(this); |
| 1914 return copy; | 1925 return copy; |
| 1915 } | 1926 } |
| 1916 | 1927 |
| 1928 @override |
| 1917 bool hasInvalidData(DataDescriptor descriptor) { | 1929 bool hasInvalidData(DataDescriptor descriptor) { |
| 1918 if (identical(descriptor, DartEntry.ELEMENT)) { | 1930 if (identical(descriptor, DartEntry.ELEMENT)) { |
| 1919 return identical(_elementState, CacheState.INVALID); | 1931 return identical(_elementState, CacheState.INVALID); |
| 1920 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 1932 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 1921 return identical(_exportedLibrariesState, CacheState.INVALID); | 1933 return identical(_exportedLibrariesState, CacheState.INVALID); |
| 1922 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 1934 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 1923 return identical(_importedLibrariesState, CacheState.INVALID); | 1935 return identical(_importedLibrariesState, CacheState.INVALID); |
| 1924 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 1936 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| 1925 return identical(_includedPartsState, CacheState.INVALID); | 1937 return identical(_includedPartsState, CacheState.INVALID); |
| 1926 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { | 1938 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 1951 } else if (identical(descriptor, DartEntry.HINTS)) { | 1963 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 1952 return identical(state._hintsState, CacheState.INVALID); | 1964 return identical(state._hintsState, CacheState.INVALID); |
| 1953 } | 1965 } |
| 1954 } | 1966 } |
| 1955 return false; | 1967 return false; |
| 1956 } else { | 1968 } else { |
| 1957 return identical(super.getState(descriptor), CacheState.INVALID); | 1969 return identical(super.getState(descriptor), CacheState.INVALID); |
| 1958 } | 1970 } |
| 1959 } | 1971 } |
| 1960 | 1972 |
| 1973 @override |
| 1961 void invalidateAllInformation() { | 1974 void invalidateAllInformation() { |
| 1962 super.invalidateAllInformation(); | 1975 super.invalidateAllInformation(); |
| 1963 _scanErrors = AnalysisError.NO_ERRORS; | 1976 _scanErrors = AnalysisError.NO_ERRORS; |
| 1964 _scanErrorsState = CacheState.INVALID; | 1977 _scanErrorsState = CacheState.INVALID; |
| 1965 _tokenStream = null; | 1978 _tokenStream = null; |
| 1966 _tokenStreamState = CacheState.INVALID; | 1979 _tokenStreamState = CacheState.INVALID; |
| 1967 _sourceKind = SourceKind.UNKNOWN; | 1980 _sourceKind = SourceKind.UNKNOWN; |
| 1968 _sourceKindState = CacheState.INVALID; | 1981 _sourceKindState = CacheState.INVALID; |
| 1969 _parseErrors = AnalysisError.NO_ERRORS; | 1982 _parseErrors = AnalysisError.NO_ERRORS; |
| 1970 _parseErrorsState = CacheState.INVALID; | 1983 _parseErrorsState = CacheState.INVALID; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1986 _parsedUnitAccessed = true; | 1999 _parsedUnitAccessed = true; |
| 1987 _parsedUnitState = CacheState.VALID; | 2000 _parsedUnitState = CacheState.VALID; |
| 1988 break; | 2001 break; |
| 1989 } | 2002 } |
| 1990 state = state._nextState; | 2003 state = state._nextState; |
| 1991 } | 2004 } |
| 1992 } | 2005 } |
| 1993 _discardCachedResolutionInformation(); | 2006 _discardCachedResolutionInformation(); |
| 1994 } | 2007 } |
| 1995 | 2008 |
| 2009 @override |
| 1996 bool get isRefactoringSafe { | 2010 bool get isRefactoringSafe { |
| 1997 DartEntryImpl_ResolutionState state = _resolutionState; | 2011 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1998 while (state != null) { | 2012 while (state != null) { |
| 1999 CacheState resolvedState = state._resolvedUnitState; | 2013 CacheState resolvedState = state._resolvedUnitState; |
| 2000 if (resolvedState != CacheState.VALID && resolvedState != CacheState.FLUSH
ED) { | 2014 if (resolvedState != CacheState.VALID && resolvedState != CacheState.FLUSH
ED) { |
| 2001 return false; | 2015 return false; |
| 2002 } | 2016 } |
| 2003 state = state._nextState; | 2017 state = state._nextState; |
| 2004 } | 2018 } |
| 2005 return true; | 2019 return true; |
| 2006 } | 2020 } |
| 2007 | 2021 |
| 2022 @override |
| 2008 void recordContentError() { | 2023 void recordContentError() { |
| 2009 super.recordContentError(); | 2024 super.recordContentError(); |
| 2010 recordScanError(); | 2025 recordScanError(); |
| 2011 } | 2026 } |
| 2012 | 2027 |
| 2013 /** | 2028 /** |
| 2014 * Record that an error occurred while attempting to resolve the directives in
the source | 2029 * Record that an error occurred while attempting to resolve the directives in
the source |
| 2015 * represented by this entry. | 2030 * represented by this entry. |
| 2016 */ | 2031 */ |
| 2017 void recordDependencyError() { | 2032 void recordDependencyError() { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2233 * Set the list of libraries that contain this compilation unit to contain onl
y the given source. | 2248 * Set the list of libraries that contain this compilation unit to contain onl
y the given source. |
| 2234 * This method should only be invoked on entries that represent a library. | 2249 * This method should only be invoked on entries that represent a library. |
| 2235 * | 2250 * |
| 2236 * @param librarySource the source of the single library that the list should
contain | 2251 * @param librarySource the source of the single library that the list should
contain |
| 2237 */ | 2252 */ |
| 2238 void set containingLibrary(Source librarySource) { | 2253 void set containingLibrary(Source librarySource) { |
| 2239 _containingLibraries.clear(); | 2254 _containingLibraries.clear(); |
| 2240 _containingLibraries.add(librarySource); | 2255 _containingLibraries.add(librarySource); |
| 2241 } | 2256 } |
| 2242 | 2257 |
| 2258 @override |
| 2243 void setState(DataDescriptor descriptor, CacheState state) { | 2259 void setState(DataDescriptor descriptor, CacheState state) { |
| 2244 if (identical(descriptor, DartEntry.ELEMENT)) { | 2260 if (identical(descriptor, DartEntry.ELEMENT)) { |
| 2245 _element = updatedValue(state, _element, null); | 2261 _element = updatedValue(state, _element, null); |
| 2246 _elementState = state; | 2262 _elementState = state; |
| 2247 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 2263 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 2248 _exportedLibraries = updatedValue(state, _exportedLibraries, Source.EMPTY_
ARRAY); | 2264 _exportedLibraries = updatedValue(state, _exportedLibraries, Source.EMPTY_
ARRAY); |
| 2249 _exportedLibrariesState = state; | 2265 _exportedLibrariesState = state; |
| 2250 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 2266 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 2251 _importedLibraries = updatedValue(state, _importedLibraries, Source.EMPTY_
ARRAY); | 2267 _importedLibraries = updatedValue(state, _importedLibraries, Source.EMPTY_
ARRAY); |
| 2252 _importedLibrariesState = state; | 2268 _importedLibrariesState = state; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2307 state._verificationErrors = updatedValue(cacheState, state._verificationEr
rors, AnalysisError.NO_ERRORS); | 2323 state._verificationErrors = updatedValue(cacheState, state._verificationEr
rors, AnalysisError.NO_ERRORS); |
| 2308 state._verificationErrorsState = cacheState; | 2324 state._verificationErrorsState = cacheState; |
| 2309 } else if (identical(descriptor, DartEntry.HINTS)) { | 2325 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 2310 state._hints = updatedValue(cacheState, state._hints, AnalysisError.NO_ERR
ORS); | 2326 state._hints = updatedValue(cacheState, state._hints, AnalysisError.NO_ERR
ORS); |
| 2311 state._hintsState = cacheState; | 2327 state._hintsState = cacheState; |
| 2312 } else { | 2328 } else { |
| 2313 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 2329 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 2314 } | 2330 } |
| 2315 } | 2331 } |
| 2316 | 2332 |
| 2333 @override |
| 2317 void setValue(DataDescriptor descriptor, Object value) { | 2334 void setValue(DataDescriptor descriptor, Object value) { |
| 2318 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { | 2335 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { |
| 2319 _angularErrors = value == null ? AnalysisError.NO_ERRORS : (value as List<
AnalysisError>); | 2336 _angularErrors = value == null ? AnalysisError.NO_ERRORS : (value as List<
AnalysisError>); |
| 2320 } else if (identical(descriptor, DartEntry.ELEMENT)) { | 2337 } else if (identical(descriptor, DartEntry.ELEMENT)) { |
| 2321 _element = value as LibraryElement; | 2338 _element = value as LibraryElement; |
| 2322 _elementState = CacheState.VALID; | 2339 _elementState = CacheState.VALID; |
| 2323 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 2340 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 2324 _exportedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S
ource>); | 2341 _exportedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S
ource>); |
| 2325 _exportedLibrariesState = CacheState.VALID; | 2342 _exportedLibrariesState = CacheState.VALID; |
| 2326 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 2343 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2378 state._resolvedUnitState = CacheState.VALID; | 2395 state._resolvedUnitState = CacheState.VALID; |
| 2379 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { | 2396 } else if (identical(descriptor, DartEntry.VERIFICATION_ERRORS)) { |
| 2380 state._verificationErrors = value == null ? AnalysisError.NO_ERRORS : (val
ue as List<AnalysisError>); | 2397 state._verificationErrors = value == null ? AnalysisError.NO_ERRORS : (val
ue as List<AnalysisError>); |
| 2381 state._verificationErrorsState = CacheState.VALID; | 2398 state._verificationErrorsState = CacheState.VALID; |
| 2382 } else if (identical(descriptor, DartEntry.HINTS)) { | 2399 } else if (identical(descriptor, DartEntry.HINTS)) { |
| 2383 state._hints = value == null ? AnalysisError.NO_ERRORS : (value as List<An
alysisError>); | 2400 state._hints = value == null ? AnalysisError.NO_ERRORS : (value as List<An
alysisError>); |
| 2384 state._hintsState = CacheState.VALID; | 2401 state._hintsState = CacheState.VALID; |
| 2385 } | 2402 } |
| 2386 } | 2403 } |
| 2387 | 2404 |
| 2405 @override |
| 2388 void copyFrom(SourceEntryImpl entry) { | 2406 void copyFrom(SourceEntryImpl entry) { |
| 2389 super.copyFrom(entry); | 2407 super.copyFrom(entry); |
| 2390 DartEntryImpl other = entry as DartEntryImpl; | 2408 DartEntryImpl other = entry as DartEntryImpl; |
| 2391 _scanErrorsState = other._scanErrorsState; | 2409 _scanErrorsState = other._scanErrorsState; |
| 2392 _scanErrors = other._scanErrors; | 2410 _scanErrors = other._scanErrors; |
| 2393 _tokenStreamState = other._tokenStreamState; | 2411 _tokenStreamState = other._tokenStreamState; |
| 2394 _tokenStream = other._tokenStream; | 2412 _tokenStream = other._tokenStream; |
| 2395 _sourceKindState = other._sourceKindState; | 2413 _sourceKindState = other._sourceKindState; |
| 2396 _sourceKind = other._sourceKind; | 2414 _sourceKind = other._sourceKind; |
| 2397 _parsedUnitState = other._parsedUnitState; | 2415 _parsedUnitState = other._parsedUnitState; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2410 _elementState = other._elementState; | 2428 _elementState = other._elementState; |
| 2411 _element = other._element; | 2429 _element = other._element; |
| 2412 _publicNamespaceState = other._publicNamespaceState; | 2430 _publicNamespaceState = other._publicNamespaceState; |
| 2413 _publicNamespace = other._publicNamespace; | 2431 _publicNamespace = other._publicNamespace; |
| 2414 _clientServerState = other._clientServerState; | 2432 _clientServerState = other._clientServerState; |
| 2415 _launchableState = other._launchableState; | 2433 _launchableState = other._launchableState; |
| 2416 _bitmask = other._bitmask; | 2434 _bitmask = other._bitmask; |
| 2417 _angularErrors = other._angularErrors; | 2435 _angularErrors = other._angularErrors; |
| 2418 } | 2436 } |
| 2419 | 2437 |
| 2438 @override |
| 2420 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; | 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; |
| 2421 | 2440 |
| 2441 @override |
| 2422 void writeOn(JavaStringBuilder builder) { | 2442 void writeOn(JavaStringBuilder builder) { |
| 2423 builder.append("Dart: "); | 2443 builder.append("Dart: "); |
| 2424 super.writeOn(builder); | 2444 super.writeOn(builder); |
| 2425 builder.append("; tokenStream = "); | 2445 builder.append("; tokenStream = "); |
| 2426 builder.append(_tokenStreamState); | 2446 builder.append(_tokenStreamState); |
| 2427 builder.append("; scanErrors = "); | 2447 builder.append("; scanErrors = "); |
| 2428 builder.append(_scanErrorsState); | 2448 builder.append(_scanErrorsState); |
| 2429 builder.append("; sourceKind = "); | 2449 builder.append("; sourceKind = "); |
| 2430 builder.append(_sourceKindState); | 2450 builder.append(_sourceKindState); |
| 2431 builder.append("; parsedUnit = "); | 2451 builder.append("; parsedUnit = "); |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2708 | 2728 |
| 2709 /** | 2729 /** |
| 2710 * Initialize a newly created descriptor to have the given name. | 2730 * Initialize a newly created descriptor to have the given name. |
| 2711 * | 2731 * |
| 2712 * @param name the name of the descriptor | 2732 * @param name the name of the descriptor |
| 2713 */ | 2733 */ |
| 2714 DataDescriptor(String name) { | 2734 DataDescriptor(String name) { |
| 2715 this._name = name; | 2735 this._name = name; |
| 2716 } | 2736 } |
| 2717 | 2737 |
| 2738 @override |
| 2718 String toString() => _name; | 2739 String toString() => _name; |
| 2719 } | 2740 } |
| 2720 | 2741 |
| 2721 /** | 2742 /** |
| 2722 * The interface `HtmlEntry` defines the behavior of objects that maintain the i
nformation | 2743 * The interface `HtmlEntry` defines the behavior of objects that maintain the i
nformation |
| 2723 * cached by an analysis context about an individual HTML file. | 2744 * cached by an analysis context about an individual HTML file. |
| 2724 */ | 2745 */ |
| 2725 abstract class HtmlEntry implements SourceEntry { | 2746 abstract class HtmlEntry implements SourceEntry { |
| 2726 /** | 2747 /** |
| 2727 * The data descriptor representing the information about an Angular applicati
on this source is | 2748 * The data descriptor representing the information about an Angular applicati
on this source is |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2789 List<AnalysisError> get allErrors; | 2810 List<AnalysisError> get allErrors; |
| 2790 | 2811 |
| 2791 /** | 2812 /** |
| 2792 * Return a valid parsed unit, either an unresolved AST structure or the resul
t of resolving the | 2813 * Return a valid parsed unit, either an unresolved AST structure or the resul
t of resolving the |
| 2793 * AST structure, or `null` if there is no parsed unit available. | 2814 * AST structure, or `null` if there is no parsed unit available. |
| 2794 * | 2815 * |
| 2795 * @return a valid parsed unit | 2816 * @return a valid parsed unit |
| 2796 */ | 2817 */ |
| 2797 ht.HtmlUnit get anyParsedUnit; | 2818 ht.HtmlUnit get anyParsedUnit; |
| 2798 | 2819 |
| 2820 @override |
| 2799 HtmlEntryImpl get writableCopy; | 2821 HtmlEntryImpl get writableCopy; |
| 2800 } | 2822 } |
| 2801 | 2823 |
| 2802 /** | 2824 /** |
| 2803 * Instances of the class `HtmlEntryImpl` implement an [HtmlEntry]. | 2825 * Instances of the class `HtmlEntryImpl` implement an [HtmlEntry]. |
| 2804 */ | 2826 */ |
| 2805 class HtmlEntryImpl extends SourceEntryImpl implements HtmlEntry { | 2827 class HtmlEntryImpl extends SourceEntryImpl implements HtmlEntry { |
| 2806 /** | 2828 /** |
| 2807 * The state of the cached parsed (but not resolved) HTML unit. | 2829 * The state of the cached parsed (but not resolved) HTML unit. |
| 2808 */ | 2830 */ |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2925 if (identical(_parsedUnitState, CacheState.VALID)) { | 2947 if (identical(_parsedUnitState, CacheState.VALID)) { |
| 2926 _parsedUnitState = CacheState.FLUSHED; | 2948 _parsedUnitState = CacheState.FLUSHED; |
| 2927 _parsedUnit = null; | 2949 _parsedUnit = null; |
| 2928 } | 2950 } |
| 2929 if (identical(_resolvedUnitState, CacheState.VALID)) { | 2951 if (identical(_resolvedUnitState, CacheState.VALID)) { |
| 2930 _resolvedUnitState = CacheState.FLUSHED; | 2952 _resolvedUnitState = CacheState.FLUSHED; |
| 2931 _resolvedUnit = null; | 2953 _resolvedUnit = null; |
| 2932 } | 2954 } |
| 2933 } | 2955 } |
| 2934 | 2956 |
| 2957 @override |
| 2935 List<AnalysisError> get allErrors { | 2958 List<AnalysisError> get allErrors { |
| 2936 List<AnalysisError> errors = new List<AnalysisError>(); | 2959 List<AnalysisError> errors = new List<AnalysisError>(); |
| 2937 if (_parseErrors != null) { | 2960 if (_parseErrors != null) { |
| 2938 for (AnalysisError error in _parseErrors) { | 2961 for (AnalysisError error in _parseErrors) { |
| 2939 errors.add(error); | 2962 errors.add(error); |
| 2940 } | 2963 } |
| 2941 } | 2964 } |
| 2942 if (_resolutionErrors != null) { | 2965 if (_resolutionErrors != null) { |
| 2943 for (AnalysisError error in _resolutionErrors) { | 2966 for (AnalysisError error in _resolutionErrors) { |
| 2944 errors.add(error); | 2967 errors.add(error); |
| 2945 } | 2968 } |
| 2946 } | 2969 } |
| 2947 if (_angularErrors != null) { | 2970 if (_angularErrors != null) { |
| 2948 for (AnalysisError error in _angularErrors) { | 2971 for (AnalysisError error in _angularErrors) { |
| 2949 errors.add(error); | 2972 errors.add(error); |
| 2950 } | 2973 } |
| 2951 } | 2974 } |
| 2952 if (_hints != null) { | 2975 if (_hints != null) { |
| 2953 for (AnalysisError error in _hints) { | 2976 for (AnalysisError error in _hints) { |
| 2954 errors.add(error); | 2977 errors.add(error); |
| 2955 } | 2978 } |
| 2956 } | 2979 } |
| 2957 if (errors.length == 0) { | 2980 if (errors.length == 0) { |
| 2958 return AnalysisError.NO_ERRORS; | 2981 return AnalysisError.NO_ERRORS; |
| 2959 } | 2982 } |
| 2960 return new List.from(errors); | 2983 return new List.from(errors); |
| 2961 } | 2984 } |
| 2962 | 2985 |
| 2986 @override |
| 2963 ht.HtmlUnit get anyParsedUnit { | 2987 ht.HtmlUnit get anyParsedUnit { |
| 2964 if (identical(_parsedUnitState, CacheState.VALID)) { | 2988 if (identical(_parsedUnitState, CacheState.VALID)) { |
| 2965 // parsedUnitAccessed = true; | 2989 // parsedUnitAccessed = true; |
| 2966 return _parsedUnit; | 2990 return _parsedUnit; |
| 2967 } | 2991 } |
| 2968 if (identical(_resolvedUnitState, CacheState.VALID)) { | 2992 if (identical(_resolvedUnitState, CacheState.VALID)) { |
| 2969 // resovledUnitAccessed = true; | 2993 // resovledUnitAccessed = true; |
| 2970 return _resolvedUnit; | 2994 return _resolvedUnit; |
| 2971 } | 2995 } |
| 2972 return null; | 2996 return null; |
| 2973 } | 2997 } |
| 2974 | 2998 |
| 2999 @override |
| 2975 SourceKind get kind => SourceKind.HTML; | 3000 SourceKind get kind => SourceKind.HTML; |
| 2976 | 3001 |
| 3002 @override |
| 2977 CacheState getState(DataDescriptor descriptor) { | 3003 CacheState getState(DataDescriptor descriptor) { |
| 2978 if (identical(descriptor, HtmlEntry.ANGULAR_APPLICATION)) { | 3004 if (identical(descriptor, HtmlEntry.ANGULAR_APPLICATION)) { |
| 2979 return _angularApplicationState; | 3005 return _angularApplicationState; |
| 2980 } else if (identical(descriptor, HtmlEntry.ANGULAR_COMPONENT)) { | 3006 } else if (identical(descriptor, HtmlEntry.ANGULAR_COMPONENT)) { |
| 2981 return _angularComponentState; | 3007 return _angularComponentState; |
| 2982 } else if (identical(descriptor, HtmlEntry.ANGULAR_ENTRY)) { | 3008 } else if (identical(descriptor, HtmlEntry.ANGULAR_ENTRY)) { |
| 2983 return _angularEntryState; | 3009 return _angularEntryState; |
| 2984 } else if (identical(descriptor, HtmlEntry.ANGULAR_ERRORS)) { | 3010 } else if (identical(descriptor, HtmlEntry.ANGULAR_ERRORS)) { |
| 2985 return _angularErrorsState; | 3011 return _angularErrorsState; |
| 2986 } else if (identical(descriptor, HtmlEntry.ELEMENT)) { | 3012 } else if (identical(descriptor, HtmlEntry.ELEMENT)) { |
| 2987 return _elementState; | 3013 return _elementState; |
| 2988 } else if (identical(descriptor, HtmlEntry.PARSE_ERRORS)) { | 3014 } else if (identical(descriptor, HtmlEntry.PARSE_ERRORS)) { |
| 2989 return _parseErrorsState; | 3015 return _parseErrorsState; |
| 2990 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { | 3016 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { |
| 2991 return _parsedUnitState; | 3017 return _parsedUnitState; |
| 2992 } else if (identical(descriptor, HtmlEntry.RESOLVED_UNIT)) { | 3018 } else if (identical(descriptor, HtmlEntry.RESOLVED_UNIT)) { |
| 2993 return _resolvedUnitState; | 3019 return _resolvedUnitState; |
| 2994 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { | 3020 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { |
| 2995 return _referencedLibrariesState; | 3021 return _referencedLibrariesState; |
| 2996 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { | 3022 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { |
| 2997 return _resolutionErrorsState; | 3023 return _resolutionErrorsState; |
| 2998 } else if (identical(descriptor, HtmlEntry.HINTS)) { | 3024 } else if (identical(descriptor, HtmlEntry.HINTS)) { |
| 2999 return _hintsState; | 3025 return _hintsState; |
| 3000 } | 3026 } |
| 3001 return super.getState(descriptor); | 3027 return super.getState(descriptor); |
| 3002 } | 3028 } |
| 3003 | 3029 |
| 3030 @override |
| 3004 Object getValue(DataDescriptor descriptor) { | 3031 Object getValue(DataDescriptor descriptor) { |
| 3005 if (identical(descriptor, HtmlEntry.ANGULAR_APPLICATION)) { | 3032 if (identical(descriptor, HtmlEntry.ANGULAR_APPLICATION)) { |
| 3006 return _angularApplication; | 3033 return _angularApplication; |
| 3007 } else if (identical(descriptor, HtmlEntry.ANGULAR_COMPONENT)) { | 3034 } else if (identical(descriptor, HtmlEntry.ANGULAR_COMPONENT)) { |
| 3008 return _angularComponent; | 3035 return _angularComponent; |
| 3009 } else if (identical(descriptor, HtmlEntry.ANGULAR_ENTRY)) { | 3036 } else if (identical(descriptor, HtmlEntry.ANGULAR_ENTRY)) { |
| 3010 return _angularEntry; | 3037 return _angularEntry; |
| 3011 } else if (identical(descriptor, HtmlEntry.ANGULAR_ERRORS)) { | 3038 } else if (identical(descriptor, HtmlEntry.ANGULAR_ERRORS)) { |
| 3012 return _angularErrors; | 3039 return _angularErrors; |
| 3013 } else if (identical(descriptor, HtmlEntry.ELEMENT)) { | 3040 } else if (identical(descriptor, HtmlEntry.ELEMENT)) { |
| 3014 return _element; | 3041 return _element; |
| 3015 } else if (identical(descriptor, HtmlEntry.PARSE_ERRORS)) { | 3042 } else if (identical(descriptor, HtmlEntry.PARSE_ERRORS)) { |
| 3016 return _parseErrors; | 3043 return _parseErrors; |
| 3017 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { | 3044 } else if (identical(descriptor, HtmlEntry.PARSED_UNIT)) { |
| 3018 return _parsedUnit; | 3045 return _parsedUnit; |
| 3019 } else if (identical(descriptor, HtmlEntry.RESOLVED_UNIT)) { | 3046 } else if (identical(descriptor, HtmlEntry.RESOLVED_UNIT)) { |
| 3020 return _resolvedUnit; | 3047 return _resolvedUnit; |
| 3021 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { | 3048 } else if (identical(descriptor, HtmlEntry.REFERENCED_LIBRARIES)) { |
| 3022 return _referencedLibraries; | 3049 return _referencedLibraries; |
| 3023 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { | 3050 } else if (identical(descriptor, HtmlEntry.RESOLUTION_ERRORS)) { |
| 3024 return _resolutionErrors; | 3051 return _resolutionErrors; |
| 3025 } else if (identical(descriptor, HtmlEntry.HINTS)) { | 3052 } else if (identical(descriptor, HtmlEntry.HINTS)) { |
| 3026 return _hints; | 3053 return _hints; |
| 3027 } | 3054 } |
| 3028 return super.getValue(descriptor); | 3055 return super.getValue(descriptor); |
| 3029 } | 3056 } |
| 3030 | 3057 |
| 3058 @override |
| 3031 HtmlEntryImpl get writableCopy { | 3059 HtmlEntryImpl get writableCopy { |
| 3032 HtmlEntryImpl copy = new HtmlEntryImpl(); | 3060 HtmlEntryImpl copy = new HtmlEntryImpl(); |
| 3033 copy.copyFrom(this); | 3061 copy.copyFrom(this); |
| 3034 return copy; | 3062 return copy; |
| 3035 } | 3063 } |
| 3036 | 3064 |
| 3065 @override |
| 3037 void invalidateAllInformation() { | 3066 void invalidateAllInformation() { |
| 3038 super.invalidateAllInformation(); | 3067 super.invalidateAllInformation(); |
| 3039 _parseErrors = AnalysisError.NO_ERRORS; | 3068 _parseErrors = AnalysisError.NO_ERRORS; |
| 3040 _parseErrorsState = CacheState.INVALID; | 3069 _parseErrorsState = CacheState.INVALID; |
| 3041 _parsedUnit = null; | 3070 _parsedUnit = null; |
| 3042 _parsedUnitState = CacheState.INVALID; | 3071 _parsedUnitState = CacheState.INVALID; |
| 3043 _resolvedUnit = null; | 3072 _resolvedUnit = null; |
| 3044 _resolvedUnitState = CacheState.INVALID; | 3073 _resolvedUnitState = CacheState.INVALID; |
| 3045 _referencedLibraries = Source.EMPTY_ARRAY; | 3074 _referencedLibraries = Source.EMPTY_ARRAY; |
| 3046 _referencedLibrariesState = CacheState.INVALID; | 3075 _referencedLibrariesState = CacheState.INVALID; |
| 3047 invalidateAllResolutionInformation(); | 3076 invalidateAllResolutionInformation(); |
| 3048 } | 3077 } |
| 3049 | 3078 |
| 3050 /** | 3079 /** |
| 3051 * Invalidate all of the resolution information associated with the HTML file. | 3080 * Invalidate all of the resolution information associated with the HTML file. |
| 3052 */ | 3081 */ |
| 3053 void invalidateAllResolutionInformation() { | 3082 void invalidateAllResolutionInformation() { |
| 3054 _angularEntry = null; | 3083 _angularEntry = null; |
| 3055 _angularEntryState = CacheState.INVALID; | 3084 _angularEntryState = CacheState.INVALID; |
| 3056 _angularErrors = AnalysisError.NO_ERRORS; | 3085 _angularErrors = AnalysisError.NO_ERRORS; |
| 3057 _angularErrorsState = CacheState.INVALID; | 3086 _angularErrorsState = CacheState.INVALID; |
| 3058 _element = null; | 3087 _element = null; |
| 3059 _elementState = CacheState.INVALID; | 3088 _elementState = CacheState.INVALID; |
| 3060 _resolutionErrors = AnalysisError.NO_ERRORS; | 3089 _resolutionErrors = AnalysisError.NO_ERRORS; |
| 3061 _resolutionErrorsState = CacheState.INVALID; | 3090 _resolutionErrorsState = CacheState.INVALID; |
| 3062 _hints = AnalysisError.NO_ERRORS; | 3091 _hints = AnalysisError.NO_ERRORS; |
| 3063 _hintsState = CacheState.INVALID; | 3092 _hintsState = CacheState.INVALID; |
| 3064 } | 3093 } |
| 3065 | 3094 |
| 3095 @override |
| 3066 void recordContentError() { | 3096 void recordContentError() { |
| 3067 super.recordContentError(); | 3097 super.recordContentError(); |
| 3068 recordParseError(); | 3098 recordParseError(); |
| 3069 } | 3099 } |
| 3070 | 3100 |
| 3071 /** | 3101 /** |
| 3072 * Record that an error was encountered while attempting to parse the source a
ssociated with this | 3102 * Record that an error was encountered while attempting to parse the source a
ssociated with this |
| 3073 * entry. | 3103 * entry. |
| 3074 */ | 3104 */ |
| 3075 void recordParseError() { | 3105 void recordParseError() { |
| 3076 setState(SourceEntry.LINE_INFO, CacheState.ERROR); | 3106 setState(SourceEntry.LINE_INFO, CacheState.ERROR); |
| 3077 setState(HtmlEntry.PARSE_ERRORS, CacheState.ERROR); | 3107 setState(HtmlEntry.PARSE_ERRORS, CacheState.ERROR); |
| 3078 setState(HtmlEntry.PARSED_UNIT, CacheState.ERROR); | 3108 setState(HtmlEntry.PARSED_UNIT, CacheState.ERROR); |
| 3079 setState(HtmlEntry.REFERENCED_LIBRARIES, CacheState.ERROR); | 3109 setState(HtmlEntry.REFERENCED_LIBRARIES, CacheState.ERROR); |
| 3080 recordResolutionError(); | 3110 recordResolutionError(); |
| 3081 } | 3111 } |
| 3082 | 3112 |
| 3083 /** | 3113 /** |
| 3084 * Record that an error was encountered while attempting to resolve the source
associated with | 3114 * Record that an error was encountered while attempting to resolve the source
associated with |
| 3085 * this entry. | 3115 * this entry. |
| 3086 */ | 3116 */ |
| 3087 void recordResolutionError() { | 3117 void recordResolutionError() { |
| 3088 setState(HtmlEntry.ANGULAR_ERRORS, CacheState.ERROR); | 3118 setState(HtmlEntry.ANGULAR_ERRORS, CacheState.ERROR); |
| 3089 setState(HtmlEntry.RESOLVED_UNIT, CacheState.ERROR); | 3119 setState(HtmlEntry.RESOLVED_UNIT, CacheState.ERROR); |
| 3090 setState(HtmlEntry.ELEMENT, CacheState.ERROR); | 3120 setState(HtmlEntry.ELEMENT, CacheState.ERROR); |
| 3091 setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.ERROR); | 3121 setState(HtmlEntry.RESOLUTION_ERRORS, CacheState.ERROR); |
| 3092 setState(HtmlEntry.HINTS, CacheState.ERROR); | 3122 setState(HtmlEntry.HINTS, CacheState.ERROR); |
| 3093 } | 3123 } |
| 3094 | 3124 |
| 3125 @override |
| 3095 void setState(DataDescriptor descriptor, CacheState state) { | 3126 void setState(DataDescriptor descriptor, CacheState state) { |
| 3096 if (identical(descriptor, HtmlEntry.ANGULAR_APPLICATION)) { | 3127 if (identical(descriptor, HtmlEntry.ANGULAR_APPLICATION)) { |
| 3097 _angularApplication = updatedValue(state, _angularApplication, null); | 3128 _angularApplication = updatedValue(state, _angularApplication, null); |
| 3098 _angularApplicationState = state; | 3129 _angularApplicationState = state; |
| 3099 } else if (identical(descriptor, HtmlEntry.ANGULAR_COMPONENT)) { | 3130 } else if (identical(descriptor, HtmlEntry.ANGULAR_COMPONENT)) { |
| 3100 _angularComponent = updatedValue(state, _angularComponent, null); | 3131 _angularComponent = updatedValue(state, _angularComponent, null); |
| 3101 _angularComponentState = state; | 3132 _angularComponentState = state; |
| 3102 } else if (identical(descriptor, HtmlEntry.ANGULAR_ENTRY)) { | 3133 } else if (identical(descriptor, HtmlEntry.ANGULAR_ENTRY)) { |
| 3103 _angularEntry = updatedValue(state, _angularEntry, null); | 3134 _angularEntry = updatedValue(state, _angularEntry, null); |
| 3104 _angularEntryState = state; | 3135 _angularEntryState = state; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3124 _resolutionErrors = updatedValue(state, _resolutionErrors, AnalysisError.N
O_ERRORS); | 3155 _resolutionErrors = updatedValue(state, _resolutionErrors, AnalysisError.N
O_ERRORS); |
| 3125 _resolutionErrorsState = state; | 3156 _resolutionErrorsState = state; |
| 3126 } else if (identical(descriptor, HtmlEntry.HINTS)) { | 3157 } else if (identical(descriptor, HtmlEntry.HINTS)) { |
| 3127 _hints = updatedValue(state, _hints, AnalysisError.NO_ERRORS); | 3158 _hints = updatedValue(state, _hints, AnalysisError.NO_ERRORS); |
| 3128 _hintsState = state; | 3159 _hintsState = state; |
| 3129 } else { | 3160 } else { |
| 3130 super.setState(descriptor, state); | 3161 super.setState(descriptor, state); |
| 3131 } | 3162 } |
| 3132 } | 3163 } |
| 3133 | 3164 |
| 3165 @override |
| 3134 void setValue(DataDescriptor descriptor, Object value) { | 3166 void setValue(DataDescriptor descriptor, Object value) { |
| 3135 if (identical(descriptor, HtmlEntry.ANGULAR_APPLICATION)) { | 3167 if (identical(descriptor, HtmlEntry.ANGULAR_APPLICATION)) { |
| 3136 _angularApplication = value as AngularApplication; | 3168 _angularApplication = value as AngularApplication; |
| 3137 _angularApplicationState = CacheState.VALID; | 3169 _angularApplicationState = CacheState.VALID; |
| 3138 } else if (identical(descriptor, HtmlEntry.ANGULAR_COMPONENT)) { | 3170 } else if (identical(descriptor, HtmlEntry.ANGULAR_COMPONENT)) { |
| 3139 _angularComponent = value as AngularComponentElement; | 3171 _angularComponent = value as AngularComponentElement; |
| 3140 _angularComponentState = CacheState.VALID; | 3172 _angularComponentState = CacheState.VALID; |
| 3141 } else if (identical(descriptor, HtmlEntry.ANGULAR_ENTRY)) { | 3173 } else if (identical(descriptor, HtmlEntry.ANGULAR_ENTRY)) { |
| 3142 _angularEntry = value as AngularApplication; | 3174 _angularEntry = value as AngularApplication; |
| 3143 _angularEntryState = CacheState.VALID; | 3175 _angularEntryState = CacheState.VALID; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 3163 _resolutionErrors = value as List<AnalysisError>; | 3195 _resolutionErrors = value as List<AnalysisError>; |
| 3164 _resolutionErrorsState = CacheState.VALID; | 3196 _resolutionErrorsState = CacheState.VALID; |
| 3165 } else if (identical(descriptor, HtmlEntry.HINTS)) { | 3197 } else if (identical(descriptor, HtmlEntry.HINTS)) { |
| 3166 _hints = value as List<AnalysisError>; | 3198 _hints = value as List<AnalysisError>; |
| 3167 _hintsState = CacheState.VALID; | 3199 _hintsState = CacheState.VALID; |
| 3168 } else { | 3200 } else { |
| 3169 super.setValue(descriptor, value); | 3201 super.setValue(descriptor, value); |
| 3170 } | 3202 } |
| 3171 } | 3203 } |
| 3172 | 3204 |
| 3205 @override |
| 3173 void copyFrom(SourceEntryImpl entry) { | 3206 void copyFrom(SourceEntryImpl entry) { |
| 3174 super.copyFrom(entry); | 3207 super.copyFrom(entry); |
| 3175 HtmlEntryImpl other = entry as HtmlEntryImpl; | 3208 HtmlEntryImpl other = entry as HtmlEntryImpl; |
| 3176 _angularApplicationState = other._angularApplicationState; | 3209 _angularApplicationState = other._angularApplicationState; |
| 3177 _angularApplication = other._angularApplication; | 3210 _angularApplication = other._angularApplication; |
| 3178 _angularComponentState = other._angularComponentState; | 3211 _angularComponentState = other._angularComponentState; |
| 3179 _angularComponent = other._angularComponent; | 3212 _angularComponent = other._angularComponent; |
| 3180 _angularEntryState = other._angularEntryState; | 3213 _angularEntryState = other._angularEntryState; |
| 3181 _angularEntry = other._angularEntry; | 3214 _angularEntry = other._angularEntry; |
| 3182 _angularErrorsState = other._angularErrorsState; | 3215 _angularErrorsState = other._angularErrorsState; |
| 3183 _angularErrors = other._angularErrors; | 3216 _angularErrors = other._angularErrors; |
| 3184 _parseErrorsState = other._parseErrorsState; | 3217 _parseErrorsState = other._parseErrorsState; |
| 3185 _parseErrors = other._parseErrors; | 3218 _parseErrors = other._parseErrors; |
| 3186 _parsedUnitState = other._parsedUnitState; | 3219 _parsedUnitState = other._parsedUnitState; |
| 3187 _parsedUnit = other._parsedUnit; | 3220 _parsedUnit = other._parsedUnit; |
| 3188 _resolvedUnitState = other._resolvedUnitState; | 3221 _resolvedUnitState = other._resolvedUnitState; |
| 3189 _resolvedUnit = other._resolvedUnit; | 3222 _resolvedUnit = other._resolvedUnit; |
| 3190 _referencedLibrariesState = other._referencedLibrariesState; | 3223 _referencedLibrariesState = other._referencedLibrariesState; |
| 3191 _referencedLibraries = other._referencedLibraries; | 3224 _referencedLibraries = other._referencedLibraries; |
| 3192 _resolutionErrors = other._resolutionErrors; | 3225 _resolutionErrors = other._resolutionErrors; |
| 3193 _resolutionErrorsState = other._resolutionErrorsState; | 3226 _resolutionErrorsState = other._resolutionErrorsState; |
| 3194 _elementState = other._elementState; | 3227 _elementState = other._elementState; |
| 3195 _element = other._element; | 3228 _element = other._element; |
| 3196 _hints = other._hints; | 3229 _hints = other._hints; |
| 3197 _hintsState = other._hintsState; | 3230 _hintsState = other._hintsState; |
| 3198 } | 3231 } |
| 3199 | 3232 |
| 3233 @override |
| 3200 bool get hasErrorState => super.hasErrorState || identical(_parsedUnitState, C
acheState.ERROR) || identical(_resolvedUnitState, CacheState.ERROR) || identical
(_parseErrorsState, CacheState.ERROR) || identical(_resolutionErrorsState, Cache
State.ERROR) || identical(_referencedLibrariesState, CacheState.ERROR) || identi
cal(_elementState, CacheState.ERROR) || identical(_angularErrorsState, CacheStat
e.ERROR) || identical(_hintsState, CacheState.ERROR); | 3234 bool get hasErrorState => super.hasErrorState || identical(_parsedUnitState, C
acheState.ERROR) || identical(_resolvedUnitState, CacheState.ERROR) || identical
(_parseErrorsState, CacheState.ERROR) || identical(_resolutionErrorsState, Cache
State.ERROR) || identical(_referencedLibrariesState, CacheState.ERROR) || identi
cal(_elementState, CacheState.ERROR) || identical(_angularErrorsState, CacheStat
e.ERROR) || identical(_hintsState, CacheState.ERROR); |
| 3201 | 3235 |
| 3236 @override |
| 3202 void writeOn(JavaStringBuilder builder) { | 3237 void writeOn(JavaStringBuilder builder) { |
| 3203 builder.append("Html: "); | 3238 builder.append("Html: "); |
| 3204 super.writeOn(builder); | 3239 super.writeOn(builder); |
| 3205 builder.append("; parseErrors = "); | 3240 builder.append("; parseErrors = "); |
| 3206 builder.append(_parseErrorsState); | 3241 builder.append(_parseErrorsState); |
| 3207 builder.append("; parsedUnit = "); | 3242 builder.append("; parsedUnit = "); |
| 3208 builder.append(_parsedUnitState); | 3243 builder.append(_parsedUnitState); |
| 3209 builder.append("; resolvedUnit = "); | 3244 builder.append("; resolvedUnit = "); |
| 3210 builder.append(_resolvedUnitState); | 3245 builder.append(_resolvedUnitState); |
| 3211 builder.append("; resolutionErrors = "); | 3246 builder.append("; resolutionErrors = "); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3368 // This code should never be reached, but is a fail-safe in case an exce
ption is not | 3403 // This code should never be reached, but is a fail-safe in case an exce
ption is not |
| 3369 // recorded when it should be. | 3404 // recorded when it should be. |
| 3370 // | 3405 // |
| 3371 exception = new AnalysisException.con1("State set to ERROR without setti
ng an exception"); | 3406 exception = new AnalysisException.con1("State set to ERROR without setti
ng an exception"); |
| 3372 } | 3407 } |
| 3373 } else { | 3408 } else { |
| 3374 exception = null; | 3409 exception = null; |
| 3375 } | 3410 } |
| 3376 } | 3411 } |
| 3377 | 3412 |
| 3413 @override |
| 3378 int get modificationTime => _modificationTime; | 3414 int get modificationTime => _modificationTime; |
| 3379 | 3415 |
| 3416 @override |
| 3380 CacheState getState(DataDescriptor descriptor) { | 3417 CacheState getState(DataDescriptor descriptor) { |
| 3381 if (identical(descriptor, SourceEntry.CONTENT)) { | 3418 if (identical(descriptor, SourceEntry.CONTENT)) { |
| 3382 return _contentState; | 3419 return _contentState; |
| 3383 } else if (identical(descriptor, SourceEntry.LINE_INFO)) { | 3420 } else if (identical(descriptor, SourceEntry.LINE_INFO)) { |
| 3384 return _lineInfoState; | 3421 return _lineInfoState; |
| 3385 } else { | 3422 } else { |
| 3386 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 3423 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 3387 } | 3424 } |
| 3388 } | 3425 } |
| 3389 | 3426 |
| 3427 @override |
| 3390 Object getValue(DataDescriptor descriptor) { | 3428 Object getValue(DataDescriptor descriptor) { |
| 3391 if (identical(descriptor, SourceEntry.CONTENT)) { | 3429 if (identical(descriptor, SourceEntry.CONTENT)) { |
| 3392 return _content; | 3430 return _content; |
| 3393 } else if (identical(descriptor, SourceEntry.LINE_INFO)) { | 3431 } else if (identical(descriptor, SourceEntry.LINE_INFO)) { |
| 3394 return _lineInfo; | 3432 return _lineInfo; |
| 3395 } else { | 3433 } else { |
| 3396 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 3434 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 3397 } | 3435 } |
| 3398 } | 3436 } |
| 3399 | 3437 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3456 _content = value as String; | 3494 _content = value as String; |
| 3457 _contentState = CacheState.VALID; | 3495 _contentState = CacheState.VALID; |
| 3458 } else if (identical(descriptor, SourceEntry.LINE_INFO)) { | 3496 } else if (identical(descriptor, SourceEntry.LINE_INFO)) { |
| 3459 _lineInfo = value as LineInfo; | 3497 _lineInfo = value as LineInfo; |
| 3460 _lineInfoState = CacheState.VALID; | 3498 _lineInfoState = CacheState.VALID; |
| 3461 } else { | 3499 } else { |
| 3462 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 3500 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 3463 } | 3501 } |
| 3464 } | 3502 } |
| 3465 | 3503 |
| 3504 @override |
| 3466 String toString() { | 3505 String toString() { |
| 3467 JavaStringBuilder builder = new JavaStringBuilder(); | 3506 JavaStringBuilder builder = new JavaStringBuilder(); |
| 3468 writeOn(builder); | 3507 writeOn(builder); |
| 3469 return builder.toString(); | 3508 return builder.toString(); |
| 3470 } | 3509 } |
| 3471 | 3510 |
| 3472 /** | 3511 /** |
| 3473 * Copy the information from the given cache entry. | 3512 * Copy the information from the given cache entry. |
| 3474 * | 3513 * |
| 3475 * @param entry the cache entry from which information will be copied | 3514 * @param entry the cache entry from which information will be copied |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3534 Map<String, AnalysisContentStatistics_CacheRow> _dataMap = new Map<String, Ana
lysisContentStatistics_CacheRow>(); | 3573 Map<String, AnalysisContentStatistics_CacheRow> _dataMap = new Map<String, Ana
lysisContentStatistics_CacheRow>(); |
| 3535 | 3574 |
| 3536 List<Source> _sources = new List<Source>(); | 3575 List<Source> _sources = new List<Source>(); |
| 3537 | 3576 |
| 3538 Set<AnalysisException> _exceptions = new Set<AnalysisException>(); | 3577 Set<AnalysisException> _exceptions = new Set<AnalysisException>(); |
| 3539 | 3578 |
| 3540 void addSource(Source source) { | 3579 void addSource(Source source) { |
| 3541 _sources.add(source); | 3580 _sources.add(source); |
| 3542 } | 3581 } |
| 3543 | 3582 |
| 3583 @override |
| 3544 List<AnalysisContentStatistics_CacheRow> get cacheRows { | 3584 List<AnalysisContentStatistics_CacheRow> get cacheRows { |
| 3545 Iterable<AnalysisContentStatistics_CacheRow> items = _dataMap.values; | 3585 Iterable<AnalysisContentStatistics_CacheRow> items = _dataMap.values; |
| 3546 return new List.from(items); | 3586 return new List.from(items); |
| 3547 } | 3587 } |
| 3548 | 3588 |
| 3589 @override |
| 3549 List<AnalysisException> get exceptions => new List.from(_exceptions); | 3590 List<AnalysisException> get exceptions => new List.from(_exceptions); |
| 3550 | 3591 |
| 3592 @override |
| 3551 List<Source> get sources => new List.from(_sources); | 3593 List<Source> get sources => new List.from(_sources); |
| 3552 | 3594 |
| 3553 void putCacheItem(SourceEntry dartEntry, DataDescriptor descriptor) { | 3595 void putCacheItem(SourceEntry dartEntry, DataDescriptor descriptor) { |
| 3554 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getState(descriptor))
; | 3596 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getState(descriptor))
; |
| 3555 } | 3597 } |
| 3556 | 3598 |
| 3557 void putCacheItemInLibrary(DartEntry dartEntry, Source librarySource, DataDesc
riptor descriptor) { | 3599 void putCacheItemInLibrary(DartEntry dartEntry, Source librarySource, DataDesc
riptor descriptor) { |
| 3558 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getStateInLibrary(des
criptor, librarySource)); | 3600 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getStateInLibrary(des
criptor, librarySource)); |
| 3559 } | 3601 } |
| 3560 | 3602 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 3583 int _flushedCount = 0; | 3625 int _flushedCount = 0; |
| 3584 | 3626 |
| 3585 int _inProcessCount = 0; | 3627 int _inProcessCount = 0; |
| 3586 | 3628 |
| 3587 int _invalidCount = 0; | 3629 int _invalidCount = 0; |
| 3588 | 3630 |
| 3589 int _validCount = 0; | 3631 int _validCount = 0; |
| 3590 | 3632 |
| 3591 AnalysisContentStatisticsImpl_CacheRowImpl(this.name); | 3633 AnalysisContentStatisticsImpl_CacheRowImpl(this.name); |
| 3592 | 3634 |
| 3635 @override |
| 3593 bool operator ==(Object obj) => obj is AnalysisContentStatisticsImpl_CacheRowI
mpl && obj.name == name; | 3636 bool operator ==(Object obj) => obj is AnalysisContentStatisticsImpl_CacheRowI
mpl && obj.name == name; |
| 3594 | 3637 |
| 3638 @override |
| 3595 int get errorCount => _errorCount; | 3639 int get errorCount => _errorCount; |
| 3596 | 3640 |
| 3641 @override |
| 3597 int get flushedCount => _flushedCount; | 3642 int get flushedCount => _flushedCount; |
| 3598 | 3643 |
| 3644 @override |
| 3599 int get inProcessCount => _inProcessCount; | 3645 int get inProcessCount => _inProcessCount; |
| 3600 | 3646 |
| 3647 @override |
| 3601 int get invalidCount => _invalidCount; | 3648 int get invalidCount => _invalidCount; |
| 3602 | 3649 |
| 3650 @override |
| 3603 int get validCount => _validCount; | 3651 int get validCount => _validCount; |
| 3604 | 3652 |
| 3653 @override |
| 3605 int get hashCode => name.hashCode; | 3654 int get hashCode => name.hashCode; |
| 3606 | 3655 |
| 3607 void _incState(CacheState state) { | 3656 void _incState(CacheState state) { |
| 3608 if (identical(state, CacheState.ERROR)) { | 3657 if (identical(state, CacheState.ERROR)) { |
| 3609 _errorCount++; | 3658 _errorCount++; |
| 3610 } | 3659 } |
| 3611 if (identical(state, CacheState.FLUSHED)) { | 3660 if (identical(state, CacheState.FLUSHED)) { |
| 3612 _flushedCount++; | 3661 _flushedCount++; |
| 3613 } | 3662 } |
| 3614 if (identical(state, CacheState.IN_PROCESS)) { | 3663 if (identical(state, CacheState.IN_PROCESS)) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3709 Set<AngularApplication> _angularApplications = new Set(); | 3758 Set<AngularApplication> _angularApplications = new Set(); |
| 3710 | 3759 |
| 3711 /** | 3760 /** |
| 3712 * Initialize a newly created analysis context. | 3761 * Initialize a newly created analysis context. |
| 3713 */ | 3762 */ |
| 3714 AnalysisContextImpl() : super() { | 3763 AnalysisContextImpl() : super() { |
| 3715 _resultRecorder = new AnalysisContextImpl_AnalysisTaskResultRecorder(this); | 3764 _resultRecorder = new AnalysisContextImpl_AnalysisTaskResultRecorder(this); |
| 3716 _cache = new AnalysisCache(AnalysisOptionsImpl.DEFAULT_CACHE_SIZE, new Analy
sisContextImpl_ContextRetentionPolicy(this)); | 3765 _cache = new AnalysisCache(AnalysisOptionsImpl.DEFAULT_CACHE_SIZE, new Analy
sisContextImpl_ContextRetentionPolicy(this)); |
| 3717 } | 3766 } |
| 3718 | 3767 |
| 3768 @override |
| 3719 void addSourceInfo(Source source, SourceEntry info) { | 3769 void addSourceInfo(Source source, SourceEntry info) { |
| 3720 // This implementation assumes that the access to the cache does not need to
be synchronized | 3770 // This implementation assumes that the access to the cache does not need to
be synchronized |
| 3721 // because no other object can have access to this context while this method
is being invoked. | 3771 // because no other object can have access to this context while this method
is being invoked. |
| 3722 _cache.put(source, info); | 3772 _cache.put(source, info); |
| 3723 } | 3773 } |
| 3724 | 3774 |
| 3775 @override |
| 3725 void applyChanges(ChangeSet changeSet) { | 3776 void applyChanges(ChangeSet changeSet) { |
| 3726 if (changeSet.isEmpty) { | 3777 if (changeSet.isEmpty) { |
| 3727 return; | 3778 return; |
| 3728 } | 3779 } |
| 3729 _recentTasks.clear(); | 3780 _recentTasks.clear(); |
| 3730 // | 3781 // |
| 3731 // First, compute the list of sources that have been removed. | 3782 // First, compute the list of sources that have been removed. |
| 3732 // | 3783 // |
| 3733 List<Source> removedSources = new List<Source>.from(changeSet.removedSources
); | 3784 List<Source> removedSources = new List<Source>.from(changeSet.removedSources
); |
| 3734 for (SourceContainer container in changeSet.removedContainers) { | 3785 for (SourceContainer container in changeSet.removedContainers) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3770 priority = SourcePriority.LIBRARY; | 3821 priority = SourcePriority.LIBRARY; |
| 3771 } else if (identical(kind, SourceKind.PART)) { | 3822 } else if (identical(kind, SourceKind.PART)) { |
| 3772 priority = SourcePriority.NORMAL_PART; | 3823 priority = SourcePriority.NORMAL_PART; |
| 3773 } | 3824 } |
| 3774 _workManager.add(source, priority); | 3825 _workManager.add(source, priority); |
| 3775 } | 3826 } |
| 3776 } | 3827 } |
| 3777 } | 3828 } |
| 3778 } | 3829 } |
| 3779 | 3830 |
| 3831 @override |
| 3780 String computeDocumentationComment(Element element) { | 3832 String computeDocumentationComment(Element element) { |
| 3781 if (element == null) { | 3833 if (element == null) { |
| 3782 return null; | 3834 return null; |
| 3783 } | 3835 } |
| 3784 Source source = element.source; | 3836 Source source = element.source; |
| 3785 if (source == null) { | 3837 if (source == null) { |
| 3786 return null; | 3838 return null; |
| 3787 } | 3839 } |
| 3788 CompilationUnit unit = parseCompilationUnit(source); | 3840 CompilationUnit unit = parseCompilationUnit(source); |
| 3789 if (unit == null) { | 3841 if (unit == null) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3805 } | 3857 } |
| 3806 builder.append(tokens[i].lexeme); | 3858 builder.append(tokens[i].lexeme); |
| 3807 } | 3859 } |
| 3808 return builder.toString(); | 3860 return builder.toString(); |
| 3809 } | 3861 } |
| 3810 nameNode = nameNode.parent; | 3862 nameNode = nameNode.parent; |
| 3811 } | 3863 } |
| 3812 return null; | 3864 return null; |
| 3813 } | 3865 } |
| 3814 | 3866 |
| 3867 @override |
| 3815 List<AnalysisError> computeErrors(Source source) { | 3868 List<AnalysisError> computeErrors(Source source) { |
| 3816 bool enableHints = _options.hint; | 3869 bool enableHints = _options.hint; |
| 3817 SourceEntry sourceEntry = _getReadableSourceEntry(source); | 3870 SourceEntry sourceEntry = _getReadableSourceEntry(source); |
| 3818 if (sourceEntry is DartEntry) { | 3871 if (sourceEntry is DartEntry) { |
| 3819 List<AnalysisError> errors = new List<AnalysisError>(); | 3872 List<AnalysisError> errors = new List<AnalysisError>(); |
| 3820 try { | 3873 try { |
| 3821 DartEntry dartEntry = sourceEntry; | 3874 DartEntry dartEntry = sourceEntry; |
| 3822 ListUtilities.addAll(errors, _getDartScanData(source, dartEntry, DartEnt
ry.SCAN_ERRORS)); | 3875 ListUtilities.addAll(errors, _getDartScanData(source, dartEntry, DartEnt
ry.SCAN_ERRORS)); |
| 3823 dartEntry = _getReadableDartEntry(source); | 3876 dartEntry = _getReadableDartEntry(source); |
| 3824 ListUtilities.addAll(errors, _getDartParseData(source, dartEntry, DartEn
try.PARSE_ERRORS)); | 3877 ListUtilities.addAll(errors, _getDartParseData(source, dartEntry, DartEn
try.PARSE_ERRORS)); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 3854 HtmlEntry htmlEntry = sourceEntry; | 3907 HtmlEntry htmlEntry = sourceEntry; |
| 3855 try { | 3908 try { |
| 3856 return _getHtmlResolutionData2(source, htmlEntry, HtmlEntry.RESOLUTION_E
RRORS); | 3909 return _getHtmlResolutionData2(source, htmlEntry, HtmlEntry.RESOLUTION_E
RRORS); |
| 3857 } on ObsoleteSourceAnalysisException catch (exception) { | 3910 } on ObsoleteSourceAnalysisException catch (exception) { |
| 3858 AnalysisEngine.instance.logger.logInformation2("Could not compute errors
", exception); | 3911 AnalysisEngine.instance.logger.logInformation2("Could not compute errors
", exception); |
| 3859 } | 3912 } |
| 3860 } | 3913 } |
| 3861 return AnalysisError.NO_ERRORS; | 3914 return AnalysisError.NO_ERRORS; |
| 3862 } | 3915 } |
| 3863 | 3916 |
| 3917 @override |
| 3864 List<Source> computeExportedLibraries(Source source) => _getDartDependencyData
2(source, DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY); | 3918 List<Source> computeExportedLibraries(Source source) => _getDartDependencyData
2(source, DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY); |
| 3865 | 3919 |
| 3920 @override |
| 3866 HtmlElement computeHtmlElement(Source source) => _getHtmlResolutionData(source
, HtmlEntry.ELEMENT, null); | 3921 HtmlElement computeHtmlElement(Source source) => _getHtmlResolutionData(source
, HtmlEntry.ELEMENT, null); |
| 3867 | 3922 |
| 3923 @override |
| 3868 List<Source> computeImportedLibraries(Source source) => _getDartDependencyData
2(source, DartEntry.IMPORTED_LIBRARIES, Source.EMPTY_ARRAY); | 3924 List<Source> computeImportedLibraries(Source source) => _getDartDependencyData
2(source, DartEntry.IMPORTED_LIBRARIES, Source.EMPTY_ARRAY); |
| 3869 | 3925 |
| 3926 @override |
| 3870 SourceKind computeKindOf(Source source) { | 3927 SourceKind computeKindOf(Source source) { |
| 3871 SourceEntry sourceEntry = _getReadableSourceEntry(source); | 3928 SourceEntry sourceEntry = _getReadableSourceEntry(source); |
| 3872 if (sourceEntry == null) { | 3929 if (sourceEntry == null) { |
| 3873 return SourceKind.UNKNOWN; | 3930 return SourceKind.UNKNOWN; |
| 3874 } else if (sourceEntry is DartEntry) { | 3931 } else if (sourceEntry is DartEntry) { |
| 3875 try { | 3932 try { |
| 3876 return _getDartParseData(source, sourceEntry, DartEntry.SOURCE_KIND); | 3933 return _getDartParseData(source, sourceEntry, DartEntry.SOURCE_KIND); |
| 3877 } on AnalysisException catch (exception) { | 3934 } on AnalysisException catch (exception) { |
| 3878 return SourceKind.UNKNOWN; | 3935 return SourceKind.UNKNOWN; |
| 3879 } | 3936 } |
| 3880 } | 3937 } |
| 3881 return sourceEntry.kind; | 3938 return sourceEntry.kind; |
| 3882 } | 3939 } |
| 3883 | 3940 |
| 3941 @override |
| 3884 LibraryElement computeLibraryElement(Source source) => _getDartResolutionData2
(source, source, DartEntry.ELEMENT, null); | 3942 LibraryElement computeLibraryElement(Source source) => _getDartResolutionData2
(source, source, DartEntry.ELEMENT, null); |
| 3885 | 3943 |
| 3944 @override |
| 3886 LineInfo computeLineInfo(Source source) { | 3945 LineInfo computeLineInfo(Source source) { |
| 3887 SourceEntry sourceEntry = _getReadableSourceEntry(source); | 3946 SourceEntry sourceEntry = _getReadableSourceEntry(source); |
| 3888 try { | 3947 try { |
| 3889 if (sourceEntry is HtmlEntry) { | 3948 if (sourceEntry is HtmlEntry) { |
| 3890 return _getHtmlParseData(source, SourceEntry.LINE_INFO, null); | 3949 return _getHtmlParseData(source, SourceEntry.LINE_INFO, null); |
| 3891 } else if (sourceEntry is DartEntry) { | 3950 } else if (sourceEntry is DartEntry) { |
| 3892 return _getDartScanData2(source, SourceEntry.LINE_INFO, null); | 3951 return _getDartScanData2(source, SourceEntry.LINE_INFO, null); |
| 3893 } | 3952 } |
| 3894 } on ObsoleteSourceAnalysisException catch (exception) { | 3953 } on ObsoleteSourceAnalysisException catch (exception) { |
| 3895 AnalysisEngine.instance.logger.logInformation2("Could not compute ${Source
Entry.LINE_INFO.toString()}", exception); | 3954 AnalysisEngine.instance.logger.logInformation2("Could not compute ${Source
Entry.LINE_INFO.toString()}", exception); |
| 3896 } | 3955 } |
| 3897 return null; | 3956 return null; |
| 3898 } | 3957 } |
| 3899 | 3958 |
| 3959 @override |
| 3900 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) { | 3960 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) { |
| 3901 DartEntry dartEntry = _getReadableDartEntry(source); | 3961 DartEntry dartEntry = _getReadableDartEntry(source); |
| 3902 if (dartEntry == null) { | 3962 if (dartEntry == null) { |
| 3903 throw new AnalysisException.con1("computeResolvableCompilationUnit for non
-Dart: ${source.fullName}"); | 3963 throw new AnalysisException.con1("computeResolvableCompilationUnit for non
-Dart: ${source.fullName}"); |
| 3904 } | 3964 } |
| 3905 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); | 3965 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); |
| 3906 DartEntryImpl dartCopy = dartEntry.writableCopy; | 3966 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 3907 CompilationUnit unit = dartCopy.resolvableCompilationUnit; | 3967 CompilationUnit unit = dartCopy.resolvableCompilationUnit; |
| 3908 if (unit == null) { | 3968 if (unit == null) { |
| 3909 throw new AnalysisException.con2("Internal error: computeResolvableCompila
tionUnit could not parse ${source.fullName}", dartEntry.exception); | 3969 throw new AnalysisException.con2("Internal error: computeResolvableCompila
tionUnit could not parse ${source.fullName}", dartEntry.exception); |
| 3910 } | 3970 } |
| 3911 _cache.put(source, dartCopy); | 3971 _cache.put(source, dartCopy); |
| 3912 return new ResolvableCompilationUnit(dartCopy.modificationTime, unit); | 3972 return new ResolvableCompilationUnit(dartCopy.modificationTime, unit); |
| 3913 } | 3973 } |
| 3914 | 3974 |
| 3975 @override |
| 3915 void dispose() { | 3976 void dispose() { |
| 3916 _disposed = true; | 3977 _disposed = true; |
| 3917 } | 3978 } |
| 3918 | 3979 |
| 3980 @override |
| 3919 bool exists(Source source) { | 3981 bool exists(Source source) { |
| 3920 if (source == null) { | 3982 if (source == null) { |
| 3921 return false; | 3983 return false; |
| 3922 } | 3984 } |
| 3923 if (_contentCache.getContents(source) != null) { | 3985 if (_contentCache.getContents(source) != null) { |
| 3924 return true; | 3986 return true; |
| 3925 } | 3987 } |
| 3926 return source.exists(); | 3988 return source.exists(); |
| 3927 } | 3989 } |
| 3928 | 3990 |
| 3991 @override |
| 3929 AnalysisContext extractContext(SourceContainer container) => extractContextInt
o(container, AnalysisEngine.instance.createAnalysisContext() as InternalAnalysis
Context); | 3992 AnalysisContext extractContext(SourceContainer container) => extractContextInt
o(container, AnalysisEngine.instance.createAnalysisContext() as InternalAnalysis
Context); |
| 3930 | 3993 |
| 3994 @override |
| 3931 InternalAnalysisContext extractContextInto(SourceContainer container, Internal
AnalysisContext newContext) { | 3995 InternalAnalysisContext extractContextInto(SourceContainer container, Internal
AnalysisContext newContext) { |
| 3932 List<Source> sourcesToRemove = new List<Source>(); | 3996 List<Source> sourcesToRemove = new List<Source>(); |
| 3933 // Move sources in the specified directory to the new context | 3997 // Move sources in the specified directory to the new context |
| 3934 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 3998 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 3935 Source source = entry.getKey(); | 3999 Source source = entry.getKey(); |
| 3936 if (container.contains(source)) { | 4000 if (container.contains(source)) { |
| 3937 sourcesToRemove.add(source); | 4001 sourcesToRemove.add(source); |
| 3938 newContext.addSourceInfo(source, entry.getValue().writableCopy); | 4002 newContext.addSourceInfo(source, entry.getValue().writableCopy); |
| 3939 } | 4003 } |
| 3940 } | 4004 } |
| 3941 return newContext; | 4005 return newContext; |
| 3942 } | 4006 } |
| 3943 | 4007 |
| 4008 @override |
| 3944 AnalysisOptions get analysisOptions => _options; | 4009 AnalysisOptions get analysisOptions => _options; |
| 3945 | 4010 |
| 4011 @override |
| 3946 CompilationUnitElement getCompilationUnitElement(Source unitSource, Source lib
rarySource) { | 4012 CompilationUnitElement getCompilationUnitElement(Source unitSource, Source lib
rarySource) { |
| 3947 LibraryElement libraryElement = getLibraryElement(librarySource); | 4013 LibraryElement libraryElement = getLibraryElement(librarySource); |
| 3948 if (libraryElement != null) { | 4014 if (libraryElement != null) { |
| 3949 // try defining unit | 4015 // try defining unit |
| 3950 CompilationUnitElement definingUnit = libraryElement.definingCompilationUn
it; | 4016 CompilationUnitElement definingUnit = libraryElement.definingCompilationUn
it; |
| 3951 if (definingUnit.source == unitSource) { | 4017 if (definingUnit.source == unitSource) { |
| 3952 return definingUnit; | 4018 return definingUnit; |
| 3953 } | 4019 } |
| 3954 // try parts | 4020 // try parts |
| 3955 for (CompilationUnitElement partUnit in libraryElement.parts) { | 4021 for (CompilationUnitElement partUnit in libraryElement.parts) { |
| 3956 if (partUnit.source == unitSource) { | 4022 if (partUnit.source == unitSource) { |
| 3957 return partUnit; | 4023 return partUnit; |
| 3958 } | 4024 } |
| 3959 } | 4025 } |
| 3960 } | 4026 } |
| 3961 return null; | 4027 return null; |
| 3962 } | 4028 } |
| 3963 | 4029 |
| 4030 @override |
| 3964 TimestampedData<String> getContents(Source source) { | 4031 TimestampedData<String> getContents(Source source) { |
| 3965 String contents = _contentCache.getContents(source); | 4032 String contents = _contentCache.getContents(source); |
| 3966 if (contents != null) { | 4033 if (contents != null) { |
| 3967 return new TimestampedData<String>(_contentCache.getModificationStamp(sour
ce), contents); | 4034 return new TimestampedData<String>(_contentCache.getModificationStamp(sour
ce), contents); |
| 3968 } | 4035 } |
| 3969 return source.contents; | 4036 return source.contents; |
| 3970 } | 4037 } |
| 3971 | 4038 |
| 4039 @override |
| 3972 Element getElement(ElementLocation location) { | 4040 Element getElement(ElementLocation location) { |
| 3973 // TODO(brianwilkerson) This should not be a "get" method. | 4041 // TODO(brianwilkerson) This should not be a "get" method. |
| 3974 try { | 4042 try { |
| 3975 List<String> components = (location as ElementLocationImpl).components; | 4043 List<String> components = (location as ElementLocationImpl).components; |
| 3976 Source librarySource = _computeSourceFromEncoding(components[0]); | 4044 Source librarySource = _computeSourceFromEncoding(components[0]); |
| 3977 ElementImpl element = computeLibraryElement(librarySource) as ElementImpl; | 4045 ElementImpl element = computeLibraryElement(librarySource) as ElementImpl; |
| 3978 for (int i = 1; i < components.length; i++) { | 4046 for (int i = 1; i < components.length; i++) { |
| 3979 if (element == null) { | 4047 if (element == null) { |
| 3980 return null; | 4048 return null; |
| 3981 } | 4049 } |
| 3982 element = element.getChild(components[i]); | 4050 element = element.getChild(components[i]); |
| 3983 } | 4051 } |
| 3984 return element; | 4052 return element; |
| 3985 } on AnalysisException catch (exception) { | 4053 } on AnalysisException catch (exception) { |
| 3986 return null; | 4054 return null; |
| 3987 } | 4055 } |
| 3988 } | 4056 } |
| 3989 | 4057 |
| 4058 @override |
| 3990 AnalysisErrorInfo getErrors(Source source) { | 4059 AnalysisErrorInfo getErrors(Source source) { |
| 3991 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); | 4060 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); |
| 3992 if (sourceEntry is DartEntry) { | 4061 if (sourceEntry is DartEntry) { |
| 3993 DartEntry dartEntry = sourceEntry; | 4062 DartEntry dartEntry = sourceEntry; |
| 3994 return new AnalysisErrorInfoImpl(dartEntry.allErrors, dartEntry.getValue(S
ourceEntry.LINE_INFO)); | 4063 return new AnalysisErrorInfoImpl(dartEntry.allErrors, dartEntry.getValue(S
ourceEntry.LINE_INFO)); |
| 3995 } else if (sourceEntry is HtmlEntry) { | 4064 } else if (sourceEntry is HtmlEntry) { |
| 3996 HtmlEntry htmlEntry = sourceEntry; | 4065 HtmlEntry htmlEntry = sourceEntry; |
| 3997 return new AnalysisErrorInfoImpl(htmlEntry.allErrors, htmlEntry.getValue(S
ourceEntry.LINE_INFO)); | 4066 return new AnalysisErrorInfoImpl(htmlEntry.allErrors, htmlEntry.getValue(S
ourceEntry.LINE_INFO)); |
| 3998 } | 4067 } |
| 3999 return new AnalysisErrorInfoImpl(AnalysisError.NO_ERRORS, null); | 4068 return new AnalysisErrorInfoImpl(AnalysisError.NO_ERRORS, null); |
| 4000 } | 4069 } |
| 4001 | 4070 |
| 4071 @override |
| 4002 HtmlElement getHtmlElement(Source source) { | 4072 HtmlElement getHtmlElement(Source source) { |
| 4003 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); | 4073 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); |
| 4004 if (sourceEntry is HtmlEntry) { | 4074 if (sourceEntry is HtmlEntry) { |
| 4005 return sourceEntry.getValue(HtmlEntry.ELEMENT); | 4075 return sourceEntry.getValue(HtmlEntry.ELEMENT); |
| 4006 } | 4076 } |
| 4007 return null; | 4077 return null; |
| 4008 } | 4078 } |
| 4009 | 4079 |
| 4080 @override |
| 4010 List<Source> getHtmlFilesReferencing(Source source) { | 4081 List<Source> getHtmlFilesReferencing(Source source) { |
| 4011 SourceKind sourceKind = getKindOf(source); | 4082 SourceKind sourceKind = getKindOf(source); |
| 4012 if (sourceKind == null) { | 4083 if (sourceKind == null) { |
| 4013 return Source.EMPTY_ARRAY; | 4084 return Source.EMPTY_ARRAY; |
| 4014 } | 4085 } |
| 4015 List<Source> htmlSources = new List<Source>(); | 4086 List<Source> htmlSources = new List<Source>(); |
| 4016 while (true) { | 4087 while (true) { |
| 4017 if (sourceKind == SourceKind.LIBRARY) { | 4088 if (sourceKind == SourceKind.LIBRARY) { |
| 4018 } else if (sourceKind == SourceKind.PART) { | 4089 } else if (sourceKind == SourceKind.PART) { |
| 4019 List<Source> librarySources = getLibrariesContaining(source); | 4090 List<Source> librarySources = getLibrariesContaining(source); |
| 4020 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 4091 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 4021 SourceEntry sourceEntry = entry.getValue(); | 4092 SourceEntry sourceEntry = entry.getValue(); |
| 4022 if (identical(sourceEntry.kind, SourceKind.HTML)) { | 4093 if (identical(sourceEntry.kind, SourceKind.HTML)) { |
| 4023 List<Source> referencedLibraries = (sourceEntry as HtmlEntry).getVal
ue(HtmlEntry.REFERENCED_LIBRARIES); | 4094 List<Source> referencedLibraries = (sourceEntry as HtmlEntry).getVal
ue(HtmlEntry.REFERENCED_LIBRARIES); |
| 4024 if (_containsAny(referencedLibraries, librarySources)) { | 4095 if (_containsAny(referencedLibraries, librarySources)) { |
| 4025 htmlSources.add(entry.getKey()); | 4096 htmlSources.add(entry.getKey()); |
| 4026 } | 4097 } |
| 4027 } | 4098 } |
| 4028 } | 4099 } |
| 4029 } | 4100 } |
| 4030 break; | 4101 break; |
| 4031 } | 4102 } |
| 4032 if (htmlSources.isEmpty) { | 4103 if (htmlSources.isEmpty) { |
| 4033 return Source.EMPTY_ARRAY; | 4104 return Source.EMPTY_ARRAY; |
| 4034 } | 4105 } |
| 4035 return new List.from(htmlSources); | 4106 return new List.from(htmlSources); |
| 4036 } | 4107 } |
| 4037 | 4108 |
| 4109 @override |
| 4038 List<Source> get htmlSources => _getSources(SourceKind.HTML); | 4110 List<Source> get htmlSources => _getSources(SourceKind.HTML); |
| 4039 | 4111 |
| 4112 @override |
| 4040 SourceKind getKindOf(Source source) { | 4113 SourceKind getKindOf(Source source) { |
| 4041 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); | 4114 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); |
| 4042 if (sourceEntry == null) { | 4115 if (sourceEntry == null) { |
| 4043 return SourceKind.UNKNOWN; | 4116 return SourceKind.UNKNOWN; |
| 4044 } | 4117 } |
| 4045 return sourceEntry.kind; | 4118 return sourceEntry.kind; |
| 4046 } | 4119 } |
| 4047 | 4120 |
| 4121 @override |
| 4048 List<Source> get launchableClientLibrarySources { | 4122 List<Source> get launchableClientLibrarySources { |
| 4049 // TODO(brianwilkerson) This needs to filter out libraries that do not refer
ence dart:html, | 4123 // TODO(brianwilkerson) This needs to filter out libraries that do not refer
ence dart:html, |
| 4050 // either directly or indirectly. | 4124 // either directly or indirectly. |
| 4051 List<Source> sources = new List<Source>(); | 4125 List<Source> sources = new List<Source>(); |
| 4052 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 4126 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 4053 Source source = entry.getKey(); | 4127 Source source = entry.getKey(); |
| 4054 SourceEntry sourceEntry = entry.getValue(); | 4128 SourceEntry sourceEntry = entry.getValue(); |
| 4055 if (identical(sourceEntry.kind, SourceKind.LIBRARY) && !source.isInSystemL
ibrary) { | 4129 if (identical(sourceEntry.kind, SourceKind.LIBRARY) && !source.isInSystemL
ibrary) { |
| 4056 // DartEntry dartEntry = (DartEntry) sourceEntry; | 4130 // DartEntry dartEntry = (DartEntry) sourceEntry; |
| 4057 // if (dartEntry.getValue(DartEntry.IS_LAUNCHABLE) && dartEntry
.getValue(DartEntry.IS_CLIENT)) { | 4131 // if (dartEntry.getValue(DartEntry.IS_LAUNCHABLE) && dartEntry
.getValue(DartEntry.IS_CLIENT)) { |
| 4058 sources.add(source); | 4132 sources.add(source); |
| 4059 } | 4133 } |
| 4060 } | 4134 } |
| 4061 return new List.from(sources); | 4135 return new List.from(sources); |
| 4062 } | 4136 } |
| 4063 | 4137 |
| 4138 @override |
| 4064 List<Source> get launchableServerLibrarySources { | 4139 List<Source> get launchableServerLibrarySources { |
| 4065 // TODO(brianwilkerson) This needs to filter out libraries that reference da
rt:html, either | 4140 // TODO(brianwilkerson) This needs to filter out libraries that reference da
rt:html, either |
| 4066 // directly or indirectly. | 4141 // directly or indirectly. |
| 4067 List<Source> sources = new List<Source>(); | 4142 List<Source> sources = new List<Source>(); |
| 4068 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 4143 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 4069 Source source = entry.getKey(); | 4144 Source source = entry.getKey(); |
| 4070 SourceEntry sourceEntry = entry.getValue(); | 4145 SourceEntry sourceEntry = entry.getValue(); |
| 4071 if (identical(sourceEntry.kind, SourceKind.LIBRARY) && !source.isInSystemL
ibrary) { | 4146 if (identical(sourceEntry.kind, SourceKind.LIBRARY) && !source.isInSystemL
ibrary) { |
| 4072 // DartEntry dartEntry = (DartEntry) sourceEntry; | 4147 // DartEntry dartEntry = (DartEntry) sourceEntry; |
| 4073 // if (dartEntry.getValue(DartEntry.IS_LAUNCHABLE) && !dartEntr
y.getValue(DartEntry.IS_CLIENT)) { | 4148 // if (dartEntry.getValue(DartEntry.IS_LAUNCHABLE) && !dartEntr
y.getValue(DartEntry.IS_CLIENT)) { |
| 4074 sources.add(source); | 4149 sources.add(source); |
| 4075 } | 4150 } |
| 4076 } | 4151 } |
| 4077 return new List.from(sources); | 4152 return new List.from(sources); |
| 4078 } | 4153 } |
| 4079 | 4154 |
| 4155 @override |
| 4080 List<Source> getLibrariesContaining(Source source) { | 4156 List<Source> getLibrariesContaining(Source source) { |
| 4081 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); | 4157 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); |
| 4082 if (sourceEntry is DartEntry) { | 4158 if (sourceEntry is DartEntry) { |
| 4083 return sourceEntry.getValue(DartEntry.CONTAINING_LIBRARIES); | 4159 return sourceEntry.getValue(DartEntry.CONTAINING_LIBRARIES); |
| 4084 } | 4160 } |
| 4085 return Source.EMPTY_ARRAY; | 4161 return Source.EMPTY_ARRAY; |
| 4086 } | 4162 } |
| 4087 | 4163 |
| 4164 @override |
| 4088 List<Source> getLibrariesDependingOn(Source librarySource) { | 4165 List<Source> getLibrariesDependingOn(Source librarySource) { |
| 4089 List<Source> dependentLibraries = new List<Source>(); | 4166 List<Source> dependentLibraries = new List<Source>(); |
| 4090 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 4167 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 4091 SourceEntry sourceEntry = entry.getValue(); | 4168 SourceEntry sourceEntry = entry.getValue(); |
| 4092 if (identical(sourceEntry.kind, SourceKind.LIBRARY)) { | 4169 if (identical(sourceEntry.kind, SourceKind.LIBRARY)) { |
| 4093 if (_contains((sourceEntry as DartEntry).getValue(DartEntry.EXPORTED_LIB
RARIES), librarySource)) { | 4170 if (_contains((sourceEntry as DartEntry).getValue(DartEntry.EXPORTED_LIB
RARIES), librarySource)) { |
| 4094 dependentLibraries.add(entry.getKey()); | 4171 dependentLibraries.add(entry.getKey()); |
| 4095 } | 4172 } |
| 4096 if (_contains((sourceEntry as DartEntry).getValue(DartEntry.IMPORTED_LIB
RARIES), librarySource)) { | 4173 if (_contains((sourceEntry as DartEntry).getValue(DartEntry.IMPORTED_LIB
RARIES), librarySource)) { |
| 4097 dependentLibraries.add(entry.getKey()); | 4174 dependentLibraries.add(entry.getKey()); |
| 4098 } | 4175 } |
| 4099 } | 4176 } |
| 4100 } | 4177 } |
| 4101 if (dependentLibraries.isEmpty) { | 4178 if (dependentLibraries.isEmpty) { |
| 4102 return Source.EMPTY_ARRAY; | 4179 return Source.EMPTY_ARRAY; |
| 4103 } | 4180 } |
| 4104 return new List.from(dependentLibraries); | 4181 return new List.from(dependentLibraries); |
| 4105 } | 4182 } |
| 4106 | 4183 |
| 4184 @override |
| 4107 LibraryElement getLibraryElement(Source source) { | 4185 LibraryElement getLibraryElement(Source source) { |
| 4108 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); | 4186 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); |
| 4109 if (sourceEntry is DartEntry) { | 4187 if (sourceEntry is DartEntry) { |
| 4110 return sourceEntry.getValue(DartEntry.ELEMENT); | 4188 return sourceEntry.getValue(DartEntry.ELEMENT); |
| 4111 } | 4189 } |
| 4112 return null; | 4190 return null; |
| 4113 } | 4191 } |
| 4114 | 4192 |
| 4193 @override |
| 4115 List<Source> get librarySources => _getSources(SourceKind.LIBRARY); | 4194 List<Source> get librarySources => _getSources(SourceKind.LIBRARY); |
| 4116 | 4195 |
| 4196 @override |
| 4117 LineInfo getLineInfo(Source source) { | 4197 LineInfo getLineInfo(Source source) { |
| 4118 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); | 4198 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(source); |
| 4119 if (sourceEntry != null) { | 4199 if (sourceEntry != null) { |
| 4120 return sourceEntry.getValue(SourceEntry.LINE_INFO); | 4200 return sourceEntry.getValue(SourceEntry.LINE_INFO); |
| 4121 } | 4201 } |
| 4122 return null; | 4202 return null; |
| 4123 } | 4203 } |
| 4124 | 4204 |
| 4205 @override |
| 4125 int getModificationStamp(Source source) { | 4206 int getModificationStamp(Source source) { |
| 4126 int stamp = _contentCache.getModificationStamp(source); | 4207 int stamp = _contentCache.getModificationStamp(source); |
| 4127 if (stamp != null) { | 4208 if (stamp != null) { |
| 4128 return stamp; | 4209 return stamp; |
| 4129 } | 4210 } |
| 4130 return source.modificationStamp; | 4211 return source.modificationStamp; |
| 4131 } | 4212 } |
| 4132 | 4213 |
| 4214 @override |
| 4133 Namespace getPublicNamespace(LibraryElement library) { | 4215 Namespace getPublicNamespace(LibraryElement library) { |
| 4134 // TODO(brianwilkerson) Rename this to not start with 'get'. Note that this
is not part of the | 4216 // TODO(brianwilkerson) Rename this to not start with 'get'. Note that this
is not part of the |
| 4135 // API of the interface. | 4217 // API of the interface. |
| 4136 Source source = library.definingCompilationUnit.source; | 4218 Source source = library.definingCompilationUnit.source; |
| 4137 DartEntry dartEntry = _getReadableDartEntry(source); | 4219 DartEntry dartEntry = _getReadableDartEntry(source); |
| 4138 if (dartEntry == null) { | 4220 if (dartEntry == null) { |
| 4139 return null; | 4221 return null; |
| 4140 } | 4222 } |
| 4141 Namespace namespace = null; | 4223 Namespace namespace = null; |
| 4142 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { | 4224 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { |
| 4143 namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE); | 4225 namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE); |
| 4144 } | 4226 } |
| 4145 if (namespace == null) { | 4227 if (namespace == null) { |
| 4146 NamespaceBuilder builder = new NamespaceBuilder(); | 4228 NamespaceBuilder builder = new NamespaceBuilder(); |
| 4147 namespace = builder.createPublicNamespaceForLibrary(library); | 4229 namespace = builder.createPublicNamespaceForLibrary(library); |
| 4148 dartEntry = _getReadableDartEntry(source); | 4230 dartEntry = _getReadableDartEntry(source); |
| 4149 if (dartEntry == null) { | 4231 if (dartEntry == null) { |
| 4150 AnalysisEngine.instance.logger.logError2("Could not compute the public n
amespace for ${library.source.fullName}", new AnalysisException.con1("A Dart fil
e became a non-Dart file: ${source.fullName}")); | 4232 AnalysisEngine.instance.logger.logError2("Could not compute the public n
amespace for ${library.source.fullName}", new AnalysisException.con1("A Dart fil
e became a non-Dart file: ${source.fullName}")); |
| 4151 return null; | 4233 return null; |
| 4152 } | 4234 } |
| 4153 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { | 4235 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { |
| 4154 DartEntryImpl dartCopy = _getReadableDartEntry(source).writableCopy; | 4236 DartEntryImpl dartCopy = _getReadableDartEntry(source).writableCopy; |
| 4155 dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace); | 4237 dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace); |
| 4156 _cache.put(source, dartCopy); | 4238 _cache.put(source, dartCopy); |
| 4157 } | 4239 } |
| 4158 } | 4240 } |
| 4159 return namespace; | 4241 return namespace; |
| 4160 } | 4242 } |
| 4161 | 4243 |
| 4244 @override |
| 4162 Namespace getPublicNamespace2(Source source) { | 4245 Namespace getPublicNamespace2(Source source) { |
| 4163 // TODO(brianwilkerson) Rename this to not start with 'get'. Note that this
is not part of the | 4246 // TODO(brianwilkerson) Rename this to not start with 'get'. Note that this
is not part of the |
| 4164 // API of the interface. | 4247 // API of the interface. |
| 4165 DartEntry dartEntry = _getReadableDartEntry(source); | 4248 DartEntry dartEntry = _getReadableDartEntry(source); |
| 4166 if (dartEntry == null) { | 4249 if (dartEntry == null) { |
| 4167 return null; | 4250 return null; |
| 4168 } | 4251 } |
| 4169 Namespace namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE); | 4252 Namespace namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE); |
| 4170 if (namespace == null) { | 4253 if (namespace == null) { |
| 4171 LibraryElement library = computeLibraryElement(source); | 4254 LibraryElement library = computeLibraryElement(source); |
| 4172 if (library == null) { | 4255 if (library == null) { |
| 4173 return null; | 4256 return null; |
| 4174 } | 4257 } |
| 4175 NamespaceBuilder builder = new NamespaceBuilder(); | 4258 NamespaceBuilder builder = new NamespaceBuilder(); |
| 4176 namespace = builder.createPublicNamespaceForLibrary(library); | 4259 namespace = builder.createPublicNamespaceForLibrary(library); |
| 4177 dartEntry = _getReadableDartEntry(source); | 4260 dartEntry = _getReadableDartEntry(source); |
| 4178 if (dartEntry == null) { | 4261 if (dartEntry == null) { |
| 4179 throw new AnalysisException.con1("A Dart file became a non-Dart file: ${
source.fullName}"); | 4262 throw new AnalysisException.con1("A Dart file became a non-Dart file: ${
source.fullName}"); |
| 4180 } | 4263 } |
| 4181 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { | 4264 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { |
| 4182 DartEntryImpl dartCopy = _getReadableDartEntry(source).writableCopy; | 4265 DartEntryImpl dartCopy = _getReadableDartEntry(source).writableCopy; |
| 4183 dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace); | 4266 dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace); |
| 4184 _cache.put(source, dartCopy); | 4267 _cache.put(source, dartCopy); |
| 4185 } | 4268 } |
| 4186 } | 4269 } |
| 4187 return namespace; | 4270 return namespace; |
| 4188 } | 4271 } |
| 4189 | 4272 |
| 4273 @override |
| 4190 List<Source> get refactoringUnsafeSources { | 4274 List<Source> get refactoringUnsafeSources { |
| 4191 List<Source> sources = new List<Source>(); | 4275 List<Source> sources = new List<Source>(); |
| 4192 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 4276 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 4193 SourceEntry sourceEntry = entry.getValue(); | 4277 SourceEntry sourceEntry = entry.getValue(); |
| 4194 if (sourceEntry is DartEntry) { | 4278 if (sourceEntry is DartEntry) { |
| 4195 if (!sourceEntry.isRefactoringSafe) { | 4279 if (!sourceEntry.isRefactoringSafe) { |
| 4196 sources.add(entry.getKey()); | 4280 sources.add(entry.getKey()); |
| 4197 } | 4281 } |
| 4198 } | 4282 } |
| 4199 } | 4283 } |
| 4200 return new List.from(sources); | 4284 return new List.from(sources); |
| 4201 } | 4285 } |
| 4202 | 4286 |
| 4287 @override |
| 4203 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l
ibrary) { | 4288 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l
ibrary) { |
| 4204 if (library == null) { | 4289 if (library == null) { |
| 4205 return null; | 4290 return null; |
| 4206 } | 4291 } |
| 4207 return getResolvedCompilationUnit2(unitSource, library.source); | 4292 return getResolvedCompilationUnit2(unitSource, library.source); |
| 4208 } | 4293 } |
| 4209 | 4294 |
| 4295 @override |
| 4210 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { | 4296 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { |
| 4211 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(unitSource); | 4297 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(unitSource); |
| 4212 if (sourceEntry is DartEntry) { | 4298 if (sourceEntry is DartEntry) { |
| 4213 return sourceEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT, librarySourc
e); | 4299 return sourceEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT, librarySourc
e); |
| 4214 } | 4300 } |
| 4215 return null; | 4301 return null; |
| 4216 } | 4302 } |
| 4217 | 4303 |
| 4304 @override |
| 4218 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) { | 4305 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) { |
| 4219 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(htmlSource); | 4306 SourceEntry sourceEntry = _getReadableSourceEntryOrNull(htmlSource); |
| 4220 if (sourceEntry is HtmlEntry) { | 4307 if (sourceEntry is HtmlEntry) { |
| 4221 HtmlEntry htmlEntry = sourceEntry; | 4308 HtmlEntry htmlEntry = sourceEntry; |
| 4222 return htmlEntry.getValue(HtmlEntry.RESOLVED_UNIT); | 4309 return htmlEntry.getValue(HtmlEntry.RESOLVED_UNIT); |
| 4223 } | 4310 } |
| 4224 return null; | 4311 return null; |
| 4225 } | 4312 } |
| 4226 | 4313 |
| 4314 @override |
| 4227 SourceFactory get sourceFactory => _sourceFactory; | 4315 SourceFactory get sourceFactory => _sourceFactory; |
| 4228 | 4316 |
| 4229 /** | 4317 /** |
| 4230 * Return a list of the sources that would be processed by [performAnalysisTas
k]. This | 4318 * Return a list of the sources that would be processed by [performAnalysisTas
k]. This |
| 4231 * method duplicates, and must therefore be kept in sync with, [getNextAnalysi
sTask]. | 4319 * method duplicates, and must therefore be kept in sync with, [getNextAnalysi
sTask]. |
| 4232 * This method is intended to be used for testing purposes only. | 4320 * This method is intended to be used for testing purposes only. |
| 4233 * | 4321 * |
| 4234 * @return a list of the sources that would be processed by [performAnalysisTa
sk] | 4322 * @return a list of the sources that would be processed by [performAnalysisTa
sk] |
| 4235 */ | 4323 */ |
| 4236 List<Source> get sourcesNeedingProcessing { | 4324 List<Source> get sourcesNeedingProcessing { |
| 4237 Set<Source> sources = new Set<Source>(); | 4325 Set<Source> sources = new Set<Source>(); |
| 4238 bool hintsEnabled = _options.hint; | 4326 bool hintsEnabled = _options.hint; |
| 4239 // | 4327 // |
| 4240 // Look for priority sources that need to be analyzed. | 4328 // Look for priority sources that need to be analyzed. |
| 4241 // | 4329 // |
| 4242 for (Source source in _priorityOrder) { | 4330 for (Source source in _priorityOrder) { |
| 4243 _getSourcesNeedingProcessing(source, _cache.get(source), true, hintsEnable
d, sources); | 4331 _getSourcesNeedingProcessing(source, _cache.get(source), true, hintsEnable
d, sources); |
| 4244 } | 4332 } |
| 4245 // | 4333 // |
| 4246 // Look for non-priority sources that need to be analyzed. | 4334 // Look for non-priority sources that need to be analyzed. |
| 4247 // | 4335 // |
| 4248 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 4336 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 4249 _getSourcesNeedingProcessing(entry.getKey(), entry.getValue(), false, hint
sEnabled, sources); | 4337 _getSourcesNeedingProcessing(entry.getKey(), entry.getValue(), false, hint
sEnabled, sources); |
| 4250 } | 4338 } |
| 4251 return new List<Source>.from(sources); | 4339 return new List<Source>.from(sources); |
| 4252 } | 4340 } |
| 4253 | 4341 |
| 4342 @override |
| 4254 AnalysisContentStatistics get statistics { | 4343 AnalysisContentStatistics get statistics { |
| 4255 AnalysisContentStatisticsImpl statistics = new AnalysisContentStatisticsImpl
(); | 4344 AnalysisContentStatisticsImpl statistics = new AnalysisContentStatisticsImpl
(); |
| 4256 for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) { | 4345 for (MapEntry<Source, SourceEntry> mapEntry in _cache.entrySet()) { |
| 4257 statistics.addSource(mapEntry.getKey()); | 4346 statistics.addSource(mapEntry.getKey()); |
| 4258 SourceEntry entry = mapEntry.getValue(); | 4347 SourceEntry entry = mapEntry.getValue(); |
| 4259 if (entry is DartEntry) { | 4348 if (entry is DartEntry) { |
| 4260 Source source = mapEntry.getKey(); | 4349 Source source = mapEntry.getKey(); |
| 4261 DartEntry dartEntry = entry; | 4350 DartEntry dartEntry = entry; |
| 4262 SourceKind kind = dartEntry.getValue(DartEntry.SOURCE_KIND); | 4351 SourceKind kind = dartEntry.getValue(DartEntry.SOURCE_KIND); |
| 4263 // get library independent values | 4352 // get library independent values |
| (...skipping 22 matching lines...) Expand all Loading... |
| 4286 statistics.putCacheItem(htmlEntry, SourceEntry.LINE_INFO); | 4375 statistics.putCacheItem(htmlEntry, SourceEntry.LINE_INFO); |
| 4287 statistics.putCacheItem(htmlEntry, HtmlEntry.PARSE_ERRORS); | 4376 statistics.putCacheItem(htmlEntry, HtmlEntry.PARSE_ERRORS); |
| 4288 statistics.putCacheItem(htmlEntry, HtmlEntry.PARSED_UNIT); | 4377 statistics.putCacheItem(htmlEntry, HtmlEntry.PARSED_UNIT); |
| 4289 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLUTION_ERRORS); | 4378 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLUTION_ERRORS); |
| 4290 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLVED_UNIT); | 4379 statistics.putCacheItem(htmlEntry, HtmlEntry.RESOLVED_UNIT); |
| 4291 } | 4380 } |
| 4292 } | 4381 } |
| 4293 return statistics; | 4382 return statistics; |
| 4294 } | 4383 } |
| 4295 | 4384 |
| 4385 @override |
| 4296 TypeProvider get typeProvider { | 4386 TypeProvider get typeProvider { |
| 4297 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); | 4387 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); |
| 4298 return new TypeProviderImpl(computeLibraryElement(coreSource)); | 4388 return new TypeProviderImpl(computeLibraryElement(coreSource)); |
| 4299 } | 4389 } |
| 4300 | 4390 |
| 4391 @override |
| 4301 TimestampedData<CompilationUnit> internalResolveCompilationUnit(Source unitSou
rce, LibraryElement libraryElement) { | 4392 TimestampedData<CompilationUnit> internalResolveCompilationUnit(Source unitSou
rce, LibraryElement libraryElement) { |
| 4302 DartEntry dartEntry = _getReadableDartEntry(unitSource); | 4393 DartEntry dartEntry = _getReadableDartEntry(unitSource); |
| 4303 if (dartEntry == null) { | 4394 if (dartEntry == null) { |
| 4304 throw new AnalysisException.con1("internalResolveCompilationUnit invoked f
or non-Dart file: ${unitSource.fullName}"); | 4395 throw new AnalysisException.con1("internalResolveCompilationUnit invoked f
or non-Dart file: ${unitSource.fullName}"); |
| 4305 } | 4396 } |
| 4306 Source librarySource = libraryElement.source; | 4397 Source librarySource = libraryElement.source; |
| 4307 dartEntry = _cacheDartResolutionData(unitSource, librarySource, dartEntry, D
artEntry.RESOLVED_UNIT); | 4398 dartEntry = _cacheDartResolutionData(unitSource, librarySource, dartEntry, D
artEntry.RESOLVED_UNIT); |
| 4308 return new TimestampedData<CompilationUnit>(dartEntry.modificationTime, dart
Entry.getValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource)); | 4399 return new TimestampedData<CompilationUnit>(dartEntry.modificationTime, dart
Entry.getValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource)); |
| 4309 } | 4400 } |
| 4310 | 4401 |
| 4402 @override |
| 4311 bool isClientLibrary(Source librarySource) { | 4403 bool isClientLibrary(Source librarySource) { |
| 4312 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); | 4404 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); |
| 4313 if (sourceEntry is DartEntry) { | 4405 if (sourceEntry is DartEntry) { |
| 4314 DartEntry dartEntry = sourceEntry; | 4406 DartEntry dartEntry = sourceEntry; |
| 4315 return dartEntry.getValue(DartEntry.IS_CLIENT) && dartEntry.getValue(DartE
ntry.IS_LAUNCHABLE); | 4407 return dartEntry.getValue(DartEntry.IS_CLIENT) && dartEntry.getValue(DartE
ntry.IS_LAUNCHABLE); |
| 4316 } | 4408 } |
| 4317 return false; | 4409 return false; |
| 4318 } | 4410 } |
| 4319 | 4411 |
| 4412 @override |
| 4320 bool get isDisposed => _disposed; | 4413 bool get isDisposed => _disposed; |
| 4321 | 4414 |
| 4415 @override |
| 4322 bool isServerLibrary(Source librarySource) { | 4416 bool isServerLibrary(Source librarySource) { |
| 4323 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); | 4417 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); |
| 4324 if (sourceEntry is DartEntry) { | 4418 if (sourceEntry is DartEntry) { |
| 4325 DartEntry dartEntry = sourceEntry; | 4419 DartEntry dartEntry = sourceEntry; |
| 4326 return !dartEntry.getValue(DartEntry.IS_CLIENT) && dartEntry.getValue(Dart
Entry.IS_LAUNCHABLE); | 4420 return !dartEntry.getValue(DartEntry.IS_CLIENT) && dartEntry.getValue(Dart
Entry.IS_LAUNCHABLE); |
| 4327 } | 4421 } |
| 4328 return false; | 4422 return false; |
| 4329 } | 4423 } |
| 4330 | 4424 |
| 4425 @override |
| 4331 void mergeContext(AnalysisContext context) { | 4426 void mergeContext(AnalysisContext context) { |
| 4332 if (context is InstrumentedAnalysisContextImpl) { | 4427 if (context is InstrumentedAnalysisContextImpl) { |
| 4333 context = (context as InstrumentedAnalysisContextImpl).basis; | 4428 context = (context as InstrumentedAnalysisContextImpl).basis; |
| 4334 } | 4429 } |
| 4335 if (context is! AnalysisContextImpl) { | 4430 if (context is! AnalysisContextImpl) { |
| 4336 return; | 4431 return; |
| 4337 } | 4432 } |
| 4338 // TODO(brianwilkerson) This does not lock against the other context's cache
Lock. | 4433 // TODO(brianwilkerson) This does not lock against the other context's cache
Lock. |
| 4339 for (MapEntry<Source, SourceEntry> entry in (context as AnalysisContextImpl)
._cache.entrySet()) { | 4434 for (MapEntry<Source, SourceEntry> entry in (context as AnalysisContextImpl)
._cache.entrySet()) { |
| 4340 Source newSource = entry.getKey(); | 4435 Source newSource = entry.getKey(); |
| 4341 SourceEntry existingEntry = _getReadableSourceEntry(newSource); | 4436 SourceEntry existingEntry = _getReadableSourceEntry(newSource); |
| 4342 if (existingEntry == null) { | 4437 if (existingEntry == null) { |
| 4343 // TODO(brianwilkerson) Decide whether we really need to copy the info. | 4438 // TODO(brianwilkerson) Decide whether we really need to copy the info. |
| 4344 _cache.put(newSource, entry.getValue().writableCopy); | 4439 _cache.put(newSource, entry.getValue().writableCopy); |
| 4345 } else { | 4440 } else { |
| 4346 } | 4441 } |
| 4347 } | 4442 } |
| 4348 } | 4443 } |
| 4349 | 4444 |
| 4445 @override |
| 4350 CompilationUnit parseCompilationUnit(Source source) => _getDartParseData2(sour
ce, DartEntry.PARSED_UNIT, null); | 4446 CompilationUnit parseCompilationUnit(Source source) => _getDartParseData2(sour
ce, DartEntry.PARSED_UNIT, null); |
| 4351 | 4447 |
| 4448 @override |
| 4352 ht.HtmlUnit parseHtmlUnit(Source source) => _getHtmlParseData(source, HtmlEntr
y.PARSED_UNIT, null); | 4449 ht.HtmlUnit parseHtmlUnit(Source source) => _getHtmlParseData(source, HtmlEntr
y.PARSED_UNIT, null); |
| 4353 | 4450 |
| 4451 @override |
| 4354 AnalysisResult performAnalysisTask() { | 4452 AnalysisResult performAnalysisTask() { |
| 4355 int getStart = JavaSystem.currentTimeMillis(); | 4453 int getStart = JavaSystem.currentTimeMillis(); |
| 4356 AnalysisTask task = nextAnalysisTask; | 4454 AnalysisTask task = nextAnalysisTask; |
| 4357 int getEnd = JavaSystem.currentTimeMillis(); | 4455 int getEnd = JavaSystem.currentTimeMillis(); |
| 4358 if (task == null && _validateCacheConsistency()) { | 4456 if (task == null && _validateCacheConsistency()) { |
| 4359 task = nextAnalysisTask; | 4457 task = nextAnalysisTask; |
| 4360 } | 4458 } |
| 4361 if (task == null) { | 4459 if (task == null) { |
| 4362 return new AnalysisResult(_getChangeNotices(true), getEnd - getStart, null
, -1); | 4460 return new AnalysisResult(_getChangeNotices(true), getEnd - getStart, null
, -1); |
| 4363 } | 4461 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4374 AnalysisEngine.instance.logger.logInformation2("Could not perform analysis
task: ${taskDescriptor}", exception); | 4472 AnalysisEngine.instance.logger.logInformation2("Could not perform analysis
task: ${taskDescriptor}", exception); |
| 4375 } on AnalysisException catch (exception) { | 4473 } on AnalysisException catch (exception) { |
| 4376 if (exception.cause is! JavaIOException) { | 4474 if (exception.cause is! JavaIOException) { |
| 4377 AnalysisEngine.instance.logger.logError2("Internal error while performin
g the task: ${task}", exception); | 4475 AnalysisEngine.instance.logger.logError2("Internal error while performin
g the task: ${task}", exception); |
| 4378 } | 4476 } |
| 4379 } | 4477 } |
| 4380 int performEnd = JavaSystem.currentTimeMillis(); | 4478 int performEnd = JavaSystem.currentTimeMillis(); |
| 4381 return new AnalysisResult(_getChangeNotices(false), getEnd - getStart, task.
runtimeType.toString(), performEnd - performStart); | 4479 return new AnalysisResult(_getChangeNotices(false), getEnd - getStart, task.
runtimeType.toString(), performEnd - performStart); |
| 4382 } | 4480 } |
| 4383 | 4481 |
| 4482 @override |
| 4384 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { | 4483 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { |
| 4385 Source htmlSource = _sourceFactory.forUri(DartSdk.DART_HTML); | 4484 Source htmlSource = _sourceFactory.forUri(DartSdk.DART_HTML); |
| 4386 for (MapEntry<Source, LibraryElement> entry in getMapEntrySet(elementMap)) { | 4485 for (MapEntry<Source, LibraryElement> entry in getMapEntrySet(elementMap)) { |
| 4387 Source librarySource = entry.getKey(); | 4486 Source librarySource = entry.getKey(); |
| 4388 LibraryElement library = entry.getValue(); | 4487 LibraryElement library = entry.getValue(); |
| 4389 // | 4488 // |
| 4390 // Cache the element in the library's info. | 4489 // Cache the element in the library's info. |
| 4391 // | 4490 // |
| 4392 DartEntry dartEntry = _getReadableDartEntry(librarySource); | 4491 DartEntry dartEntry = _getReadableDartEntry(librarySource); |
| 4393 if (dartEntry != null) { | 4492 if (dartEntry != null) { |
| 4394 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4493 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4395 _recordElementData(dartEntry, dartCopy, library, library.source, htmlSou
rce); | 4494 _recordElementData(dartEntry, dartCopy, library, library.source, htmlSou
rce); |
| 4396 _cache.put(librarySource, dartCopy); | 4495 _cache.put(librarySource, dartCopy); |
| 4397 } | 4496 } |
| 4398 } | 4497 } |
| 4399 } | 4498 } |
| 4400 | 4499 |
| 4500 @override |
| 4401 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { | 4501 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { |
| 4402 if (library == null) { | 4502 if (library == null) { |
| 4403 return null; | 4503 return null; |
| 4404 } | 4504 } |
| 4405 return resolveCompilationUnit2(unitSource, library.source); | 4505 return resolveCompilationUnit2(unitSource, library.source); |
| 4406 } | 4506 } |
| 4407 | 4507 |
| 4508 @override |
| 4408 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) => _getDartResolutionData2(unitSource, librarySource, DartEntry.RESOLVED_UNIT
, null); | 4509 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) => _getDartResolutionData2(unitSource, librarySource, DartEntry.RESOLVED_UNIT
, null); |
| 4409 | 4510 |
| 4511 @override |
| 4410 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) { | 4512 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) { |
| 4411 computeHtmlElement(htmlSource); | 4513 computeHtmlElement(htmlSource); |
| 4412 return parseHtmlUnit(htmlSource); | 4514 return parseHtmlUnit(htmlSource); |
| 4413 } | 4515 } |
| 4414 | 4516 |
| 4517 @override |
| 4415 void set analysisOptions(AnalysisOptions options) { | 4518 void set analysisOptions(AnalysisOptions options) { |
| 4416 bool needsRecompute = this._options.analyzeFunctionBodies != options.analyze
FunctionBodies || this._options.dart2jsHint != options.dart2jsHint || (this._opt
ions.hint && !options.hint) || this._options.preserveComments != options.preserv
eComments; | 4519 bool needsRecompute = this._options.analyzeFunctionBodies != options.analyze
FunctionBodies || this._options.dart2jsHint != options.dart2jsHint || (this._opt
ions.hint && !options.hint) || this._options.preserveComments != options.preserv
eComments; |
| 4417 int cacheSize = options.cacheSize; | 4520 int cacheSize = options.cacheSize; |
| 4418 if (this._options.cacheSize != cacheSize) { | 4521 if (this._options.cacheSize != cacheSize) { |
| 4419 this._options.cacheSize = cacheSize; | 4522 this._options.cacheSize = cacheSize; |
| 4420 _cache.maxCacheSize = cacheSize; | 4523 _cache.maxCacheSize = cacheSize; |
| 4421 // | 4524 // |
| 4422 // Cap the size of the priority list to being less than the cache size. Fa
ilure to do so can | 4525 // Cap the size of the priority list to being less than the cache size. Fa
ilure to do so can |
| 4423 // result in an infinite loop in performAnalysisTask() because re-caching
one AST structure | 4526 // result in an infinite loop in performAnalysisTask() because re-caching
one AST structure |
| 4424 // can cause another priority source's AST structure to be flushed. | 4527 // can cause another priority source's AST structure to be flushed. |
| 4425 // | 4528 // |
| 4426 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA; | 4529 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA; |
| 4427 if (_priorityOrder.length > maxPriorityOrderSize) { | 4530 if (_priorityOrder.length > maxPriorityOrderSize) { |
| 4428 List<Source> newPriorityOrder = new List<Source>(maxPriorityOrderSize); | 4531 List<Source> newPriorityOrder = new List<Source>(maxPriorityOrderSize); |
| 4429 JavaSystem.arraycopy(_priorityOrder, 0, newPriorityOrder, 0, maxPriority
OrderSize); | 4532 JavaSystem.arraycopy(_priorityOrder, 0, newPriorityOrder, 0, maxPriority
OrderSize); |
| 4430 _priorityOrder = newPriorityOrder; | 4533 _priorityOrder = newPriorityOrder; |
| 4431 } | 4534 } |
| 4432 } | 4535 } |
| 4433 this._options.analyzeFunctionBodies = options.analyzeFunctionBodies; | 4536 this._options.analyzeFunctionBodies = options.analyzeFunctionBodies; |
| 4434 this._options.dart2jsHint = options.dart2jsHint; | 4537 this._options.dart2jsHint = options.dart2jsHint; |
| 4435 this._options.hint = options.hint; | 4538 this._options.hint = options.hint; |
| 4436 this._options.incremental = options.incremental; | 4539 this._options.incremental = options.incremental; |
| 4437 this._options.preserveComments = options.preserveComments; | 4540 this._options.preserveComments = options.preserveComments; |
| 4438 if (needsRecompute) { | 4541 if (needsRecompute) { |
| 4439 _invalidateAllResolutionInformation(); | 4542 _invalidateAllResolutionInformation(); |
| 4440 } | 4543 } |
| 4441 } | 4544 } |
| 4442 | 4545 |
| 4546 @override |
| 4443 void set analysisPriorityOrder(List<Source> sources) { | 4547 void set analysisPriorityOrder(List<Source> sources) { |
| 4444 if (sources == null || sources.isEmpty) { | 4548 if (sources == null || sources.isEmpty) { |
| 4445 _priorityOrder = Source.EMPTY_ARRAY; | 4549 _priorityOrder = Source.EMPTY_ARRAY; |
| 4446 } else { | 4550 } else { |
| 4447 while (sources.remove(null)) { | 4551 while (sources.remove(null)) { |
| 4448 } | 4552 } |
| 4449 if (sources.isEmpty) { | 4553 if (sources.isEmpty) { |
| 4450 _priorityOrder = Source.EMPTY_ARRAY; | 4554 _priorityOrder = Source.EMPTY_ARRAY; |
| 4451 } | 4555 } |
| 4452 // | 4556 // |
| 4453 // Cap the size of the priority list to being less than the cache size. Fa
ilure to do so can | 4557 // Cap the size of the priority list to being less than the cache size. Fa
ilure to do so can |
| 4454 // result in an infinite loop in performAnalysisTask() because re-caching
one AST structure | 4558 // result in an infinite loop in performAnalysisTask() because re-caching
one AST structure |
| 4455 // can cause another priority source's AST structure to be flushed. | 4559 // can cause another priority source's AST structure to be flushed. |
| 4456 // | 4560 // |
| 4457 int count = Math.min(sources.length, _options.cacheSize - _PRIORITY_ORDER_
SIZE_DELTA); | 4561 int count = Math.min(sources.length, _options.cacheSize - _PRIORITY_ORDER_
SIZE_DELTA); |
| 4458 _priorityOrder = new List<Source>(count); | 4562 _priorityOrder = new List<Source>(count); |
| 4459 for (int i = 0; i < count; i++) { | 4563 for (int i = 0; i < count; i++) { |
| 4460 _priorityOrder[i] = sources[i]; | 4564 _priorityOrder[i] = sources[i]; |
| 4461 } | 4565 } |
| 4462 } | 4566 } |
| 4463 } | 4567 } |
| 4464 | 4568 |
| 4569 @override |
| 4465 void setChangedContents(Source source, String contents, int offset, int oldLen
gth, int newLength) { | 4570 void setChangedContents(Source source, String contents, int offset, int oldLen
gth, int newLength) { |
| 4466 _recentTasks.clear(); | 4571 _recentTasks.clear(); |
| 4467 String originalContents = _contentCache.setContents(source, contents); | 4572 String originalContents = _contentCache.setContents(source, contents); |
| 4468 if (contents != null) { | 4573 if (contents != null) { |
| 4469 if (contents != originalContents) { | 4574 if (contents != originalContents) { |
| 4470 if (_options.incremental) { | 4575 if (_options.incremental) { |
| 4471 _incrementalAnalysisCache = IncrementalAnalysisCache.update(_increment
alAnalysisCache, source, originalContents, contents, offset, oldLength, newLengt
h, _getReadableSourceEntry(source)); | 4576 _incrementalAnalysisCache = IncrementalAnalysisCache.update(_increment
alAnalysisCache, source, originalContents, contents, offset, oldLength, newLengt
h, _getReadableSourceEntry(source)); |
| 4472 } | 4577 } |
| 4473 _sourceChanged(source); | 4578 _sourceChanged(source); |
| 4474 SourceEntry sourceEntry = _cache.get(source); | 4579 SourceEntry sourceEntry = _cache.get(source); |
| 4475 if (sourceEntry != null) { | 4580 if (sourceEntry != null) { |
| 4476 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; | 4581 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; |
| 4477 sourceCopy.modificationTime = _contentCache.getModificationStamp(sourc
e); | 4582 sourceCopy.modificationTime = _contentCache.getModificationStamp(sourc
e); |
| 4478 sourceCopy.setValue(SourceEntry.CONTENT, contents); | 4583 sourceCopy.setValue(SourceEntry.CONTENT, contents); |
| 4479 _cache.put(source, sourceCopy); | 4584 _cache.put(source, sourceCopy); |
| 4480 } | 4585 } |
| 4481 } | 4586 } |
| 4482 } else if (originalContents != null) { | 4587 } else if (originalContents != null) { |
| 4483 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalAna
lysisCache, source); | 4588 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalAna
lysisCache, source); |
| 4484 _sourceChanged(source); | 4589 _sourceChanged(source); |
| 4485 } | 4590 } |
| 4486 } | 4591 } |
| 4487 | 4592 |
| 4593 @override |
| 4488 void setContents(Source source, String contents) { | 4594 void setContents(Source source, String contents) { |
| 4489 _recentTasks.clear(); | 4595 _recentTasks.clear(); |
| 4490 String originalContents = _contentCache.setContents(source, contents); | 4596 String originalContents = _contentCache.setContents(source, contents); |
| 4491 if (contents != null) { | 4597 if (contents != null) { |
| 4492 if (contents != originalContents) { | 4598 if (contents != originalContents) { |
| 4493 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalA
nalysisCache, source); | 4599 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalA
nalysisCache, source); |
| 4494 _sourceChanged(source); | 4600 _sourceChanged(source); |
| 4495 SourceEntry sourceEntry = _cache.get(source); | 4601 SourceEntry sourceEntry = _cache.get(source); |
| 4496 if (sourceEntry != null) { | 4602 if (sourceEntry != null) { |
| 4497 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; | 4603 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; |
| 4498 sourceCopy.modificationTime = _contentCache.getModificationStamp(sourc
e); | 4604 sourceCopy.modificationTime = _contentCache.getModificationStamp(sourc
e); |
| 4499 sourceCopy.setValue(SourceEntry.CONTENT, contents); | 4605 sourceCopy.setValue(SourceEntry.CONTENT, contents); |
| 4500 _cache.put(source, sourceCopy); | 4606 _cache.put(source, sourceCopy); |
| 4501 } | 4607 } |
| 4502 } | 4608 } |
| 4503 } else if (originalContents != null) { | 4609 } else if (originalContents != null) { |
| 4504 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalAna
lysisCache, source); | 4610 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalAna
lysisCache, source); |
| 4505 _sourceChanged(source); | 4611 _sourceChanged(source); |
| 4506 } | 4612 } |
| 4507 } | 4613 } |
| 4508 | 4614 |
| 4615 @override |
| 4509 void set sourceFactory(SourceFactory factory) { | 4616 void set sourceFactory(SourceFactory factory) { |
| 4510 if (identical(_sourceFactory, factory)) { | 4617 if (identical(_sourceFactory, factory)) { |
| 4511 return; | 4618 return; |
| 4512 } else if (factory.context != null) { | 4619 } else if (factory.context != null) { |
| 4513 throw new IllegalStateException("Source factories cannot be shared between
contexts"); | 4620 throw new IllegalStateException("Source factories cannot be shared between
contexts"); |
| 4514 } | 4621 } |
| 4515 if (_sourceFactory != null) { | 4622 if (_sourceFactory != null) { |
| 4516 _sourceFactory.context = null; | 4623 _sourceFactory.context = null; |
| 4517 } | 4624 } |
| 4518 factory.context = this; | 4625 factory.context = this; |
| (...skipping 2766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7285 | 7392 |
| 7286 /** | 7393 /** |
| 7287 * Instances of the class `AnalysisTaskResultRecorder` are used by an analysis c
ontext to | 7394 * Instances of the class `AnalysisTaskResultRecorder` are used by an analysis c
ontext to |
| 7288 * record the results of a task. | 7395 * record the results of a task. |
| 7289 */ | 7396 */ |
| 7290 class AnalysisContextImpl_AnalysisTaskResultRecorder implements AnalysisTaskVisi
tor<SourceEntry> { | 7397 class AnalysisContextImpl_AnalysisTaskResultRecorder implements AnalysisTaskVisi
tor<SourceEntry> { |
| 7291 final AnalysisContextImpl AnalysisContextImpl_this; | 7398 final AnalysisContextImpl AnalysisContextImpl_this; |
| 7292 | 7399 |
| 7293 AnalysisContextImpl_AnalysisTaskResultRecorder(this.AnalysisContextImpl_this); | 7400 AnalysisContextImpl_AnalysisTaskResultRecorder(this.AnalysisContextImpl_this); |
| 7294 | 7401 |
| 7402 @override |
| 7295 DartEntry visitGenerateDartErrorsTask(GenerateDartErrorsTask task) => Analysis
ContextImpl_this._recordGenerateDartErrorsTask(task); | 7403 DartEntry visitGenerateDartErrorsTask(GenerateDartErrorsTask task) => Analysis
ContextImpl_this._recordGenerateDartErrorsTask(task); |
| 7296 | 7404 |
| 7405 @override |
| 7297 DartEntry visitGenerateDartHintsTask(GenerateDartHintsTask task) => AnalysisCo
ntextImpl_this._recordGenerateDartHintsTask(task); | 7406 DartEntry visitGenerateDartHintsTask(GenerateDartHintsTask task) => AnalysisCo
ntextImpl_this._recordGenerateDartHintsTask(task); |
| 7298 | 7407 |
| 7408 @override |
| 7299 SourceEntry visitGetContentTask(GetContentTask task) => AnalysisContextImpl_th
is._recordGetContentsTask(task); | 7409 SourceEntry visitGetContentTask(GetContentTask task) => AnalysisContextImpl_th
is._recordGetContentsTask(task); |
| 7300 | 7410 |
| 7411 @override |
| 7301 DartEntry visitIncrementalAnalysisTask(IncrementalAnalysisTask task) => Analys
isContextImpl_this._recordIncrementalAnalysisTaskResults(task); | 7412 DartEntry visitIncrementalAnalysisTask(IncrementalAnalysisTask task) => Analys
isContextImpl_this._recordIncrementalAnalysisTaskResults(task); |
| 7302 | 7413 |
| 7414 @override |
| 7303 DartEntry visitParseDartTask(ParseDartTask task) => AnalysisContextImpl_this._
recordParseDartTaskResults(task); | 7415 DartEntry visitParseDartTask(ParseDartTask task) => AnalysisContextImpl_this._
recordParseDartTaskResults(task); |
| 7304 | 7416 |
| 7417 @override |
| 7305 HtmlEntry visitParseHtmlTask(ParseHtmlTask task) => AnalysisContextImpl_this._
recordParseHtmlTaskResults(task); | 7418 HtmlEntry visitParseHtmlTask(ParseHtmlTask task) => AnalysisContextImpl_this._
recordParseHtmlTaskResults(task); |
| 7306 | 7419 |
| 7420 @override |
| 7307 HtmlEntry visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemp
lateTask task) => AnalysisContextImpl_this._recordResolveAngularComponentTemplat
eTaskResults(task); | 7421 HtmlEntry visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemp
lateTask task) => AnalysisContextImpl_this._recordResolveAngularComponentTemplat
eTaskResults(task); |
| 7308 | 7422 |
| 7423 @override |
| 7309 HtmlEntry visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task) =
> AnalysisContextImpl_this._recordResolveAngularEntryHtmlTaskResults(task); | 7424 HtmlEntry visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task) =
> AnalysisContextImpl_this._recordResolveAngularEntryHtmlTaskResults(task); |
| 7310 | 7425 |
| 7426 @override |
| 7311 DartEntry visitResolveDartDependenciesTask(ResolveDartDependenciesTask task) =
> AnalysisContextImpl_this._recordResolveDartDependenciesTaskResults(task); | 7427 DartEntry visitResolveDartDependenciesTask(ResolveDartDependenciesTask task) =
> AnalysisContextImpl_this._recordResolveDartDependenciesTaskResults(task); |
| 7312 | 7428 |
| 7429 @override |
| 7313 DartEntry visitResolveDartLibraryTask(ResolveDartLibraryTask task) => Analysis
ContextImpl_this.recordResolveDartLibraryTaskResults(task); | 7430 DartEntry visitResolveDartLibraryTask(ResolveDartLibraryTask task) => Analysis
ContextImpl_this.recordResolveDartLibraryTaskResults(task); |
| 7314 | 7431 |
| 7432 @override |
| 7315 DartEntry visitResolveDartUnitTask(ResolveDartUnitTask task) => AnalysisContex
tImpl_this._recordResolveDartUnitTaskResults(task); | 7433 DartEntry visitResolveDartUnitTask(ResolveDartUnitTask task) => AnalysisContex
tImpl_this._recordResolveDartUnitTaskResults(task); |
| 7316 | 7434 |
| 7435 @override |
| 7317 HtmlEntry visitResolveHtmlTask(ResolveHtmlTask task) => AnalysisContextImpl_th
is._recordResolveHtmlTaskResults(task); | 7436 HtmlEntry visitResolveHtmlTask(ResolveHtmlTask task) => AnalysisContextImpl_th
is._recordResolveHtmlTaskResults(task); |
| 7318 | 7437 |
| 7438 @override |
| 7319 DartEntry visitScanDartTask(ScanDartTask task) => AnalysisContextImpl_this._re
cordScanDartTaskResults(task); | 7439 DartEntry visitScanDartTask(ScanDartTask task) => AnalysisContextImpl_this._re
cordScanDartTaskResults(task); |
| 7320 } | 7440 } |
| 7321 | 7441 |
| 7322 class AnalysisContextImpl_ContextRetentionPolicy implements CacheRetentionPolicy
{ | 7442 class AnalysisContextImpl_ContextRetentionPolicy implements CacheRetentionPolicy
{ |
| 7323 final AnalysisContextImpl AnalysisContextImpl_this; | 7443 final AnalysisContextImpl AnalysisContextImpl_this; |
| 7324 | 7444 |
| 7325 AnalysisContextImpl_ContextRetentionPolicy(this.AnalysisContextImpl_this); | 7445 AnalysisContextImpl_ContextRetentionPolicy(this.AnalysisContextImpl_this); |
| 7326 | 7446 |
| 7447 @override |
| 7327 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) { | 7448 RetentionPriority getAstPriority(Source source, SourceEntry sourceEntry) { |
| 7328 for (Source prioritySource in AnalysisContextImpl_this._priorityOrder) { | 7449 for (Source prioritySource in AnalysisContextImpl_this._priorityOrder) { |
| 7329 if (source == prioritySource) { | 7450 if (source == prioritySource) { |
| 7330 return RetentionPriority.HIGH; | 7451 return RetentionPriority.HIGH; |
| 7331 } | 7452 } |
| 7332 } | 7453 } |
| 7333 if (sourceEntry is DartEntry) { | 7454 if (sourceEntry is DartEntry) { |
| 7334 DartEntry dartEntry = sourceEntry; | 7455 DartEntry dartEntry = sourceEntry; |
| 7335 if (_astIsNeeded(dartEntry)) { | 7456 if (_astIsNeeded(dartEntry)) { |
| 7336 return RetentionPriority.MEDIUM; | 7457 return RetentionPriority.MEDIUM; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7480 * | 7601 * |
| 7481 * @param options the analysis options whose values are being copied | 7602 * @param options the analysis options whose values are being copied |
| 7482 */ | 7603 */ |
| 7483 AnalysisOptionsImpl.con1(AnalysisOptions options) { | 7604 AnalysisOptionsImpl.con1(AnalysisOptions options) { |
| 7484 cacheSize = options.cacheSize; | 7605 cacheSize = options.cacheSize; |
| 7485 dart2jsHint = options.dart2jsHint; | 7606 dart2jsHint = options.dart2jsHint; |
| 7486 hint = options.hint; | 7607 hint = options.hint; |
| 7487 incremental = options.incremental; | 7608 incremental = options.incremental; |
| 7488 } | 7609 } |
| 7489 | 7610 |
| 7611 @override |
| 7490 bool get generateSdkErrors => _generateSdkErrors; | 7612 bool get generateSdkErrors => _generateSdkErrors; |
| 7491 | 7613 |
| 7492 /** | 7614 /** |
| 7493 * Set whether errors, warnings and hints should be generated for sources in t
he SDK to match the | 7615 * Set whether errors, warnings and hints should be generated for sources in t
he SDK to match the |
| 7494 * given value. | 7616 * given value. |
| 7495 * | 7617 * |
| 7496 * @param generate `true` if errors, warnings and hints should be generated fo
r sources in | 7618 * @param generate `true` if errors, warnings and hints should be generated fo
r sources in |
| 7497 * the SDK | 7619 * the SDK |
| 7498 */ | 7620 */ |
| 7499 void set generateSdkErrors(bool generate) { | 7621 void set generateSdkErrors(bool generate) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7539 */ | 7661 */ |
| 7540 static List<ChangeNoticeImpl> EMPTY_ARRAY = new List<ChangeNoticeImpl>(0); | 7662 static List<ChangeNoticeImpl> EMPTY_ARRAY = new List<ChangeNoticeImpl>(0); |
| 7541 | 7663 |
| 7542 /** | 7664 /** |
| 7543 * Initialize a newly created notice associated with the given source. | 7665 * Initialize a newly created notice associated with the given source. |
| 7544 * | 7666 * |
| 7545 * @param source the source for which the change is being reported | 7667 * @param source the source for which the change is being reported |
| 7546 */ | 7668 */ |
| 7547 ChangeNoticeImpl(this.source); | 7669 ChangeNoticeImpl(this.source); |
| 7548 | 7670 |
| 7671 @override |
| 7549 List<AnalysisError> get errors => _errors; | 7672 List<AnalysisError> get errors => _errors; |
| 7550 | 7673 |
| 7674 @override |
| 7551 LineInfo get lineInfo => _lineInfo; | 7675 LineInfo get lineInfo => _lineInfo; |
| 7552 | 7676 |
| 7553 /** | 7677 /** |
| 7554 * Set the errors that changed as a result of the analysis to the given errors
and set the line | 7678 * Set the errors that changed as a result of the analysis to the given errors
and set the line |
| 7555 * information to the given line information. | 7679 * information to the given line information. |
| 7556 * | 7680 * |
| 7557 * @param errors the errors that changed as a result of the analysis | 7681 * @param errors the errors that changed as a result of the analysis |
| 7558 * @param lineInfo the line information associated with the source | 7682 * @param lineInfo the line information associated with the source |
| 7559 */ | 7683 */ |
| 7560 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { | 7684 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { |
| 7561 this._errors = errors; | 7685 this._errors = errors; |
| 7562 this._lineInfo = lineInfo; | 7686 this._lineInfo = lineInfo; |
| 7563 if (lineInfo == null) { | 7687 if (lineInfo == null) { |
| 7564 AnalysisEngine.instance.logger.logInformation2("No line info: ${source}",
new JavaException()); | 7688 AnalysisEngine.instance.logger.logInformation2("No line info: ${source}",
new JavaException()); |
| 7565 } | 7689 } |
| 7566 } | 7690 } |
| 7567 | 7691 |
| 7692 @override |
| 7568 String toString() => "Changes for ${source.fullName}"; | 7693 String toString() => "Changes for ${source.fullName}"; |
| 7569 } | 7694 } |
| 7570 | 7695 |
| 7571 /** | 7696 /** |
| 7572 * Instances of the class `DelegatingAnalysisContextImpl` extend [AnalysisContex
tImpl | 7697 * Instances of the class `DelegatingAnalysisContextImpl` extend [AnalysisContex
tImpl |
| 7573 ] to delegate sources to the appropriate analysis context. For instance, if the | 7698 ] to delegate sources to the appropriate analysis context. For instance, if the |
| 7574 * source is in a system library then the analysis context from the [DartSdk] is
used. | 7699 * source is in a system library then the analysis context from the [DartSdk] is
used. |
| 7575 */ | 7700 */ |
| 7576 class DelegatingAnalysisContextImpl extends AnalysisContextImpl { | 7701 class DelegatingAnalysisContextImpl extends AnalysisContextImpl { |
| 7577 /** | 7702 /** |
| 7578 * This references the [InternalAnalysisContext] held onto by the [DartSdk] wh
ich is | 7703 * This references the [InternalAnalysisContext] held onto by the [DartSdk] wh
ich is |
| 7579 * used (instead of this [AnalysisContext]) for SDK sources. This field is set
when | 7704 * used (instead of this [AnalysisContext]) for SDK sources. This field is set
when |
| 7580 * #setSourceFactory(SourceFactory) is called, and references the analysis con
text in the | 7705 * #setSourceFactory(SourceFactory) is called, and references the analysis con
text in the |
| 7581 * [DartUriResolver] in the [SourceFactory], this analysis context assumes tha
t there | 7706 * [DartUriResolver] in the [SourceFactory], this analysis context assumes tha
t there |
| 7582 * will be such a resolver. | 7707 * will be such a resolver. |
| 7583 */ | 7708 */ |
| 7584 InternalAnalysisContext _sdkAnalysisContext; | 7709 InternalAnalysisContext _sdkAnalysisContext; |
| 7585 | 7710 |
| 7711 @override |
| 7586 void addSourceInfo(Source source, SourceEntry info) { | 7712 void addSourceInfo(Source source, SourceEntry info) { |
| 7587 if (source.isInSystemLibrary) { | 7713 if (source.isInSystemLibrary) { |
| 7588 _sdkAnalysisContext.addSourceInfo(source, info); | 7714 _sdkAnalysisContext.addSourceInfo(source, info); |
| 7589 } else { | 7715 } else { |
| 7590 super.addSourceInfo(source, info); | 7716 super.addSourceInfo(source, info); |
| 7591 } | 7717 } |
| 7592 } | 7718 } |
| 7593 | 7719 |
| 7720 @override |
| 7594 List<AnalysisError> computeErrors(Source source) { | 7721 List<AnalysisError> computeErrors(Source source) { |
| 7595 if (source.isInSystemLibrary) { | 7722 if (source.isInSystemLibrary) { |
| 7596 return _sdkAnalysisContext.computeErrors(source); | 7723 return _sdkAnalysisContext.computeErrors(source); |
| 7597 } else { | 7724 } else { |
| 7598 return super.computeErrors(source); | 7725 return super.computeErrors(source); |
| 7599 } | 7726 } |
| 7600 } | 7727 } |
| 7601 | 7728 |
| 7729 @override |
| 7602 List<Source> computeExportedLibraries(Source source) { | 7730 List<Source> computeExportedLibraries(Source source) { |
| 7603 if (source.isInSystemLibrary) { | 7731 if (source.isInSystemLibrary) { |
| 7604 return _sdkAnalysisContext.computeExportedLibraries(source); | 7732 return _sdkAnalysisContext.computeExportedLibraries(source); |
| 7605 } else { | 7733 } else { |
| 7606 return super.computeExportedLibraries(source); | 7734 return super.computeExportedLibraries(source); |
| 7607 } | 7735 } |
| 7608 } | 7736 } |
| 7609 | 7737 |
| 7738 @override |
| 7610 HtmlElement computeHtmlElement(Source source) { | 7739 HtmlElement computeHtmlElement(Source source) { |
| 7611 if (source.isInSystemLibrary) { | 7740 if (source.isInSystemLibrary) { |
| 7612 return _sdkAnalysisContext.computeHtmlElement(source); | 7741 return _sdkAnalysisContext.computeHtmlElement(source); |
| 7613 } else { | 7742 } else { |
| 7614 return super.computeHtmlElement(source); | 7743 return super.computeHtmlElement(source); |
| 7615 } | 7744 } |
| 7616 } | 7745 } |
| 7617 | 7746 |
| 7747 @override |
| 7618 List<Source> computeImportedLibraries(Source source) { | 7748 List<Source> computeImportedLibraries(Source source) { |
| 7619 if (source.isInSystemLibrary) { | 7749 if (source.isInSystemLibrary) { |
| 7620 return _sdkAnalysisContext.computeImportedLibraries(source); | 7750 return _sdkAnalysisContext.computeImportedLibraries(source); |
| 7621 } else { | 7751 } else { |
| 7622 return super.computeImportedLibraries(source); | 7752 return super.computeImportedLibraries(source); |
| 7623 } | 7753 } |
| 7624 } | 7754 } |
| 7625 | 7755 |
| 7756 @override |
| 7626 SourceKind computeKindOf(Source source) { | 7757 SourceKind computeKindOf(Source source) { |
| 7627 if (source.isInSystemLibrary) { | 7758 if (source.isInSystemLibrary) { |
| 7628 return _sdkAnalysisContext.computeKindOf(source); | 7759 return _sdkAnalysisContext.computeKindOf(source); |
| 7629 } else { | 7760 } else { |
| 7630 return super.computeKindOf(source); | 7761 return super.computeKindOf(source); |
| 7631 } | 7762 } |
| 7632 } | 7763 } |
| 7633 | 7764 |
| 7765 @override |
| 7634 LibraryElement computeLibraryElement(Source source) { | 7766 LibraryElement computeLibraryElement(Source source) { |
| 7635 if (source.isInSystemLibrary) { | 7767 if (source.isInSystemLibrary) { |
| 7636 return _sdkAnalysisContext.computeLibraryElement(source); | 7768 return _sdkAnalysisContext.computeLibraryElement(source); |
| 7637 } else { | 7769 } else { |
| 7638 return super.computeLibraryElement(source); | 7770 return super.computeLibraryElement(source); |
| 7639 } | 7771 } |
| 7640 } | 7772 } |
| 7641 | 7773 |
| 7774 @override |
| 7642 LineInfo computeLineInfo(Source source) { | 7775 LineInfo computeLineInfo(Source source) { |
| 7643 if (source.isInSystemLibrary) { | 7776 if (source.isInSystemLibrary) { |
| 7644 return _sdkAnalysisContext.computeLineInfo(source); | 7777 return _sdkAnalysisContext.computeLineInfo(source); |
| 7645 } else { | 7778 } else { |
| 7646 return super.computeLineInfo(source); | 7779 return super.computeLineInfo(source); |
| 7647 } | 7780 } |
| 7648 } | 7781 } |
| 7649 | 7782 |
| 7783 @override |
| 7650 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) { | 7784 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) { |
| 7651 if (source.isInSystemLibrary) { | 7785 if (source.isInSystemLibrary) { |
| 7652 return _sdkAnalysisContext.computeResolvableCompilationUnit(source); | 7786 return _sdkAnalysisContext.computeResolvableCompilationUnit(source); |
| 7653 } else { | 7787 } else { |
| 7654 return super.computeResolvableCompilationUnit(source); | 7788 return super.computeResolvableCompilationUnit(source); |
| 7655 } | 7789 } |
| 7656 } | 7790 } |
| 7657 | 7791 |
| 7792 @override |
| 7658 AnalysisErrorInfo getErrors(Source source) { | 7793 AnalysisErrorInfo getErrors(Source source) { |
| 7659 if (source.isInSystemLibrary) { | 7794 if (source.isInSystemLibrary) { |
| 7660 return _sdkAnalysisContext.getErrors(source); | 7795 return _sdkAnalysisContext.getErrors(source); |
| 7661 } else { | 7796 } else { |
| 7662 return super.getErrors(source); | 7797 return super.getErrors(source); |
| 7663 } | 7798 } |
| 7664 } | 7799 } |
| 7665 | 7800 |
| 7801 @override |
| 7666 HtmlElement getHtmlElement(Source source) { | 7802 HtmlElement getHtmlElement(Source source) { |
| 7667 if (source.isInSystemLibrary) { | 7803 if (source.isInSystemLibrary) { |
| 7668 return _sdkAnalysisContext.getHtmlElement(source); | 7804 return _sdkAnalysisContext.getHtmlElement(source); |
| 7669 } else { | 7805 } else { |
| 7670 return super.getHtmlElement(source); | 7806 return super.getHtmlElement(source); |
| 7671 } | 7807 } |
| 7672 } | 7808 } |
| 7673 | 7809 |
| 7810 @override |
| 7674 List<Source> getHtmlFilesReferencing(Source source) { | 7811 List<Source> getHtmlFilesReferencing(Source source) { |
| 7675 if (source.isInSystemLibrary) { | 7812 if (source.isInSystemLibrary) { |
| 7676 return _sdkAnalysisContext.getHtmlFilesReferencing(source); | 7813 return _sdkAnalysisContext.getHtmlFilesReferencing(source); |
| 7677 } else { | 7814 } else { |
| 7678 return super.getHtmlFilesReferencing(source); | 7815 return super.getHtmlFilesReferencing(source); |
| 7679 } | 7816 } |
| 7680 } | 7817 } |
| 7681 | 7818 |
| 7819 @override |
| 7682 SourceKind getKindOf(Source source) { | 7820 SourceKind getKindOf(Source source) { |
| 7683 if (source.isInSystemLibrary) { | 7821 if (source.isInSystemLibrary) { |
| 7684 return _sdkAnalysisContext.getKindOf(source); | 7822 return _sdkAnalysisContext.getKindOf(source); |
| 7685 } else { | 7823 } else { |
| 7686 return super.getKindOf(source); | 7824 return super.getKindOf(source); |
| 7687 } | 7825 } |
| 7688 } | 7826 } |
| 7689 | 7827 |
| 7828 @override |
| 7690 List<Source> getLibrariesContaining(Source source) { | 7829 List<Source> getLibrariesContaining(Source source) { |
| 7691 if (source.isInSystemLibrary) { | 7830 if (source.isInSystemLibrary) { |
| 7692 return _sdkAnalysisContext.getLibrariesContaining(source); | 7831 return _sdkAnalysisContext.getLibrariesContaining(source); |
| 7693 } else { | 7832 } else { |
| 7694 return super.getLibrariesContaining(source); | 7833 return super.getLibrariesContaining(source); |
| 7695 } | 7834 } |
| 7696 } | 7835 } |
| 7697 | 7836 |
| 7837 @override |
| 7698 List<Source> getLibrariesDependingOn(Source librarySource) { | 7838 List<Source> getLibrariesDependingOn(Source librarySource) { |
| 7699 if (librarySource.isInSystemLibrary) { | 7839 if (librarySource.isInSystemLibrary) { |
| 7700 return _sdkAnalysisContext.getLibrariesDependingOn(librarySource); | 7840 return _sdkAnalysisContext.getLibrariesDependingOn(librarySource); |
| 7701 } else { | 7841 } else { |
| 7702 return super.getLibrariesDependingOn(librarySource); | 7842 return super.getLibrariesDependingOn(librarySource); |
| 7703 } | 7843 } |
| 7704 } | 7844 } |
| 7705 | 7845 |
| 7846 @override |
| 7706 LibraryElement getLibraryElement(Source source) { | 7847 LibraryElement getLibraryElement(Source source) { |
| 7707 if (source.isInSystemLibrary) { | 7848 if (source.isInSystemLibrary) { |
| 7708 return _sdkAnalysisContext.getLibraryElement(source); | 7849 return _sdkAnalysisContext.getLibraryElement(source); |
| 7709 } else { | 7850 } else { |
| 7710 return super.getLibraryElement(source); | 7851 return super.getLibraryElement(source); |
| 7711 } | 7852 } |
| 7712 } | 7853 } |
| 7713 | 7854 |
| 7855 @override |
| 7714 List<Source> get librarySources => ArrayUtils.addAll(super.librarySources, _sd
kAnalysisContext.librarySources); | 7856 List<Source> get librarySources => ArrayUtils.addAll(super.librarySources, _sd
kAnalysisContext.librarySources); |
| 7715 | 7857 |
| 7858 @override |
| 7716 LineInfo getLineInfo(Source source) { | 7859 LineInfo getLineInfo(Source source) { |
| 7717 if (source.isInSystemLibrary) { | 7860 if (source.isInSystemLibrary) { |
| 7718 return _sdkAnalysisContext.getLineInfo(source); | 7861 return _sdkAnalysisContext.getLineInfo(source); |
| 7719 } else { | 7862 } else { |
| 7720 return super.getLineInfo(source); | 7863 return super.getLineInfo(source); |
| 7721 } | 7864 } |
| 7722 } | 7865 } |
| 7723 | 7866 |
| 7867 @override |
| 7724 Namespace getPublicNamespace(LibraryElement library) { | 7868 Namespace getPublicNamespace(LibraryElement library) { |
| 7725 Source source = library.source; | 7869 Source source = library.source; |
| 7726 if (source.isInSystemLibrary) { | 7870 if (source.isInSystemLibrary) { |
| 7727 return _sdkAnalysisContext.getPublicNamespace(library); | 7871 return _sdkAnalysisContext.getPublicNamespace(library); |
| 7728 } else { | 7872 } else { |
| 7729 return super.getPublicNamespace(library); | 7873 return super.getPublicNamespace(library); |
| 7730 } | 7874 } |
| 7731 } | 7875 } |
| 7732 | 7876 |
| 7877 @override |
| 7733 Namespace getPublicNamespace2(Source source) { | 7878 Namespace getPublicNamespace2(Source source) { |
| 7734 if (source.isInSystemLibrary) { | 7879 if (source.isInSystemLibrary) { |
| 7735 return _sdkAnalysisContext.getPublicNamespace2(source); | 7880 return _sdkAnalysisContext.getPublicNamespace2(source); |
| 7736 } else { | 7881 } else { |
| 7737 return super.getPublicNamespace2(source); | 7882 return super.getPublicNamespace2(source); |
| 7738 } | 7883 } |
| 7739 } | 7884 } |
| 7740 | 7885 |
| 7886 @override |
| 7741 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l
ibrary) { | 7887 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l
ibrary) { |
| 7742 if (unitSource.isInSystemLibrary) { | 7888 if (unitSource.isInSystemLibrary) { |
| 7743 return _sdkAnalysisContext.getResolvedCompilationUnit(unitSource, library)
; | 7889 return _sdkAnalysisContext.getResolvedCompilationUnit(unitSource, library)
; |
| 7744 } else { | 7890 } else { |
| 7745 return super.getResolvedCompilationUnit(unitSource, library); | 7891 return super.getResolvedCompilationUnit(unitSource, library); |
| 7746 } | 7892 } |
| 7747 } | 7893 } |
| 7748 | 7894 |
| 7895 @override |
| 7749 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { | 7896 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { |
| 7750 if (unitSource.isInSystemLibrary) { | 7897 if (unitSource.isInSystemLibrary) { |
| 7751 return _sdkAnalysisContext.getResolvedCompilationUnit2(unitSource, library
Source); | 7898 return _sdkAnalysisContext.getResolvedCompilationUnit2(unitSource, library
Source); |
| 7752 } else { | 7899 } else { |
| 7753 return super.getResolvedCompilationUnit2(unitSource, librarySource); | 7900 return super.getResolvedCompilationUnit2(unitSource, librarySource); |
| 7754 } | 7901 } |
| 7755 } | 7902 } |
| 7756 | 7903 |
| 7904 @override |
| 7757 bool isClientLibrary(Source librarySource) { | 7905 bool isClientLibrary(Source librarySource) { |
| 7758 if (librarySource.isInSystemLibrary) { | 7906 if (librarySource.isInSystemLibrary) { |
| 7759 return _sdkAnalysisContext.isClientLibrary(librarySource); | 7907 return _sdkAnalysisContext.isClientLibrary(librarySource); |
| 7760 } else { | 7908 } else { |
| 7761 return super.isClientLibrary(librarySource); | 7909 return super.isClientLibrary(librarySource); |
| 7762 } | 7910 } |
| 7763 } | 7911 } |
| 7764 | 7912 |
| 7913 @override |
| 7765 bool isServerLibrary(Source librarySource) { | 7914 bool isServerLibrary(Source librarySource) { |
| 7766 if (librarySource.isInSystemLibrary) { | 7915 if (librarySource.isInSystemLibrary) { |
| 7767 return _sdkAnalysisContext.isServerLibrary(librarySource); | 7916 return _sdkAnalysisContext.isServerLibrary(librarySource); |
| 7768 } else { | 7917 } else { |
| 7769 return super.isServerLibrary(librarySource); | 7918 return super.isServerLibrary(librarySource); |
| 7770 } | 7919 } |
| 7771 } | 7920 } |
| 7772 | 7921 |
| 7922 @override |
| 7773 CompilationUnit parseCompilationUnit(Source source) { | 7923 CompilationUnit parseCompilationUnit(Source source) { |
| 7774 if (source.isInSystemLibrary) { | 7924 if (source.isInSystemLibrary) { |
| 7775 return _sdkAnalysisContext.parseCompilationUnit(source); | 7925 return _sdkAnalysisContext.parseCompilationUnit(source); |
| 7776 } else { | 7926 } else { |
| 7777 return super.parseCompilationUnit(source); | 7927 return super.parseCompilationUnit(source); |
| 7778 } | 7928 } |
| 7779 } | 7929 } |
| 7780 | 7930 |
| 7931 @override |
| 7781 ht.HtmlUnit parseHtmlUnit(Source source) { | 7932 ht.HtmlUnit parseHtmlUnit(Source source) { |
| 7782 if (source.isInSystemLibrary) { | 7933 if (source.isInSystemLibrary) { |
| 7783 return _sdkAnalysisContext.parseHtmlUnit(source); | 7934 return _sdkAnalysisContext.parseHtmlUnit(source); |
| 7784 } else { | 7935 } else { |
| 7785 return super.parseHtmlUnit(source); | 7936 return super.parseHtmlUnit(source); |
| 7786 } | 7937 } |
| 7787 } | 7938 } |
| 7788 | 7939 |
| 7940 @override |
| 7789 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { | 7941 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { |
| 7790 if (elementMap.isEmpty) { | 7942 if (elementMap.isEmpty) { |
| 7791 return; | 7943 return; |
| 7792 } | 7944 } |
| 7793 // TODO(jwren) we are making the assumption here that the elementMap will ha
ve sources from only | 7945 // TODO(jwren) we are making the assumption here that the elementMap will ha
ve sources from only |
| 7794 // one library, while this is true with our use of the Analysis Engine, it i
s not required by | 7946 // one library, while this is true with our use of the Analysis Engine, it i
s not required by |
| 7795 // the API, revisit to fix cases where the elementMap can have sources both
in the sdk and other | 7947 // the API, revisit to fix cases where the elementMap can have sources both
in the sdk and other |
| 7796 // libraries | 7948 // libraries |
| 7797 Source source = new JavaIterator(elementMap.keys.toSet()).next(); | 7949 Source source = new JavaIterator(elementMap.keys.toSet()).next(); |
| 7798 if (source.isInSystemLibrary) { | 7950 if (source.isInSystemLibrary) { |
| 7799 _sdkAnalysisContext.recordLibraryElements(elementMap); | 7951 _sdkAnalysisContext.recordLibraryElements(elementMap); |
| 7800 } else { | 7952 } else { |
| 7801 super.recordLibraryElements(elementMap); | 7953 super.recordLibraryElements(elementMap); |
| 7802 } | 7954 } |
| 7803 } | 7955 } |
| 7804 | 7956 |
| 7957 @override |
| 7805 CompilationUnit resolveCompilationUnit(Source source, LibraryElement library)
{ | 7958 CompilationUnit resolveCompilationUnit(Source source, LibraryElement library)
{ |
| 7806 if (source.isInSystemLibrary) { | 7959 if (source.isInSystemLibrary) { |
| 7807 return _sdkAnalysisContext.resolveCompilationUnit(source, library); | 7960 return _sdkAnalysisContext.resolveCompilationUnit(source, library); |
| 7808 } else { | 7961 } else { |
| 7809 return super.resolveCompilationUnit(source, library); | 7962 return super.resolveCompilationUnit(source, library); |
| 7810 } | 7963 } |
| 7811 } | 7964 } |
| 7812 | 7965 |
| 7966 @override |
| 7813 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) { | 7967 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) { |
| 7814 if (unitSource.isInSystemLibrary) { | 7968 if (unitSource.isInSystemLibrary) { |
| 7815 return _sdkAnalysisContext.resolveCompilationUnit2(unitSource, librarySour
ce); | 7969 return _sdkAnalysisContext.resolveCompilationUnit2(unitSource, librarySour
ce); |
| 7816 } else { | 7970 } else { |
| 7817 return super.resolveCompilationUnit2(unitSource, librarySource); | 7971 return super.resolveCompilationUnit2(unitSource, librarySource); |
| 7818 } | 7972 } |
| 7819 } | 7973 } |
| 7820 | 7974 |
| 7975 @override |
| 7821 ht.HtmlUnit resolveHtmlUnit(Source unitSource) { | 7976 ht.HtmlUnit resolveHtmlUnit(Source unitSource) { |
| 7822 if (unitSource.isInSystemLibrary) { | 7977 if (unitSource.isInSystemLibrary) { |
| 7823 return _sdkAnalysisContext.resolveHtmlUnit(unitSource); | 7978 return _sdkAnalysisContext.resolveHtmlUnit(unitSource); |
| 7824 } else { | 7979 } else { |
| 7825 return super.resolveHtmlUnit(unitSource); | 7980 return super.resolveHtmlUnit(unitSource); |
| 7826 } | 7981 } |
| 7827 } | 7982 } |
| 7828 | 7983 |
| 7984 @override |
| 7829 void setChangedContents(Source source, String contents, int offset, int oldLen
gth, int newLength) { | 7985 void setChangedContents(Source source, String contents, int offset, int oldLen
gth, int newLength) { |
| 7830 if (source.isInSystemLibrary) { | 7986 if (source.isInSystemLibrary) { |
| 7831 _sdkAnalysisContext.setChangedContents(source, contents, offset, oldLength
, newLength); | 7987 _sdkAnalysisContext.setChangedContents(source, contents, offset, oldLength
, newLength); |
| 7832 } else { | 7988 } else { |
| 7833 super.setChangedContents(source, contents, offset, oldLength, newLength); | 7989 super.setChangedContents(source, contents, offset, oldLength, newLength); |
| 7834 } | 7990 } |
| 7835 } | 7991 } |
| 7836 | 7992 |
| 7993 @override |
| 7837 void setContents(Source source, String contents) { | 7994 void setContents(Source source, String contents) { |
| 7838 if (source.isInSystemLibrary) { | 7995 if (source.isInSystemLibrary) { |
| 7839 _sdkAnalysisContext.setContents(source, contents); | 7996 _sdkAnalysisContext.setContents(source, contents); |
| 7840 } else { | 7997 } else { |
| 7841 super.setContents(source, contents); | 7998 super.setContents(source, contents); |
| 7842 } | 7999 } |
| 7843 } | 8000 } |
| 7844 | 8001 |
| 8002 @override |
| 7845 void set sourceFactory(SourceFactory factory) { | 8003 void set sourceFactory(SourceFactory factory) { |
| 7846 super.sourceFactory = factory; | 8004 super.sourceFactory = factory; |
| 7847 DartSdk sdk = factory.dartSdk; | 8005 DartSdk sdk = factory.dartSdk; |
| 7848 if (sdk != null) { | 8006 if (sdk != null) { |
| 7849 _sdkAnalysisContext = sdk.context as InternalAnalysisContext; | 8007 _sdkAnalysisContext = sdk.context as InternalAnalysisContext; |
| 7850 if (_sdkAnalysisContext is DelegatingAnalysisContextImpl) { | 8008 if (_sdkAnalysisContext is DelegatingAnalysisContextImpl) { |
| 7851 _sdkAnalysisContext = null; | 8009 _sdkAnalysisContext = null; |
| 7852 throw new IllegalStateException("The context provided by an SDK cannot i
tself be a delegating analysis context"); | 8010 throw new IllegalStateException("The context provided by an SDK cannot i
tself be a delegating analysis context"); |
| 7853 } | 8011 } |
| 7854 } else { | 8012 } else { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8073 /** | 8231 /** |
| 8074 * Create a new [InstrumentedAnalysisContextImpl] with a specified basis conte
xt, aka the | 8232 * Create a new [InstrumentedAnalysisContextImpl] with a specified basis conte
xt, aka the |
| 8075 * context to wrap and instrument. | 8233 * context to wrap and instrument. |
| 8076 * | 8234 * |
| 8077 * @param context some [InstrumentedAnalysisContext] to wrap and instrument | 8235 * @param context some [InstrumentedAnalysisContext] to wrap and instrument |
| 8078 */ | 8236 */ |
| 8079 InstrumentedAnalysisContextImpl.con1(InternalAnalysisContext context) { | 8237 InstrumentedAnalysisContextImpl.con1(InternalAnalysisContext context) { |
| 8080 _basis = context; | 8238 _basis = context; |
| 8081 } | 8239 } |
| 8082 | 8240 |
| 8241 @override |
| 8083 void addSourceInfo(Source source, SourceEntry info) { | 8242 void addSourceInfo(Source source, SourceEntry info) { |
| 8084 _basis.addSourceInfo(source, info); | 8243 _basis.addSourceInfo(source, info); |
| 8085 } | 8244 } |
| 8086 | 8245 |
| 8246 @override |
| 8087 void applyChanges(ChangeSet changeSet) { | 8247 void applyChanges(ChangeSet changeSet) { |
| 8088 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
applyChanges"); | 8248 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
applyChanges"); |
| 8089 _checkThread(instrumentation); | 8249 _checkThread(instrumentation); |
| 8090 try { | 8250 try { |
| 8091 instrumentation.metric3("contextId", _contextId); | 8251 instrumentation.metric3("contextId", _contextId); |
| 8092 _basis.applyChanges(changeSet); | 8252 _basis.applyChanges(changeSet); |
| 8093 } finally { | 8253 } finally { |
| 8094 instrumentation.log(); | 8254 instrumentation.log(); |
| 8095 } | 8255 } |
| 8096 } | 8256 } |
| 8097 | 8257 |
| 8258 @override |
| 8098 String computeDocumentationComment(Element element) { | 8259 String computeDocumentationComment(Element element) { |
| 8099 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeDocumentationComment"); | 8260 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeDocumentationComment"); |
| 8100 _checkThread(instrumentation); | 8261 _checkThread(instrumentation); |
| 8101 try { | 8262 try { |
| 8102 instrumentation.metric3("contextId", _contextId); | 8263 instrumentation.metric3("contextId", _contextId); |
| 8103 return _basis.computeDocumentationComment(element); | 8264 return _basis.computeDocumentationComment(element); |
| 8104 } finally { | 8265 } finally { |
| 8105 instrumentation.log(); | 8266 instrumentation.log(); |
| 8106 } | 8267 } |
| 8107 } | 8268 } |
| 8108 | 8269 |
| 8270 @override |
| 8109 List<AnalysisError> computeErrors(Source source) { | 8271 List<AnalysisError> computeErrors(Source source) { |
| 8110 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeErrors"); | 8272 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeErrors"); |
| 8111 _checkThread(instrumentation); | 8273 _checkThread(instrumentation); |
| 8112 try { | 8274 try { |
| 8113 instrumentation.metric3("contextId", _contextId); | 8275 instrumentation.metric3("contextId", _contextId); |
| 8114 List<AnalysisError> errors = _basis.computeErrors(source); | 8276 List<AnalysisError> errors = _basis.computeErrors(source); |
| 8115 instrumentation.metric2("Errors-count", errors.length); | 8277 instrumentation.metric2("Errors-count", errors.length); |
| 8116 return errors; | 8278 return errors; |
| 8117 } finally { | 8279 } finally { |
| 8118 instrumentation.log(); | 8280 instrumentation.log(); |
| 8119 } | 8281 } |
| 8120 } | 8282 } |
| 8121 | 8283 |
| 8284 @override |
| 8122 List<Source> computeExportedLibraries(Source source) => _basis.computeExported
Libraries(source); | 8285 List<Source> computeExportedLibraries(Source source) => _basis.computeExported
Libraries(source); |
| 8123 | 8286 |
| 8287 @override |
| 8124 HtmlElement computeHtmlElement(Source source) { | 8288 HtmlElement computeHtmlElement(Source source) { |
| 8125 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeHtmlElement"); | 8289 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeHtmlElement"); |
| 8126 _checkThread(instrumentation); | 8290 _checkThread(instrumentation); |
| 8127 try { | 8291 try { |
| 8128 instrumentation.metric3("contextId", _contextId); | 8292 instrumentation.metric3("contextId", _contextId); |
| 8129 return _basis.computeHtmlElement(source); | 8293 return _basis.computeHtmlElement(source); |
| 8130 } on AnalysisException catch (e) { | 8294 } on AnalysisException catch (e) { |
| 8131 _recordAnalysisException(instrumentation, e); | 8295 _recordAnalysisException(instrumentation, e); |
| 8132 throw e; | 8296 throw e; |
| 8133 } finally { | 8297 } finally { |
| 8134 instrumentation.log(); | 8298 instrumentation.log(); |
| 8135 } | 8299 } |
| 8136 } | 8300 } |
| 8137 | 8301 |
| 8302 @override |
| 8138 List<Source> computeImportedLibraries(Source source) => _basis.computeImported
Libraries(source); | 8303 List<Source> computeImportedLibraries(Source source) => _basis.computeImported
Libraries(source); |
| 8139 | 8304 |
| 8305 @override |
| 8140 SourceKind computeKindOf(Source source) { | 8306 SourceKind computeKindOf(Source source) { |
| 8141 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeKindOf"); | 8307 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeKindOf"); |
| 8142 _checkThread(instrumentation); | 8308 _checkThread(instrumentation); |
| 8143 try { | 8309 try { |
| 8144 instrumentation.metric3("contextId", _contextId); | 8310 instrumentation.metric3("contextId", _contextId); |
| 8145 return _basis.computeKindOf(source); | 8311 return _basis.computeKindOf(source); |
| 8146 } finally { | 8312 } finally { |
| 8147 instrumentation.log(); | 8313 instrumentation.log(); |
| 8148 } | 8314 } |
| 8149 } | 8315 } |
| 8150 | 8316 |
| 8317 @override |
| 8151 LibraryElement computeLibraryElement(Source source) { | 8318 LibraryElement computeLibraryElement(Source source) { |
| 8152 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeLibraryElement"); | 8319 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeLibraryElement"); |
| 8153 _checkThread(instrumentation); | 8320 _checkThread(instrumentation); |
| 8154 try { | 8321 try { |
| 8155 instrumentation.metric3("contextId", _contextId); | 8322 instrumentation.metric3("contextId", _contextId); |
| 8156 return _basis.computeLibraryElement(source); | 8323 return _basis.computeLibraryElement(source); |
| 8157 } on AnalysisException catch (e) { | 8324 } on AnalysisException catch (e) { |
| 8158 _recordAnalysisException(instrumentation, e); | 8325 _recordAnalysisException(instrumentation, e); |
| 8159 throw e; | 8326 throw e; |
| 8160 } finally { | 8327 } finally { |
| 8161 instrumentation.log(); | 8328 instrumentation.log(); |
| 8162 } | 8329 } |
| 8163 } | 8330 } |
| 8164 | 8331 |
| 8332 @override |
| 8165 LineInfo computeLineInfo(Source source) { | 8333 LineInfo computeLineInfo(Source source) { |
| 8166 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeLineInfo"); | 8334 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeLineInfo"); |
| 8167 _checkThread(instrumentation); | 8335 _checkThread(instrumentation); |
| 8168 try { | 8336 try { |
| 8169 instrumentation.metric3("contextId", _contextId); | 8337 instrumentation.metric3("contextId", _contextId); |
| 8170 return _basis.computeLineInfo(source); | 8338 return _basis.computeLineInfo(source); |
| 8171 } on AnalysisException catch (e) { | 8339 } on AnalysisException catch (e) { |
| 8172 _recordAnalysisException(instrumentation, e); | 8340 _recordAnalysisException(instrumentation, e); |
| 8173 throw e; | 8341 throw e; |
| 8174 } finally { | 8342 } finally { |
| 8175 instrumentation.log(); | 8343 instrumentation.log(); |
| 8176 } | 8344 } |
| 8177 } | 8345 } |
| 8178 | 8346 |
| 8347 @override |
| 8179 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) => _
basis.computeResolvableCompilationUnit(source); | 8348 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) => _
basis.computeResolvableCompilationUnit(source); |
| 8180 | 8349 |
| 8350 @override |
| 8181 void dispose() { | 8351 void dispose() { |
| 8182 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
dispose"); | 8352 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
dispose"); |
| 8183 _checkThread(instrumentation); | 8353 _checkThread(instrumentation); |
| 8184 try { | 8354 try { |
| 8185 instrumentation.metric3("contextId", _contextId); | 8355 instrumentation.metric3("contextId", _contextId); |
| 8186 _basis.dispose(); | 8356 _basis.dispose(); |
| 8187 } finally { | 8357 } finally { |
| 8188 instrumentation.log(); | 8358 instrumentation.log(); |
| 8189 } | 8359 } |
| 8190 } | 8360 } |
| 8191 | 8361 |
| 8362 @override |
| 8192 bool exists(Source source) { | 8363 bool exists(Source source) { |
| 8193 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
exists"); | 8364 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
exists"); |
| 8194 _checkThread(instrumentation); | 8365 _checkThread(instrumentation); |
| 8195 try { | 8366 try { |
| 8196 instrumentation.metric3("contextId", _contextId); | 8367 instrumentation.metric3("contextId", _contextId); |
| 8197 return _basis.exists(source); | 8368 return _basis.exists(source); |
| 8198 } finally { | 8369 } finally { |
| 8199 instrumentation.log(); | 8370 instrumentation.log(); |
| 8200 } | 8371 } |
| 8201 } | 8372 } |
| 8202 | 8373 |
| 8374 @override |
| 8203 AnalysisContext extractContext(SourceContainer container) { | 8375 AnalysisContext extractContext(SourceContainer container) { |
| 8204 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
extractContext"); | 8376 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
extractContext"); |
| 8205 _checkThread(instrumentation); | 8377 _checkThread(instrumentation); |
| 8206 try { | 8378 try { |
| 8207 instrumentation.metric3("contextId", _contextId); | 8379 instrumentation.metric3("contextId", _contextId); |
| 8208 InstrumentedAnalysisContextImpl newContext = new InstrumentedAnalysisConte
xtImpl(); | 8380 InstrumentedAnalysisContextImpl newContext = new InstrumentedAnalysisConte
xtImpl(); |
| 8209 _basis.extractContextInto(container, newContext._basis); | 8381 _basis.extractContextInto(container, newContext._basis); |
| 8210 return newContext; | 8382 return newContext; |
| 8211 } finally { | 8383 } finally { |
| 8212 instrumentation.log(); | 8384 instrumentation.log(); |
| 8213 } | 8385 } |
| 8214 } | 8386 } |
| 8215 | 8387 |
| 8388 @override |
| 8216 InternalAnalysisContext extractContextInto(SourceContainer container, Internal
AnalysisContext newContext) => _basis.extractContextInto(container, newContext); | 8389 InternalAnalysisContext extractContextInto(SourceContainer container, Internal
AnalysisContext newContext) => _basis.extractContextInto(container, newContext); |
| 8217 | 8390 |
| 8391 @override |
| 8218 AnalysisOptions get analysisOptions { | 8392 AnalysisOptions get analysisOptions { |
| 8219 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getAnalysisOptions"); | 8393 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getAnalysisOptions"); |
| 8220 _checkThread(instrumentation); | 8394 _checkThread(instrumentation); |
| 8221 try { | 8395 try { |
| 8222 instrumentation.metric3("contextId", _contextId); | 8396 instrumentation.metric3("contextId", _contextId); |
| 8223 return _basis.analysisOptions; | 8397 return _basis.analysisOptions; |
| 8224 } finally { | 8398 } finally { |
| 8225 instrumentation.log(); | 8399 instrumentation.log(); |
| 8226 } | 8400 } |
| 8227 } | 8401 } |
| 8228 | 8402 |
| 8229 /** | 8403 /** |
| 8230 * @return the underlying [AnalysisContext]. | 8404 * @return the underlying [AnalysisContext]. |
| 8231 */ | 8405 */ |
| 8232 AnalysisContext get basis => _basis; | 8406 AnalysisContext get basis => _basis; |
| 8233 | 8407 |
| 8408 @override |
| 8234 CompilationUnitElement getCompilationUnitElement(Source unitSource, Source lib
rarySource) { | 8409 CompilationUnitElement getCompilationUnitElement(Source unitSource, Source lib
rarySource) { |
| 8235 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getCompilationUnitElement"); | 8410 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getCompilationUnitElement"); |
| 8236 _checkThread(instrumentation); | 8411 _checkThread(instrumentation); |
| 8237 try { | 8412 try { |
| 8238 instrumentation.metric3("contextId", _contextId); | 8413 instrumentation.metric3("contextId", _contextId); |
| 8239 return _basis.getCompilationUnitElement(unitSource, librarySource); | 8414 return _basis.getCompilationUnitElement(unitSource, librarySource); |
| 8240 } finally { | 8415 } finally { |
| 8241 instrumentation.log(); | 8416 instrumentation.log(); |
| 8242 } | 8417 } |
| 8243 } | 8418 } |
| 8244 | 8419 |
| 8420 @override |
| 8245 TimestampedData<String> getContents(Source source) => _basis.getContents(sourc
e); | 8421 TimestampedData<String> getContents(Source source) => _basis.getContents(sourc
e); |
| 8246 | 8422 |
| 8423 @override |
| 8247 Element getElement(ElementLocation location) { | 8424 Element getElement(ElementLocation location) { |
| 8248 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getElement"); | 8425 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getElement"); |
| 8249 _checkThread(instrumentation); | 8426 _checkThread(instrumentation); |
| 8250 try { | 8427 try { |
| 8251 instrumentation.metric3("contextId", _contextId); | 8428 instrumentation.metric3("contextId", _contextId); |
| 8252 return _basis.getElement(location); | 8429 return _basis.getElement(location); |
| 8253 } finally { | 8430 } finally { |
| 8254 instrumentation.log(); | 8431 instrumentation.log(); |
| 8255 } | 8432 } |
| 8256 } | 8433 } |
| 8257 | 8434 |
| 8435 @override |
| 8258 AnalysisErrorInfo getErrors(Source source) { | 8436 AnalysisErrorInfo getErrors(Source source) { |
| 8259 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getErrors"); | 8437 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getErrors"); |
| 8260 _checkThread(instrumentation); | 8438 _checkThread(instrumentation); |
| 8261 try { | 8439 try { |
| 8262 instrumentation.metric3("contextId", _contextId); | 8440 instrumentation.metric3("contextId", _contextId); |
| 8263 AnalysisErrorInfo ret = _basis.getErrors(source); | 8441 AnalysisErrorInfo ret = _basis.getErrors(source); |
| 8264 if (ret != null) { | 8442 if (ret != null) { |
| 8265 instrumentation.metric2("Errors-count", ret.errors.length); | 8443 instrumentation.metric2("Errors-count", ret.errors.length); |
| 8266 } | 8444 } |
| 8267 return ret; | 8445 return ret; |
| 8268 } finally { | 8446 } finally { |
| 8269 instrumentation.log(); | 8447 instrumentation.log(); |
| 8270 } | 8448 } |
| 8271 } | 8449 } |
| 8272 | 8450 |
| 8451 @override |
| 8273 HtmlElement getHtmlElement(Source source) { | 8452 HtmlElement getHtmlElement(Source source) { |
| 8274 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getHtmlElement"); | 8453 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getHtmlElement"); |
| 8275 _checkThread(instrumentation); | 8454 _checkThread(instrumentation); |
| 8276 try { | 8455 try { |
| 8277 instrumentation.metric3("contextId", _contextId); | 8456 instrumentation.metric3("contextId", _contextId); |
| 8278 return _basis.getHtmlElement(source); | 8457 return _basis.getHtmlElement(source); |
| 8279 } finally { | 8458 } finally { |
| 8280 instrumentation.log(); | 8459 instrumentation.log(); |
| 8281 } | 8460 } |
| 8282 } | 8461 } |
| 8283 | 8462 |
| 8463 @override |
| 8284 List<Source> getHtmlFilesReferencing(Source source) { | 8464 List<Source> getHtmlFilesReferencing(Source source) { |
| 8285 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getHtmlFilesReferencing"); | 8465 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getHtmlFilesReferencing"); |
| 8286 _checkThread(instrumentation); | 8466 _checkThread(instrumentation); |
| 8287 try { | 8467 try { |
| 8288 instrumentation.metric3("contextId", _contextId); | 8468 instrumentation.metric3("contextId", _contextId); |
| 8289 List<Source> ret = _basis.getHtmlFilesReferencing(source); | 8469 List<Source> ret = _basis.getHtmlFilesReferencing(source); |
| 8290 if (ret != null) { | 8470 if (ret != null) { |
| 8291 instrumentation.metric2("Source-count", ret.length); | 8471 instrumentation.metric2("Source-count", ret.length); |
| 8292 } | 8472 } |
| 8293 return ret; | 8473 return ret; |
| 8294 } finally { | 8474 } finally { |
| 8295 instrumentation.log(); | 8475 instrumentation.log(); |
| 8296 } | 8476 } |
| 8297 } | 8477 } |
| 8298 | 8478 |
| 8479 @override |
| 8299 List<Source> get htmlSources { | 8480 List<Source> get htmlSources { |
| 8300 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getHtmlSources"); | 8481 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getHtmlSources"); |
| 8301 _checkThread(instrumentation); | 8482 _checkThread(instrumentation); |
| 8302 try { | 8483 try { |
| 8303 instrumentation.metric3("contextId", _contextId); | 8484 instrumentation.metric3("contextId", _contextId); |
| 8304 List<Source> ret = _basis.htmlSources; | 8485 List<Source> ret = _basis.htmlSources; |
| 8305 if (ret != null) { | 8486 if (ret != null) { |
| 8306 instrumentation.metric2("Source-count", ret.length); | 8487 instrumentation.metric2("Source-count", ret.length); |
| 8307 } | 8488 } |
| 8308 return ret; | 8489 return ret; |
| 8309 } finally { | 8490 } finally { |
| 8310 instrumentation.log(); | 8491 instrumentation.log(); |
| 8311 } | 8492 } |
| 8312 } | 8493 } |
| 8313 | 8494 |
| 8495 @override |
| 8314 SourceKind getKindOf(Source source) { | 8496 SourceKind getKindOf(Source source) { |
| 8315 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getKindOf"); | 8497 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getKindOf"); |
| 8316 _checkThread(instrumentation); | 8498 _checkThread(instrumentation); |
| 8317 try { | 8499 try { |
| 8318 instrumentation.metric3("contextId", _contextId); | 8500 instrumentation.metric3("contextId", _contextId); |
| 8319 return _basis.getKindOf(source); | 8501 return _basis.getKindOf(source); |
| 8320 } finally { | 8502 } finally { |
| 8321 instrumentation.log(); | 8503 instrumentation.log(); |
| 8322 } | 8504 } |
| 8323 } | 8505 } |
| 8324 | 8506 |
| 8507 @override |
| 8325 List<Source> get launchableClientLibrarySources { | 8508 List<Source> get launchableClientLibrarySources { |
| 8326 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLaunchableClientLibrarySources"); | 8509 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLaunchableClientLibrarySources"); |
| 8327 _checkThread(instrumentation); | 8510 _checkThread(instrumentation); |
| 8328 try { | 8511 try { |
| 8329 instrumentation.metric3("contextId", _contextId); | 8512 instrumentation.metric3("contextId", _contextId); |
| 8330 List<Source> ret = _basis.launchableClientLibrarySources; | 8513 List<Source> ret = _basis.launchableClientLibrarySources; |
| 8331 if (ret != null) { | 8514 if (ret != null) { |
| 8332 instrumentation.metric2("Source-count", ret.length); | 8515 instrumentation.metric2("Source-count", ret.length); |
| 8333 } | 8516 } |
| 8334 return ret; | 8517 return ret; |
| 8335 } finally { | 8518 } finally { |
| 8336 instrumentation.log(); | 8519 instrumentation.log(); |
| 8337 } | 8520 } |
| 8338 } | 8521 } |
| 8339 | 8522 |
| 8523 @override |
| 8340 List<Source> get launchableServerLibrarySources { | 8524 List<Source> get launchableServerLibrarySources { |
| 8341 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLaunchableServerLibrarySources"); | 8525 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLaunchableServerLibrarySources"); |
| 8342 _checkThread(instrumentation); | 8526 _checkThread(instrumentation); |
| 8343 try { | 8527 try { |
| 8344 instrumentation.metric3("contextId", _contextId); | 8528 instrumentation.metric3("contextId", _contextId); |
| 8345 List<Source> ret = _basis.launchableServerLibrarySources; | 8529 List<Source> ret = _basis.launchableServerLibrarySources; |
| 8346 if (ret != null) { | 8530 if (ret != null) { |
| 8347 instrumentation.metric2("Source-count", ret.length); | 8531 instrumentation.metric2("Source-count", ret.length); |
| 8348 } | 8532 } |
| 8349 return ret; | 8533 return ret; |
| 8350 } finally { | 8534 } finally { |
| 8351 instrumentation.log(); | 8535 instrumentation.log(); |
| 8352 } | 8536 } |
| 8353 } | 8537 } |
| 8354 | 8538 |
| 8539 @override |
| 8355 List<Source> getLibrariesContaining(Source source) { | 8540 List<Source> getLibrariesContaining(Source source) { |
| 8356 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLibrariesContaining"); | 8541 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLibrariesContaining"); |
| 8357 _checkThread(instrumentation); | 8542 _checkThread(instrumentation); |
| 8358 try { | 8543 try { |
| 8359 instrumentation.metric3("contextId", _contextId); | 8544 instrumentation.metric3("contextId", _contextId); |
| 8360 List<Source> ret = _basis.getLibrariesContaining(source); | 8545 List<Source> ret = _basis.getLibrariesContaining(source); |
| 8361 if (ret != null) { | 8546 if (ret != null) { |
| 8362 instrumentation.metric2("Source-count", ret.length); | 8547 instrumentation.metric2("Source-count", ret.length); |
| 8363 } | 8548 } |
| 8364 return ret; | 8549 return ret; |
| 8365 } finally { | 8550 } finally { |
| 8366 instrumentation.log2(2); | 8551 instrumentation.log2(2); |
| 8367 } | 8552 } |
| 8368 } | 8553 } |
| 8369 | 8554 |
| 8555 @override |
| 8370 List<Source> getLibrariesDependingOn(Source librarySource) { | 8556 List<Source> getLibrariesDependingOn(Source librarySource) { |
| 8371 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLibrariesDependingOn"); | 8557 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLibrariesDependingOn"); |
| 8372 _checkThread(instrumentation); | 8558 _checkThread(instrumentation); |
| 8373 try { | 8559 try { |
| 8374 instrumentation.metric3("contextId", _contextId); | 8560 instrumentation.metric3("contextId", _contextId); |
| 8375 List<Source> ret = _basis.getLibrariesDependingOn(librarySource); | 8561 List<Source> ret = _basis.getLibrariesDependingOn(librarySource); |
| 8376 if (ret != null) { | 8562 if (ret != null) { |
| 8377 instrumentation.metric2("Source-count", ret.length); | 8563 instrumentation.metric2("Source-count", ret.length); |
| 8378 } | 8564 } |
| 8379 return ret; | 8565 return ret; |
| 8380 } finally { | 8566 } finally { |
| 8381 instrumentation.log(); | 8567 instrumentation.log(); |
| 8382 } | 8568 } |
| 8383 } | 8569 } |
| 8384 | 8570 |
| 8571 @override |
| 8385 LibraryElement getLibraryElement(Source source) { | 8572 LibraryElement getLibraryElement(Source source) { |
| 8386 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLibraryElement"); | 8573 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLibraryElement"); |
| 8387 _checkThread(instrumentation); | 8574 _checkThread(instrumentation); |
| 8388 try { | 8575 try { |
| 8389 instrumentation.metric3("contextId", _contextId); | 8576 instrumentation.metric3("contextId", _contextId); |
| 8390 return _basis.getLibraryElement(source); | 8577 return _basis.getLibraryElement(source); |
| 8391 } finally { | 8578 } finally { |
| 8392 instrumentation.log(); | 8579 instrumentation.log(); |
| 8393 } | 8580 } |
| 8394 } | 8581 } |
| 8395 | 8582 |
| 8583 @override |
| 8396 List<Source> get librarySources { | 8584 List<Source> get librarySources { |
| 8397 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLibrarySources"); | 8585 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLibrarySources"); |
| 8398 _checkThread(instrumentation); | 8586 _checkThread(instrumentation); |
| 8399 try { | 8587 try { |
| 8400 instrumentation.metric3("contextId", _contextId); | 8588 instrumentation.metric3("contextId", _contextId); |
| 8401 List<Source> ret = _basis.librarySources; | 8589 List<Source> ret = _basis.librarySources; |
| 8402 if (ret != null) { | 8590 if (ret != null) { |
| 8403 instrumentation.metric2("Source-count", ret.length); | 8591 instrumentation.metric2("Source-count", ret.length); |
| 8404 } | 8592 } |
| 8405 return ret; | 8593 return ret; |
| 8406 } finally { | 8594 } finally { |
| 8407 instrumentation.log(); | 8595 instrumentation.log(); |
| 8408 } | 8596 } |
| 8409 } | 8597 } |
| 8410 | 8598 |
| 8599 @override |
| 8411 LineInfo getLineInfo(Source source) { | 8600 LineInfo getLineInfo(Source source) { |
| 8412 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLineInfo"); | 8601 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getLineInfo"); |
| 8413 _checkThread(instrumentation); | 8602 _checkThread(instrumentation); |
| 8414 try { | 8603 try { |
| 8415 instrumentation.metric3("contextId", _contextId); | 8604 instrumentation.metric3("contextId", _contextId); |
| 8416 return _basis.getLineInfo(source); | 8605 return _basis.getLineInfo(source); |
| 8417 } finally { | 8606 } finally { |
| 8418 instrumentation.log(); | 8607 instrumentation.log(); |
| 8419 } | 8608 } |
| 8420 } | 8609 } |
| 8421 | 8610 |
| 8611 @override |
| 8422 int getModificationStamp(Source source) { | 8612 int getModificationStamp(Source source) { |
| 8423 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getModificationStamp"); | 8613 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getModificationStamp"); |
| 8424 _checkThread(instrumentation); | 8614 _checkThread(instrumentation); |
| 8425 try { | 8615 try { |
| 8426 instrumentation.metric3("contextId", _contextId); | 8616 instrumentation.metric3("contextId", _contextId); |
| 8427 return _basis.getModificationStamp(source); | 8617 return _basis.getModificationStamp(source); |
| 8428 } finally { | 8618 } finally { |
| 8429 instrumentation.log(); | 8619 instrumentation.log(); |
| 8430 } | 8620 } |
| 8431 } | 8621 } |
| 8432 | 8622 |
| 8623 @override |
| 8433 Namespace getPublicNamespace(LibraryElement library) => _basis.getPublicNamesp
ace(library); | 8624 Namespace getPublicNamespace(LibraryElement library) => _basis.getPublicNamesp
ace(library); |
| 8434 | 8625 |
| 8626 @override |
| 8435 Namespace getPublicNamespace2(Source source) => _basis.getPublicNamespace2(sou
rce); | 8627 Namespace getPublicNamespace2(Source source) => _basis.getPublicNamespace2(sou
rce); |
| 8436 | 8628 |
| 8629 @override |
| 8437 List<Source> get refactoringUnsafeSources { | 8630 List<Source> get refactoringUnsafeSources { |
| 8438 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getRefactoringUnsafeSources"); | 8631 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getRefactoringUnsafeSources"); |
| 8439 _checkThread(instrumentation); | 8632 _checkThread(instrumentation); |
| 8440 try { | 8633 try { |
| 8441 instrumentation.metric3("contextId", _contextId); | 8634 instrumentation.metric3("contextId", _contextId); |
| 8442 return _basis.refactoringUnsafeSources; | 8635 return _basis.refactoringUnsafeSources; |
| 8443 } finally { | 8636 } finally { |
| 8444 instrumentation.log(); | 8637 instrumentation.log(); |
| 8445 } | 8638 } |
| 8446 } | 8639 } |
| 8447 | 8640 |
| 8641 @override |
| 8448 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l
ibrary) { | 8642 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l
ibrary) { |
| 8449 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getResolvedCompilationUnit"); | 8643 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getResolvedCompilationUnit"); |
| 8450 _checkThread(instrumentation); | 8644 _checkThread(instrumentation); |
| 8451 try { | 8645 try { |
| 8452 instrumentation.metric3("contextId", _contextId); | 8646 instrumentation.metric3("contextId", _contextId); |
| 8453 return _basis.getResolvedCompilationUnit(unitSource, library); | 8647 return _basis.getResolvedCompilationUnit(unitSource, library); |
| 8454 } finally { | 8648 } finally { |
| 8455 instrumentation.log(); | 8649 instrumentation.log(); |
| 8456 } | 8650 } |
| 8457 } | 8651 } |
| 8458 | 8652 |
| 8653 @override |
| 8459 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { | 8654 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { |
| 8460 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getResolvedCompilationUnit"); | 8655 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getResolvedCompilationUnit"); |
| 8461 _checkThread(instrumentation); | 8656 _checkThread(instrumentation); |
| 8462 try { | 8657 try { |
| 8463 instrumentation.metric3("contextId", _contextId); | 8658 instrumentation.metric3("contextId", _contextId); |
| 8464 return _basis.getResolvedCompilationUnit2(unitSource, librarySource); | 8659 return _basis.getResolvedCompilationUnit2(unitSource, librarySource); |
| 8465 } finally { | 8660 } finally { |
| 8466 instrumentation.log2(2); | 8661 instrumentation.log2(2); |
| 8467 } | 8662 } |
| 8468 } | 8663 } |
| 8469 | 8664 |
| 8665 @override |
| 8470 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) { | 8666 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource) { |
| 8471 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getResolvedHtmlUnit"); | 8667 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getResolvedHtmlUnit"); |
| 8472 _checkThread(instrumentation); | 8668 _checkThread(instrumentation); |
| 8473 try { | 8669 try { |
| 8474 instrumentation.metric3("contextId", _contextId); | 8670 instrumentation.metric3("contextId", _contextId); |
| 8475 return _basis.getResolvedHtmlUnit(htmlSource); | 8671 return _basis.getResolvedHtmlUnit(htmlSource); |
| 8476 } finally { | 8672 } finally { |
| 8477 instrumentation.log2(2); | 8673 instrumentation.log2(2); |
| 8478 } | 8674 } |
| 8479 } | 8675 } |
| 8480 | 8676 |
| 8677 @override |
| 8481 SourceFactory get sourceFactory { | 8678 SourceFactory get sourceFactory { |
| 8482 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getSourceFactory"); | 8679 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getSourceFactory"); |
| 8483 _checkThread(instrumentation); | 8680 _checkThread(instrumentation); |
| 8484 try { | 8681 try { |
| 8485 instrumentation.metric3("contextId", _contextId); | 8682 instrumentation.metric3("contextId", _contextId); |
| 8486 return _basis.sourceFactory; | 8683 return _basis.sourceFactory; |
| 8487 } finally { | 8684 } finally { |
| 8488 instrumentation.log2(2); | 8685 instrumentation.log2(2); |
| 8489 } | 8686 } |
| 8490 } | 8687 } |
| 8491 | 8688 |
| 8689 @override |
| 8492 AnalysisContentStatistics get statistics => _basis.statistics; | 8690 AnalysisContentStatistics get statistics => _basis.statistics; |
| 8493 | 8691 |
| 8692 @override |
| 8494 TypeProvider get typeProvider => _basis.typeProvider; | 8693 TypeProvider get typeProvider => _basis.typeProvider; |
| 8495 | 8694 |
| 8695 @override |
| 8496 TimestampedData<CompilationUnit> internalResolveCompilationUnit(Source unitSou
rce, LibraryElement libraryElement) => _basis.internalResolveCompilationUnit(uni
tSource, libraryElement); | 8696 TimestampedData<CompilationUnit> internalResolveCompilationUnit(Source unitSou
rce, LibraryElement libraryElement) => _basis.internalResolveCompilationUnit(uni
tSource, libraryElement); |
| 8497 | 8697 |
| 8698 @override |
| 8498 bool isClientLibrary(Source librarySource) { | 8699 bool isClientLibrary(Source librarySource) { |
| 8499 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
isClientLibrary"); | 8700 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
isClientLibrary"); |
| 8500 _checkThread(instrumentation); | 8701 _checkThread(instrumentation); |
| 8501 try { | 8702 try { |
| 8502 instrumentation.metric3("contextId", _contextId); | 8703 instrumentation.metric3("contextId", _contextId); |
| 8503 return _basis.isClientLibrary(librarySource); | 8704 return _basis.isClientLibrary(librarySource); |
| 8504 } finally { | 8705 } finally { |
| 8505 instrumentation.log(); | 8706 instrumentation.log(); |
| 8506 } | 8707 } |
| 8507 } | 8708 } |
| 8508 | 8709 |
| 8710 @override |
| 8509 bool get isDisposed { | 8711 bool get isDisposed { |
| 8510 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
isDisposed"); | 8712 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
isDisposed"); |
| 8511 _checkThread(instrumentation); | 8713 _checkThread(instrumentation); |
| 8512 try { | 8714 try { |
| 8513 instrumentation.metric3("contextId", _contextId); | 8715 instrumentation.metric3("contextId", _contextId); |
| 8514 return _basis.isDisposed; | 8716 return _basis.isDisposed; |
| 8515 } finally { | 8717 } finally { |
| 8516 instrumentation.log(); | 8718 instrumentation.log(); |
| 8517 } | 8719 } |
| 8518 } | 8720 } |
| 8519 | 8721 |
| 8722 @override |
| 8520 bool isServerLibrary(Source librarySource) { | 8723 bool isServerLibrary(Source librarySource) { |
| 8521 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
isServerLibrary"); | 8724 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
isServerLibrary"); |
| 8522 _checkThread(instrumentation); | 8725 _checkThread(instrumentation); |
| 8523 try { | 8726 try { |
| 8524 instrumentation.metric3("contextId", _contextId); | 8727 instrumentation.metric3("contextId", _contextId); |
| 8525 return _basis.isServerLibrary(librarySource); | 8728 return _basis.isServerLibrary(librarySource); |
| 8526 } finally { | 8729 } finally { |
| 8527 instrumentation.log(); | 8730 instrumentation.log(); |
| 8528 } | 8731 } |
| 8529 } | 8732 } |
| 8530 | 8733 |
| 8734 @override |
| 8531 void mergeContext(AnalysisContext context) { | 8735 void mergeContext(AnalysisContext context) { |
| 8532 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
mergeContext"); | 8736 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
mergeContext"); |
| 8533 _checkThread(instrumentation); | 8737 _checkThread(instrumentation); |
| 8534 try { | 8738 try { |
| 8535 instrumentation.metric3("contextId", _contextId); | 8739 instrumentation.metric3("contextId", _contextId); |
| 8536 if (context is InstrumentedAnalysisContextImpl) { | 8740 if (context is InstrumentedAnalysisContextImpl) { |
| 8537 context = (context as InstrumentedAnalysisContextImpl)._basis; | 8741 context = (context as InstrumentedAnalysisContextImpl)._basis; |
| 8538 } | 8742 } |
| 8539 _basis.mergeContext(context); | 8743 _basis.mergeContext(context); |
| 8540 } finally { | 8744 } finally { |
| 8541 instrumentation.log(); | 8745 instrumentation.log(); |
| 8542 } | 8746 } |
| 8543 } | 8747 } |
| 8544 | 8748 |
| 8749 @override |
| 8545 CompilationUnit parseCompilationUnit(Source source) { | 8750 CompilationUnit parseCompilationUnit(Source source) { |
| 8546 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
parseCompilationUnit"); | 8751 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
parseCompilationUnit"); |
| 8547 _checkThread(instrumentation); | 8752 _checkThread(instrumentation); |
| 8548 try { | 8753 try { |
| 8549 instrumentation.metric3("contextId", _contextId); | 8754 instrumentation.metric3("contextId", _contextId); |
| 8550 return _basis.parseCompilationUnit(source); | 8755 return _basis.parseCompilationUnit(source); |
| 8551 } on AnalysisException catch (e) { | 8756 } on AnalysisException catch (e) { |
| 8552 _recordAnalysisException(instrumentation, e); | 8757 _recordAnalysisException(instrumentation, e); |
| 8553 throw e; | 8758 throw e; |
| 8554 } finally { | 8759 } finally { |
| 8555 instrumentation.log(); | 8760 instrumentation.log(); |
| 8556 } | 8761 } |
| 8557 } | 8762 } |
| 8558 | 8763 |
| 8764 @override |
| 8559 ht.HtmlUnit parseHtmlUnit(Source source) { | 8765 ht.HtmlUnit parseHtmlUnit(Source source) { |
| 8560 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
parseHtmlUnit"); | 8766 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
parseHtmlUnit"); |
| 8561 _checkThread(instrumentation); | 8767 _checkThread(instrumentation); |
| 8562 try { | 8768 try { |
| 8563 instrumentation.metric3("contextId", _contextId); | 8769 instrumentation.metric3("contextId", _contextId); |
| 8564 return _basis.parseHtmlUnit(source); | 8770 return _basis.parseHtmlUnit(source); |
| 8565 } on AnalysisException catch (e) { | 8771 } on AnalysisException catch (e) { |
| 8566 _recordAnalysisException(instrumentation, e); | 8772 _recordAnalysisException(instrumentation, e); |
| 8567 throw e; | 8773 throw e; |
| 8568 } finally { | 8774 } finally { |
| 8569 instrumentation.log(); | 8775 instrumentation.log(); |
| 8570 } | 8776 } |
| 8571 } | 8777 } |
| 8572 | 8778 |
| 8779 @override |
| 8573 AnalysisResult performAnalysisTask() { | 8780 AnalysisResult performAnalysisTask() { |
| 8574 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
performAnalysisTask"); | 8781 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
performAnalysisTask"); |
| 8575 _checkThread(instrumentation); | 8782 _checkThread(instrumentation); |
| 8576 try { | 8783 try { |
| 8577 instrumentation.metric3("contextId", _contextId); | 8784 instrumentation.metric3("contextId", _contextId); |
| 8578 AnalysisResult result = _basis.performAnalysisTask(); | 8785 AnalysisResult result = _basis.performAnalysisTask(); |
| 8579 if (result.changeNotices != null) { | 8786 if (result.changeNotices != null) { |
| 8580 instrumentation.metric2("ChangeNotice-count", result.changeNotices.lengt
h); | 8787 instrumentation.metric2("ChangeNotice-count", result.changeNotices.lengt
h); |
| 8581 } | 8788 } |
| 8582 return result; | 8789 return result; |
| 8583 } finally { | 8790 } finally { |
| 8584 instrumentation.log2(2); | 8791 instrumentation.log2(2); |
| 8585 } | 8792 } |
| 8586 } | 8793 } |
| 8587 | 8794 |
| 8795 @override |
| 8588 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { | 8796 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { |
| 8589 _basis.recordLibraryElements(elementMap); | 8797 _basis.recordLibraryElements(elementMap); |
| 8590 } | 8798 } |
| 8591 | 8799 |
| 8800 @override |
| 8592 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { | 8801 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { |
| 8593 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveCompilationUnit"); | 8802 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveCompilationUnit"); |
| 8594 _checkThread(instrumentation); | 8803 _checkThread(instrumentation); |
| 8595 try { | 8804 try { |
| 8596 instrumentation.metric3("contextId", _contextId); | 8805 instrumentation.metric3("contextId", _contextId); |
| 8597 return _basis.resolveCompilationUnit(unitSource, library); | 8806 return _basis.resolveCompilationUnit(unitSource, library); |
| 8598 } on AnalysisException catch (e) { | 8807 } on AnalysisException catch (e) { |
| 8599 _recordAnalysisException(instrumentation, e); | 8808 _recordAnalysisException(instrumentation, e); |
| 8600 throw e; | 8809 throw e; |
| 8601 } finally { | 8810 } finally { |
| 8602 instrumentation.log(); | 8811 instrumentation.log(); |
| 8603 } | 8812 } |
| 8604 } | 8813 } |
| 8605 | 8814 |
| 8815 @override |
| 8606 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) { | 8816 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) { |
| 8607 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveCompilationUnit"); | 8817 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveCompilationUnit"); |
| 8608 _checkThread(instrumentation); | 8818 _checkThread(instrumentation); |
| 8609 try { | 8819 try { |
| 8610 instrumentation.metric3("contextId", _contextId); | 8820 instrumentation.metric3("contextId", _contextId); |
| 8611 return _basis.resolveCompilationUnit2(unitSource, librarySource); | 8821 return _basis.resolveCompilationUnit2(unitSource, librarySource); |
| 8612 } on AnalysisException catch (e) { | 8822 } on AnalysisException catch (e) { |
| 8613 _recordAnalysisException(instrumentation, e); | 8823 _recordAnalysisException(instrumentation, e); |
| 8614 throw e; | 8824 throw e; |
| 8615 } finally { | 8825 } finally { |
| 8616 instrumentation.log(); | 8826 instrumentation.log(); |
| 8617 } | 8827 } |
| 8618 } | 8828 } |
| 8619 | 8829 |
| 8830 @override |
| 8620 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) { | 8831 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) { |
| 8621 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveHtmlUnit"); | 8832 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveHtmlUnit"); |
| 8622 _checkThread(instrumentation); | 8833 _checkThread(instrumentation); |
| 8623 try { | 8834 try { |
| 8624 instrumentation.metric3("contextId", _contextId); | 8835 instrumentation.metric3("contextId", _contextId); |
| 8625 return _basis.resolveHtmlUnit(htmlSource); | 8836 return _basis.resolveHtmlUnit(htmlSource); |
| 8626 } on AnalysisException catch (e) { | 8837 } on AnalysisException catch (e) { |
| 8627 _recordAnalysisException(instrumentation, e); | 8838 _recordAnalysisException(instrumentation, e); |
| 8628 throw e; | 8839 throw e; |
| 8629 } finally { | 8840 } finally { |
| 8630 instrumentation.log(); | 8841 instrumentation.log(); |
| 8631 } | 8842 } |
| 8632 } | 8843 } |
| 8633 | 8844 |
| 8845 @override |
| 8634 void set analysisOptions(AnalysisOptions options) { | 8846 void set analysisOptions(AnalysisOptions options) { |
| 8635 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setAnalysisOptions"); | 8847 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setAnalysisOptions"); |
| 8636 _checkThread(instrumentation); | 8848 _checkThread(instrumentation); |
| 8637 try { | 8849 try { |
| 8638 instrumentation.metric3("contextId", _contextId); | 8850 instrumentation.metric3("contextId", _contextId); |
| 8639 _basis.analysisOptions = options; | 8851 _basis.analysisOptions = options; |
| 8640 } finally { | 8852 } finally { |
| 8641 instrumentation.log(); | 8853 instrumentation.log(); |
| 8642 } | 8854 } |
| 8643 } | 8855 } |
| 8644 | 8856 |
| 8857 @override |
| 8645 void set analysisPriorityOrder(List<Source> sources) { | 8858 void set analysisPriorityOrder(List<Source> sources) { |
| 8646 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setAnalysisPriorityOrder"); | 8859 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setAnalysisPriorityOrder"); |
| 8647 _checkThread(instrumentation); | 8860 _checkThread(instrumentation); |
| 8648 try { | 8861 try { |
| 8649 instrumentation.metric3("contextId", _contextId); | 8862 instrumentation.metric3("contextId", _contextId); |
| 8650 _basis.analysisPriorityOrder = sources; | 8863 _basis.analysisPriorityOrder = sources; |
| 8651 } finally { | 8864 } finally { |
| 8652 instrumentation.log(); | 8865 instrumentation.log(); |
| 8653 } | 8866 } |
| 8654 } | 8867 } |
| 8655 | 8868 |
| 8869 @override |
| 8656 void setChangedContents(Source source, String contents, int offset, int oldLen
gth, int newLength) { | 8870 void setChangedContents(Source source, String contents, int offset, int oldLen
gth, int newLength) { |
| 8657 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setChangedContents"); | 8871 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setChangedContents"); |
| 8658 _checkThread(instrumentation); | 8872 _checkThread(instrumentation); |
| 8659 try { | 8873 try { |
| 8660 instrumentation.metric3("contextId", _contextId); | 8874 instrumentation.metric3("contextId", _contextId); |
| 8661 _basis.setChangedContents(source, contents, offset, oldLength, newLength); | 8875 _basis.setChangedContents(source, contents, offset, oldLength, newLength); |
| 8662 } finally { | 8876 } finally { |
| 8663 instrumentation.log(); | 8877 instrumentation.log(); |
| 8664 } | 8878 } |
| 8665 } | 8879 } |
| 8666 | 8880 |
| 8881 @override |
| 8667 void setContents(Source source, String contents) { | 8882 void setContents(Source source, String contents) { |
| 8668 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setContents"); | 8883 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setContents"); |
| 8669 _checkThread(instrumentation); | 8884 _checkThread(instrumentation); |
| 8670 try { | 8885 try { |
| 8671 instrumentation.metric3("contextId", _contextId); | 8886 instrumentation.metric3("contextId", _contextId); |
| 8672 _basis.setContents(source, contents); | 8887 _basis.setContents(source, contents); |
| 8673 } finally { | 8888 } finally { |
| 8674 instrumentation.log(); | 8889 instrumentation.log(); |
| 8675 } | 8890 } |
| 8676 } | 8891 } |
| 8677 | 8892 |
| 8893 @override |
| 8678 void set sourceFactory(SourceFactory factory) { | 8894 void set sourceFactory(SourceFactory factory) { |
| 8679 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setSourceFactory"); | 8895 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setSourceFactory"); |
| 8680 _checkThread(instrumentation); | 8896 _checkThread(instrumentation); |
| 8681 try { | 8897 try { |
| 8682 instrumentation.metric3("contextId", _contextId); | 8898 instrumentation.metric3("contextId", _contextId); |
| 8683 _basis.sourceFactory = factory; | 8899 _basis.sourceFactory = factory; |
| 8684 } finally { | 8900 } finally { |
| 8685 instrumentation.log(); | 8901 instrumentation.log(); |
| 8686 } | 8902 } |
| 8687 } | 8903 } |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8891 */ | 9107 */ |
| 8892 List<AnalysisError> getErrorsForSource(Source source) { | 9108 List<AnalysisError> getErrorsForSource(Source source) { |
| 8893 Set<AnalysisError> errorsForSource = _errors[source]; | 9109 Set<AnalysisError> errorsForSource = _errors[source]; |
| 8894 if (errorsForSource == null) { | 9110 if (errorsForSource == null) { |
| 8895 return AnalysisError.NO_ERRORS; | 9111 return AnalysisError.NO_ERRORS; |
| 8896 } else { | 9112 } else { |
| 8897 return new List.from(errorsForSource); | 9113 return new List.from(errorsForSource); |
| 8898 } | 9114 } |
| 8899 } | 9115 } |
| 8900 | 9116 |
| 9117 @override |
| 8901 void onError(AnalysisError error) { | 9118 void onError(AnalysisError error) { |
| 8902 Source source = error.source; | 9119 Source source = error.source; |
| 8903 Set<AnalysisError> errorsForSource = _errors[source]; | 9120 Set<AnalysisError> errorsForSource = _errors[source]; |
| 8904 if (_errors[source] == null) { | 9121 if (_errors[source] == null) { |
| 8905 errorsForSource = new Set<AnalysisError>(); | 9122 errorsForSource = new Set<AnalysisError>(); |
| 8906 _errors[source] = errorsForSource; | 9123 _errors[source] = errorsForSource; |
| 8907 } | 9124 } |
| 8908 errorsForSource.add(error); | 9125 errorsForSource.add(error); |
| 8909 } | 9126 } |
| 8910 } | 9127 } |
| 8911 | 9128 |
| 8912 /** | 9129 /** |
| 8913 * Instances of the class `ResolutionEraser` remove any resolution information f
rom an AST | 9130 * Instances of the class `ResolutionEraser` remove any resolution information f
rom an AST |
| 8914 * structure when used to visit that structure. | 9131 * structure when used to visit that structure. |
| 8915 */ | 9132 */ |
| 8916 class ResolutionEraser extends GeneralizingAstVisitor<Object> { | 9133 class ResolutionEraser extends GeneralizingAstVisitor<Object> { |
| 9134 @override |
| 8917 Object visitAssignmentExpression(AssignmentExpression node) { | 9135 Object visitAssignmentExpression(AssignmentExpression node) { |
| 8918 node.staticElement = null; | 9136 node.staticElement = null; |
| 8919 node.propagatedElement = null; | 9137 node.propagatedElement = null; |
| 8920 return super.visitAssignmentExpression(node); | 9138 return super.visitAssignmentExpression(node); |
| 8921 } | 9139 } |
| 8922 | 9140 |
| 9141 @override |
| 8923 Object visitBinaryExpression(BinaryExpression node) { | 9142 Object visitBinaryExpression(BinaryExpression node) { |
| 8924 node.staticElement = null; | 9143 node.staticElement = null; |
| 8925 node.propagatedElement = null; | 9144 node.propagatedElement = null; |
| 8926 return super.visitBinaryExpression(node); | 9145 return super.visitBinaryExpression(node); |
| 8927 } | 9146 } |
| 8928 | 9147 |
| 9148 @override |
| 8929 Object visitCompilationUnit(CompilationUnit node) { | 9149 Object visitCompilationUnit(CompilationUnit node) { |
| 8930 node.element = null; | 9150 node.element = null; |
| 8931 return super.visitCompilationUnit(node); | 9151 return super.visitCompilationUnit(node); |
| 8932 } | 9152 } |
| 8933 | 9153 |
| 9154 @override |
| 8934 Object visitConstructorDeclaration(ConstructorDeclaration node) { | 9155 Object visitConstructorDeclaration(ConstructorDeclaration node) { |
| 8935 node.element = null; | 9156 node.element = null; |
| 8936 return super.visitConstructorDeclaration(node); | 9157 return super.visitConstructorDeclaration(node); |
| 8937 } | 9158 } |
| 8938 | 9159 |
| 9160 @override |
| 8939 Object visitConstructorName(ConstructorName node) { | 9161 Object visitConstructorName(ConstructorName node) { |
| 8940 node.staticElement = null; | 9162 node.staticElement = null; |
| 8941 return super.visitConstructorName(node); | 9163 return super.visitConstructorName(node); |
| 8942 } | 9164 } |
| 8943 | 9165 |
| 9166 @override |
| 8944 Object visitDirective(Directive node) { | 9167 Object visitDirective(Directive node) { |
| 8945 node.element = null; | 9168 node.element = null; |
| 8946 return super.visitDirective(node); | 9169 return super.visitDirective(node); |
| 8947 } | 9170 } |
| 8948 | 9171 |
| 9172 @override |
| 8949 Object visitExpression(Expression node) { | 9173 Object visitExpression(Expression node) { |
| 8950 node.staticType = null; | 9174 node.staticType = null; |
| 8951 node.propagatedType = null; | 9175 node.propagatedType = null; |
| 8952 return super.visitExpression(node); | 9176 return super.visitExpression(node); |
| 8953 } | 9177 } |
| 8954 | 9178 |
| 9179 @override |
| 8955 Object visitFunctionExpression(FunctionExpression node) { | 9180 Object visitFunctionExpression(FunctionExpression node) { |
| 8956 node.element = null; | 9181 node.element = null; |
| 8957 return super.visitFunctionExpression(node); | 9182 return super.visitFunctionExpression(node); |
| 8958 } | 9183 } |
| 8959 | 9184 |
| 9185 @override |
| 8960 Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { | 9186 Object visitFunctionExpressionInvocation(FunctionExpressionInvocation node) { |
| 8961 node.staticElement = null; | 9187 node.staticElement = null; |
| 8962 node.propagatedElement = null; | 9188 node.propagatedElement = null; |
| 8963 return super.visitFunctionExpressionInvocation(node); | 9189 return super.visitFunctionExpressionInvocation(node); |
| 8964 } | 9190 } |
| 8965 | 9191 |
| 9192 @override |
| 8966 Object visitIndexExpression(IndexExpression node) { | 9193 Object visitIndexExpression(IndexExpression node) { |
| 8967 node.staticElement = null; | 9194 node.staticElement = null; |
| 8968 node.propagatedElement = null; | 9195 node.propagatedElement = null; |
| 8969 return super.visitIndexExpression(node); | 9196 return super.visitIndexExpression(node); |
| 8970 } | 9197 } |
| 8971 | 9198 |
| 9199 @override |
| 8972 Object visitInstanceCreationExpression(InstanceCreationExpression node) { | 9200 Object visitInstanceCreationExpression(InstanceCreationExpression node) { |
| 8973 node.staticElement = null; | 9201 node.staticElement = null; |
| 8974 return super.visitInstanceCreationExpression(node); | 9202 return super.visitInstanceCreationExpression(node); |
| 8975 } | 9203 } |
| 8976 | 9204 |
| 9205 @override |
| 8977 Object visitPostfixExpression(PostfixExpression node) { | 9206 Object visitPostfixExpression(PostfixExpression node) { |
| 8978 node.staticElement = null; | 9207 node.staticElement = null; |
| 8979 node.propagatedElement = null; | 9208 node.propagatedElement = null; |
| 8980 return super.visitPostfixExpression(node); | 9209 return super.visitPostfixExpression(node); |
| 8981 } | 9210 } |
| 8982 | 9211 |
| 9212 @override |
| 8983 Object visitPrefixExpression(PrefixExpression node) { | 9213 Object visitPrefixExpression(PrefixExpression node) { |
| 8984 node.staticElement = null; | 9214 node.staticElement = null; |
| 8985 node.propagatedElement = null; | 9215 node.propagatedElement = null; |
| 8986 return super.visitPrefixExpression(node); | 9216 return super.visitPrefixExpression(node); |
| 8987 } | 9217 } |
| 8988 | 9218 |
| 9219 @override |
| 8989 Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation
node) { | 9220 Object visitRedirectingConstructorInvocation(RedirectingConstructorInvocation
node) { |
| 8990 node.staticElement = null; | 9221 node.staticElement = null; |
| 8991 return super.visitRedirectingConstructorInvocation(node); | 9222 return super.visitRedirectingConstructorInvocation(node); |
| 8992 } | 9223 } |
| 8993 | 9224 |
| 9225 @override |
| 8994 Object visitSimpleIdentifier(SimpleIdentifier node) { | 9226 Object visitSimpleIdentifier(SimpleIdentifier node) { |
| 8995 node.staticElement = null; | 9227 node.staticElement = null; |
| 8996 node.propagatedElement = null; | 9228 node.propagatedElement = null; |
| 8997 return super.visitSimpleIdentifier(node); | 9229 return super.visitSimpleIdentifier(node); |
| 8998 } | 9230 } |
| 8999 | 9231 |
| 9232 @override |
| 9000 Object visitSuperConstructorInvocation(SuperConstructorInvocation node) { | 9233 Object visitSuperConstructorInvocation(SuperConstructorInvocation node) { |
| 9001 node.staticElement = null; | 9234 node.staticElement = null; |
| 9002 return super.visitSuperConstructorInvocation(node); | 9235 return super.visitSuperConstructorInvocation(node); |
| 9003 } | 9236 } |
| 9004 } | 9237 } |
| 9005 | 9238 |
| 9006 /** | 9239 /** |
| 9007 * Instances of the class `ResolvableCompilationUnit` represent a compilation un
it that is not | 9240 * Instances of the class `ResolvableCompilationUnit` represent a compilation un
it that is not |
| 9008 * referenced by any other objects and for which we have modification stamp info
rmation. It is used | 9241 * referenced by any other objects and for which we have modification stamp info
rmation. It is used |
| 9009 * by the [LibraryResolver] to resolve a library. | 9242 * by the [LibraryResolver] to resolve a library. |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9522 _resolveInternal(application.elements, component); | 9755 _resolveInternal(application.elements, component); |
| 9523 } | 9756 } |
| 9524 | 9757 |
| 9525 /** | 9758 /** |
| 9526 * Resolves [source] as an Angular application entry point. | 9759 * Resolves [source] as an Angular application entry point. |
| 9527 */ | 9760 */ |
| 9528 void resolveEntryPoint(AngularApplication application) { | 9761 void resolveEntryPoint(AngularApplication application) { |
| 9529 _resolveInternal(application.elements, null); | 9762 _resolveInternal(application.elements, null); |
| 9530 } | 9763 } |
| 9531 | 9764 |
| 9765 @override |
| 9532 Object visitXmlAttributeNode(ht.XmlAttributeNode node) { | 9766 Object visitXmlAttributeNode(ht.XmlAttributeNode node) { |
| 9533 _parseEmbeddedExpressionsInAttribute(node); | 9767 _parseEmbeddedExpressionsInAttribute(node); |
| 9534 _resolveExpressions(node.expressions); | 9768 _resolveExpressions(node.expressions); |
| 9535 return super.visitXmlAttributeNode(node); | 9769 return super.visitXmlAttributeNode(node); |
| 9536 } | 9770 } |
| 9537 | 9771 |
| 9772 @override |
| 9538 Object visitXmlTagNode(ht.XmlTagNode node) { | 9773 Object visitXmlTagNode(ht.XmlTagNode node) { |
| 9539 bool wasAngular = _isAngular; | 9774 bool wasAngular = _isAngular; |
| 9540 try { | 9775 try { |
| 9541 // new Angular context | 9776 // new Angular context |
| 9542 if (node.getAttribute(_NG_APP) != null) { | 9777 if (node.getAttribute(_NG_APP) != null) { |
| 9543 _isAngular = true; | 9778 _isAngular = true; |
| 9544 _visitModelDirectives(node); | 9779 _visitModelDirectives(node); |
| 9545 } | 9780 } |
| 9546 // not Angular | 9781 // not Angular |
| 9547 if (!_isAngular) { | 9782 if (!_isAngular) { |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9978 } | 10213 } |
| 9979 } | 10214 } |
| 9980 | 10215 |
| 9981 class AngularHtmlUnitResolver_FilteringAnalysisErrorListener implements Analysis
ErrorListener { | 10216 class AngularHtmlUnitResolver_FilteringAnalysisErrorListener implements Analysis
ErrorListener { |
| 9982 AnalysisErrorListener _listener; | 10217 AnalysisErrorListener _listener; |
| 9983 | 10218 |
| 9984 AngularHtmlUnitResolver_FilteringAnalysisErrorListener(AnalysisErrorListener l
istener) { | 10219 AngularHtmlUnitResolver_FilteringAnalysisErrorListener(AnalysisErrorListener l
istener) { |
| 9985 this._listener = listener; | 10220 this._listener = listener; |
| 9986 } | 10221 } |
| 9987 | 10222 |
| 10223 @override |
| 9988 void onError(AnalysisError error) { | 10224 void onError(AnalysisError error) { |
| 9989 ErrorCode errorCode = error.errorCode; | 10225 ErrorCode errorCode = error.errorCode; |
| 9990 if (identical(errorCode, StaticWarningCode.UNDEFINED_GETTER) || identical(er
rorCode, StaticWarningCode.UNDEFINED_IDENTIFIER) || identical(errorCode, StaticT
ypeWarningCode.UNDEFINED_GETTER)) { | 10226 if (identical(errorCode, StaticWarningCode.UNDEFINED_GETTER) || identical(er
rorCode, StaticWarningCode.UNDEFINED_IDENTIFIER) || identical(errorCode, StaticT
ypeWarningCode.UNDEFINED_GETTER)) { |
| 9991 return; | 10227 return; |
| 9992 } | 10228 } |
| 9993 _listener.onError(error); | 10229 _listener.onError(error); |
| 9994 } | 10230 } |
| 9995 } | 10231 } |
| 9996 | 10232 |
| 9997 class AngularHtmlUnitResolver_FoundAppError extends Error { | 10233 class AngularHtmlUnitResolver_FoundAppError extends Error { |
| 9998 } | 10234 } |
| 9999 | 10235 |
| 10000 class RecursiveXmlVisitor_AngularHtmlUnitResolver_hasAngularAnnotation extends h
t.RecursiveXmlVisitor<Object> { | 10236 class RecursiveXmlVisitor_AngularHtmlUnitResolver_hasAngularAnnotation extends h
t.RecursiveXmlVisitor<Object> { |
| 10237 @override |
| 10001 Object visitXmlTagNode(ht.XmlTagNode node) { | 10238 Object visitXmlTagNode(ht.XmlTagNode node) { |
| 10002 if (node.getAttribute(AngularHtmlUnitResolver._NG_APP) != null) { | 10239 if (node.getAttribute(AngularHtmlUnitResolver._NG_APP) != null) { |
| 10003 throw new AngularHtmlUnitResolver_FoundAppError(); | 10240 throw new AngularHtmlUnitResolver_FoundAppError(); |
| 10004 } | 10241 } |
| 10005 return super.visitXmlTagNode(node); | 10242 return super.visitXmlTagNode(node); |
| 10006 } | 10243 } |
| 10007 } | 10244 } |
| 10008 | 10245 |
| 10009 class RecursiveXmlVisitor_AngularHtmlUnitResolver_visitModelDirectives extends h
t.RecursiveXmlVisitor<Object> { | 10246 class RecursiveXmlVisitor_AngularHtmlUnitResolver_visitModelDirectives extends h
t.RecursiveXmlVisitor<Object> { |
| 10010 final AngularHtmlUnitResolver AngularHtmlUnitResolver_this; | 10247 final AngularHtmlUnitResolver AngularHtmlUnitResolver_this; |
| 10011 | 10248 |
| 10012 RecursiveXmlVisitor_AngularHtmlUnitResolver_visitModelDirectives(this.AngularH
tmlUnitResolver_this) : super(); | 10249 RecursiveXmlVisitor_AngularHtmlUnitResolver_visitModelDirectives(this.AngularH
tmlUnitResolver_this) : super(); |
| 10013 | 10250 |
| 10251 @override |
| 10014 Object visitXmlTagNode(ht.XmlTagNode node) { | 10252 Object visitXmlTagNode(ht.XmlTagNode node) { |
| 10015 NgModelProcessor directive = NgModelProcessor.INSTANCE; | 10253 NgModelProcessor directive = NgModelProcessor.INSTANCE; |
| 10016 if (directive.canApply(node)) { | 10254 if (directive.canApply(node)) { |
| 10017 directive._applyTopDeclarations(AngularHtmlUnitResolver_this, node); | 10255 directive._applyTopDeclarations(AngularHtmlUnitResolver_this, node); |
| 10018 } | 10256 } |
| 10019 return super.visitXmlTagNode(node); | 10257 return super.visitXmlTagNode(node); |
| 10020 } | 10258 } |
| 10021 } | 10259 } |
| 10022 | 10260 |
| 10023 /** | 10261 /** |
| (...skipping 21 matching lines...) Expand all Loading... |
| 10045 /** | 10283 /** |
| 10046 * The offset of the first character of the closing delimiter. | 10284 * The offset of the first character of the closing delimiter. |
| 10047 */ | 10285 */ |
| 10048 int _closingOffset = 0; | 10286 int _closingOffset = 0; |
| 10049 | 10287 |
| 10050 AngularMoustacheXmlExpression(int openingOffset, int closingOffset, AngularExp
ression expression) : super(expression) { | 10288 AngularMoustacheXmlExpression(int openingOffset, int closingOffset, AngularExp
ression expression) : super(expression) { |
| 10051 this._openingOffset = openingOffset; | 10289 this._openingOffset = openingOffset; |
| 10052 this._closingOffset = closingOffset; | 10290 this._closingOffset = closingOffset; |
| 10053 } | 10291 } |
| 10054 | 10292 |
| 10293 @override |
| 10055 int get end => _closingOffset + CLOSING_DELIMITER_LENGTH; | 10294 int get end => _closingOffset + CLOSING_DELIMITER_LENGTH; |
| 10056 | 10295 |
| 10296 @override |
| 10057 int get length => _closingOffset + CLOSING_DELIMITER_LENGTH - _openingOffset; | 10297 int get length => _closingOffset + CLOSING_DELIMITER_LENGTH - _openingOffset; |
| 10058 | 10298 |
| 10299 @override |
| 10059 int get offset => _openingOffset; | 10300 int get offset => _openingOffset; |
| 10060 } | 10301 } |
| 10061 | 10302 |
| 10062 /** | 10303 /** |
| 10063 * Implementation of [AngularXmlExpression] for an [AngularExpression] embedded
without | 10304 * Implementation of [AngularXmlExpression] for an [AngularExpression] embedded
without |
| 10064 * any wrapping characters. | 10305 * any wrapping characters. |
| 10065 */ | 10306 */ |
| 10066 class AngularRawXmlExpression extends AngularXmlExpression { | 10307 class AngularRawXmlExpression extends AngularXmlExpression { |
| 10067 AngularRawXmlExpression(AngularExpression expression) : super(expression); | 10308 AngularRawXmlExpression(AngularExpression expression) : super(expression); |
| 10068 | 10309 |
| 10310 @override |
| 10069 int get end => expression.end; | 10311 int get end => expression.end; |
| 10070 | 10312 |
| 10313 @override |
| 10071 int get length => expression.length; | 10314 int get length => expression.length; |
| 10072 | 10315 |
| 10316 @override |
| 10073 int get offset => expression.offset; | 10317 int get offset => expression.offset; |
| 10074 } | 10318 } |
| 10075 | 10319 |
| 10076 /** | 10320 /** |
| 10077 * Abstract Angular specific [XmlExpression]. | 10321 * Abstract Angular specific [XmlExpression]. |
| 10078 */ | 10322 */ |
| 10079 abstract class AngularXmlExpression extends ht.XmlExpression { | 10323 abstract class AngularXmlExpression extends ht.XmlExpression { |
| 10080 /** | 10324 /** |
| 10081 * The expression that is enclosed between the delimiters. | 10325 * The expression that is enclosed between the delimiters. |
| 10082 */ | 10326 */ |
| 10083 final AngularExpression expression; | 10327 final AngularExpression expression; |
| 10084 | 10328 |
| 10085 AngularXmlExpression(this.expression); | 10329 AngularXmlExpression(this.expression); |
| 10086 | 10330 |
| 10331 @override |
| 10087 ht.XmlExpression_Reference getReference(int offset) { | 10332 ht.XmlExpression_Reference getReference(int offset) { |
| 10088 // main expression | 10333 // main expression |
| 10089 ht.XmlExpression_Reference reference = _getReferenceAtNode(expression.expres
sion, offset); | 10334 ht.XmlExpression_Reference reference = _getReferenceAtNode(expression.expres
sion, offset); |
| 10090 if (reference != null) { | 10335 if (reference != null) { |
| 10091 return reference; | 10336 return reference; |
| 10092 } | 10337 } |
| 10093 // filters | 10338 // filters |
| 10094 for (AngularFilterNode filter in expression.filters) { | 10339 for (AngularFilterNode filter in expression.filters) { |
| 10095 // filter name | 10340 // filter name |
| 10096 reference = _getReferenceAtNode(filter.name, offset); | 10341 reference = _getReferenceAtNode(filter.name, offset); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 10126 * Recursively visits [HtmlUnit] and every embedded [Expression]. | 10371 * Recursively visits [HtmlUnit] and every embedded [Expression]. |
| 10127 */ | 10372 */ |
| 10128 abstract class ExpressionVisitor extends ht.RecursiveXmlVisitor<Object> { | 10373 abstract class ExpressionVisitor extends ht.RecursiveXmlVisitor<Object> { |
| 10129 /** | 10374 /** |
| 10130 * Visits the given [Expression]s embedded into tag or attribute. | 10375 * Visits the given [Expression]s embedded into tag or attribute. |
| 10131 * | 10376 * |
| 10132 * @param expression the [Expression] to visit, not `null` | 10377 * @param expression the [Expression] to visit, not `null` |
| 10133 */ | 10378 */ |
| 10134 void visitExpression(Expression expression); | 10379 void visitExpression(Expression expression); |
| 10135 | 10380 |
| 10381 @override |
| 10136 Object visitXmlAttributeNode(ht.XmlAttributeNode node) { | 10382 Object visitXmlAttributeNode(ht.XmlAttributeNode node) { |
| 10137 _visitExpressions(node.expressions); | 10383 _visitExpressions(node.expressions); |
| 10138 return super.visitXmlAttributeNode(node); | 10384 return super.visitXmlAttributeNode(node); |
| 10139 } | 10385 } |
| 10140 | 10386 |
| 10387 @override |
| 10141 Object visitXmlTagNode(ht.XmlTagNode node) { | 10388 Object visitXmlTagNode(ht.XmlTagNode node) { |
| 10142 _visitExpressions(node.expressions); | 10389 _visitExpressions(node.expressions); |
| 10143 return super.visitXmlTagNode(node); | 10390 return super.visitXmlTagNode(node); |
| 10144 } | 10391 } |
| 10145 | 10392 |
| 10146 /** | 10393 /** |
| 10147 * Visits [Expression]s of the given [XmlExpression]s. | 10394 * Visits [Expression]s of the given [XmlExpression]s. |
| 10148 */ | 10395 */ |
| 10149 void _visitExpressions(List<ht.XmlExpression> expressions) { | 10396 void _visitExpressions(List<ht.XmlExpression> expressions) { |
| 10150 for (ht.XmlExpression xmlExpression in expressions) { | 10397 for (ht.XmlExpression xmlExpression in expressions) { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 10167 * [NgComponentElementProcessor] applies [AngularComponentElement] by parsing ma
pped | 10414 * [NgComponentElementProcessor] applies [AngularComponentElement] by parsing ma
pped |
| 10168 * attributes as expressions. | 10415 * attributes as expressions. |
| 10169 */ | 10416 */ |
| 10170 class NgComponentElementProcessor extends NgDirectiveProcessor { | 10417 class NgComponentElementProcessor extends NgDirectiveProcessor { |
| 10171 AngularComponentElement _element; | 10418 AngularComponentElement _element; |
| 10172 | 10419 |
| 10173 NgComponentElementProcessor(AngularComponentElement element) { | 10420 NgComponentElementProcessor(AngularComponentElement element) { |
| 10174 this._element = element; | 10421 this._element = element; |
| 10175 } | 10422 } |
| 10176 | 10423 |
| 10424 @override |
| 10177 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { | 10425 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { |
| 10178 node.element = _element.selector; | 10426 node.element = _element.selector; |
| 10179 for (AngularPropertyElement property in _element.properties) { | 10427 for (AngularPropertyElement property in _element.properties) { |
| 10180 String name = property.name; | 10428 String name = property.name; |
| 10181 ht.XmlAttributeNode attribute = node.getAttribute(name); | 10429 ht.XmlAttributeNode attribute = node.getAttribute(name); |
| 10182 if (attribute != null) { | 10430 if (attribute != null) { |
| 10183 attribute.element = property; | 10431 attribute.element = property; |
| 10184 // resolve if binding | 10432 // resolve if binding |
| 10185 if (property.propertyKind != AngularPropertyKind.ATTR) { | 10433 if (property.propertyKind != AngularPropertyKind.ATTR) { |
| 10186 AngularExpression expression = parseAngularExpression(resolver, attrib
ute); | 10434 AngularExpression expression = parseAngularExpression(resolver, attrib
ute); |
| 10187 resolver._resolveExpression(expression); | 10435 resolver._resolveExpression(expression); |
| 10188 setAngularExpression(attribute, expression); | 10436 setAngularExpression(attribute, expression); |
| 10189 } | 10437 } |
| 10190 } | 10438 } |
| 10191 } | 10439 } |
| 10192 } | 10440 } |
| 10193 | 10441 |
| 10442 @override |
| 10194 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node); | 10443 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node); |
| 10195 } | 10444 } |
| 10196 | 10445 |
| 10197 /** | 10446 /** |
| 10198 * [NgControllerElementProcessor] applies [AngularControllerElement]. | 10447 * [NgControllerElementProcessor] applies [AngularControllerElement]. |
| 10199 */ | 10448 */ |
| 10200 class NgControllerElementProcessor extends NgProcessor { | 10449 class NgControllerElementProcessor extends NgProcessor { |
| 10201 AngularControllerElement _element; | 10450 AngularControllerElement _element; |
| 10202 | 10451 |
| 10203 NgControllerElementProcessor(AngularControllerElement element) { | 10452 NgControllerElementProcessor(AngularControllerElement element) { |
| 10204 this._element = element; | 10453 this._element = element; |
| 10205 } | 10454 } |
| 10206 | 10455 |
| 10456 @override |
| 10207 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { | 10457 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { |
| 10208 InterfaceType type = (_element.enclosingElement as ClassElement).type; | 10458 InterfaceType type = (_element.enclosingElement as ClassElement).type; |
| 10209 String name = _element.name; | 10459 String name = _element.name; |
| 10210 LocalVariableElementImpl variable = resolver._createLocalVariableWithName(ty
pe, name); | 10460 LocalVariableElementImpl variable = resolver._createLocalVariableWithName(ty
pe, name); |
| 10211 resolver._defineVariable(variable); | 10461 resolver._defineVariable(variable); |
| 10212 variable.toolkitObjects = <AngularElement> [_element]; | 10462 variable.toolkitObjects = <AngularElement> [_element]; |
| 10213 } | 10463 } |
| 10214 | 10464 |
| 10465 @override |
| 10215 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node); | 10466 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node); |
| 10216 } | 10467 } |
| 10217 | 10468 |
| 10218 /** | 10469 /** |
| 10219 * [NgDirectiveElementProcessor] applies [AngularDirectiveElement] by parsing ma
pped | 10470 * [NgDirectiveElementProcessor] applies [AngularDirectiveElement] by parsing ma
pped |
| 10220 * attributes as expressions. | 10471 * attributes as expressions. |
| 10221 */ | 10472 */ |
| 10222 class NgDirectiveElementProcessor extends NgDirectiveProcessor { | 10473 class NgDirectiveElementProcessor extends NgDirectiveProcessor { |
| 10223 AngularDirectiveElement _element; | 10474 AngularDirectiveElement _element; |
| 10224 | 10475 |
| 10225 NgDirectiveElementProcessor(AngularDirectiveElement element) { | 10476 NgDirectiveElementProcessor(AngularDirectiveElement element) { |
| 10226 this._element = element; | 10477 this._element = element; |
| 10227 } | 10478 } |
| 10228 | 10479 |
| 10480 @override |
| 10229 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { | 10481 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { |
| 10230 String selectorAttributeName = null; | 10482 String selectorAttributeName = null; |
| 10231 { | 10483 { |
| 10232 AngularSelectorElement selector = _element.selector; | 10484 AngularSelectorElement selector = _element.selector; |
| 10233 if (selector is HasAttributeSelectorElementImpl) { | 10485 if (selector is HasAttributeSelectorElementImpl) { |
| 10234 selectorAttributeName = selector.name; | 10486 selectorAttributeName = selector.name; |
| 10235 // resolve attribute expression | 10487 // resolve attribute expression |
| 10236 ht.XmlAttributeNode attribute = node.getAttribute(selectorAttributeName)
; | 10488 ht.XmlAttributeNode attribute = node.getAttribute(selectorAttributeName)
; |
| 10237 if (attribute != null) { | 10489 if (attribute != null) { |
| 10238 attribute.element = selector; | 10490 attribute.element = selector; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 10262 resolver._resolveExpression(expression); | 10514 resolver._resolveExpression(expression); |
| 10263 setAngularExpression(attribute, expression); | 10515 setAngularExpression(attribute, expression); |
| 10264 } finally { | 10516 } finally { |
| 10265 resolver._popNameScope(); | 10517 resolver._popNameScope(); |
| 10266 } | 10518 } |
| 10267 } | 10519 } |
| 10268 } | 10520 } |
| 10269 } | 10521 } |
| 10270 } | 10522 } |
| 10271 | 10523 |
| 10524 @override |
| 10272 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node); | 10525 bool canApply(ht.XmlTagNode node) => _element.selector.apply(node); |
| 10273 | 10526 |
| 10274 /** | 10527 /** |
| 10275 * Support for <code>$event</code> variable in <code>NgEventDirective</code>. | 10528 * Support for <code>$event</code> variable in <code>NgEventDirective</code>. |
| 10276 */ | 10529 */ |
| 10277 void _onNgEventDirective(AngularHtmlUnitResolver resolver) { | 10530 void _onNgEventDirective(AngularHtmlUnitResolver resolver) { |
| 10278 if (_element.isClass("NgEventDirective")) { | 10531 if (_element.isClass("NgEventDirective")) { |
| 10279 DartType dynamicType = resolver.typeProvider.dynamicType; | 10532 DartType dynamicType = resolver.typeProvider.dynamicType; |
| 10280 resolver._defineVariable(resolver._createLocalVariableWithName(dynamicType
, "\$event")); | 10533 resolver._defineVariable(resolver._createLocalVariableWithName(dynamicType
, "\$event")); |
| 10281 } | 10534 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10330 } | 10583 } |
| 10331 | 10584 |
| 10332 /** | 10585 /** |
| 10333 * [NgModelProcessor] describes built-in <code>NgModel</code> directive. | 10586 * [NgModelProcessor] describes built-in <code>NgModel</code> directive. |
| 10334 */ | 10587 */ |
| 10335 class NgModelProcessor extends NgDirectiveProcessor { | 10588 class NgModelProcessor extends NgDirectiveProcessor { |
| 10336 static String _NG_MODEL = "ng-model"; | 10589 static String _NG_MODEL = "ng-model"; |
| 10337 | 10590 |
| 10338 static NgModelProcessor INSTANCE = new NgModelProcessor(); | 10591 static NgModelProcessor INSTANCE = new NgModelProcessor(); |
| 10339 | 10592 |
| 10593 @override |
| 10340 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { | 10594 void apply(AngularHtmlUnitResolver resolver, ht.XmlTagNode node) { |
| 10341 ht.XmlAttributeNode attribute = node.getAttribute(_NG_MODEL); | 10595 ht.XmlAttributeNode attribute = node.getAttribute(_NG_MODEL); |
| 10342 Expression expression = parseDartExpression(resolver, attribute); | 10596 Expression expression = parseDartExpression(resolver, attribute); |
| 10343 // identifiers have been already handled by "apply top" | 10597 // identifiers have been already handled by "apply top" |
| 10344 if (expression is SimpleIdentifier) { | 10598 if (expression is SimpleIdentifier) { |
| 10345 return; | 10599 return; |
| 10346 } | 10600 } |
| 10347 // resolve | 10601 // resolve |
| 10348 resolver._resolveNode(expression); | 10602 resolver._resolveNode(expression); |
| 10349 // remember expression | 10603 // remember expression |
| 10350 setExpression(attribute, expression); | 10604 setExpression(attribute, expression); |
| 10351 } | 10605 } |
| 10352 | 10606 |
| 10607 @override |
| 10353 bool canApply(ht.XmlTagNode node) => node.getAttribute(_NG_MODEL) != null; | 10608 bool canApply(ht.XmlTagNode node) => node.getAttribute(_NG_MODEL) != null; |
| 10354 | 10609 |
| 10355 /** | 10610 /** |
| 10356 * This method is used to define top-level [VariableElement]s for each "ng-mod
el" with | 10611 * This method is used to define top-level [VariableElement]s for each "ng-mod
el" with |
| 10357 * simple identifier model. | 10612 * simple identifier model. |
| 10358 */ | 10613 */ |
| 10359 void _applyTopDeclarations(AngularHtmlUnitResolver resolver, ht.XmlTagNode nod
e) { | 10614 void _applyTopDeclarations(AngularHtmlUnitResolver resolver, ht.XmlTagNode nod
e) { |
| 10360 ht.XmlAttributeNode attribute = node.getAttribute(_NG_MODEL); | 10615 ht.XmlAttributeNode attribute = node.getAttribute(_NG_MODEL); |
| 10361 Expression expression = parseDartExpression(resolver, attribute); | 10616 Expression expression = parseDartExpression(resolver, attribute); |
| 10362 // if not identifier, then not a top-level model, delay until "apply" | 10617 // if not identifier, then not a top-level model, delay until "apply" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10446 Object perform(AnalysisTaskVisitor visitor) { | 10701 Object perform(AnalysisTaskVisitor visitor) { |
| 10447 try { | 10702 try { |
| 10448 _safelyPerform(); | 10703 _safelyPerform(); |
| 10449 } on AnalysisException catch (exception) { | 10704 } on AnalysisException catch (exception) { |
| 10450 _thrownException = exception; | 10705 _thrownException = exception; |
| 10451 AnalysisEngine.instance.logger.logInformation2("Task failed: ${taskDescrip
tion}", exception); | 10706 AnalysisEngine.instance.logger.logInformation2("Task failed: ${taskDescrip
tion}", exception); |
| 10452 } | 10707 } |
| 10453 return accept(visitor); | 10708 return accept(visitor); |
| 10454 } | 10709 } |
| 10455 | 10710 |
| 10711 @override |
| 10456 String toString() => taskDescription; | 10712 String toString() => taskDescription; |
| 10457 | 10713 |
| 10458 /** | 10714 /** |
| 10459 * Return a textual description of this task. | 10715 * Return a textual description of this task. |
| 10460 * | 10716 * |
| 10461 * @return a textual description of this task | 10717 * @return a textual description of this task |
| 10462 */ | 10718 */ |
| 10463 String get taskDescription; | 10719 String get taskDescription; |
| 10464 | 10720 |
| 10465 /** | 10721 /** |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10637 | 10893 |
| 10638 /** | 10894 /** |
| 10639 * Initialize a newly created task to perform analysis within the given contex
t. | 10895 * Initialize a newly created task to perform analysis within the given contex
t. |
| 10640 * | 10896 * |
| 10641 * @param context the context in which the task is to be performed | 10897 * @param context the context in which the task is to be performed |
| 10642 * @param source the source for which errors and warnings are to be produced | 10898 * @param source the source for which errors and warnings are to be produced |
| 10643 * @param libraryElement the element model for the library containing the sour
ce | 10899 * @param libraryElement the element model for the library containing the sour
ce |
| 10644 */ | 10900 */ |
| 10645 GenerateDartErrorsTask(InternalAnalysisContext context, this.source, this.libr
aryElement) : super(context); | 10901 GenerateDartErrorsTask(InternalAnalysisContext context, this.source, this.libr
aryElement) : super(context); |
| 10646 | 10902 |
| 10903 @override |
| 10647 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartErrorsTask(thi
s); | 10904 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartErrorsTask(thi
s); |
| 10648 | 10905 |
| 10649 /** | 10906 /** |
| 10650 * Return the errors that were generated for the source. | 10907 * Return the errors that were generated for the source. |
| 10651 * | 10908 * |
| 10652 * @return the errors that were generated for the source | 10909 * @return the errors that were generated for the source |
| 10653 */ | 10910 */ |
| 10654 List<AnalysisError> get errors => _errors; | 10911 List<AnalysisError> get errors => _errors; |
| 10655 | 10912 |
| 10656 /** | 10913 /** |
| 10657 * Return the time at which the contents of the source that was verified were
last modified, or a | 10914 * Return the time at which the contents of the source that was verified were
last modified, or a |
| 10658 * negative value if the task has not yet been performed or if an exception oc
curred. | 10915 * negative value if the task has not yet been performed or if an exception oc
curred. |
| 10659 * | 10916 * |
| 10660 * @return the time at which the contents of the source that was verified were
last modified | 10917 * @return the time at which the contents of the source that was verified were
last modified |
| 10661 */ | 10918 */ |
| 10662 int get modificationTime => _modificationTime; | 10919 int get modificationTime => _modificationTime; |
| 10663 | 10920 |
| 10921 @override |
| 10664 String get taskDescription => "generate errors and warnings for ${source.fullN
ame}"; | 10922 String get taskDescription => "generate errors and warnings for ${source.fullN
ame}"; |
| 10665 | 10923 |
| 10924 @override |
| 10666 void internalPerform() { | 10925 void internalPerform() { |
| 10667 InternalAnalysisContext context = this.context; | 10926 InternalAnalysisContext context = this.context; |
| 10668 TimestampedData<CompilationUnit> data = context.internalResolveCompilationUn
it(source, libraryElement); | 10927 TimestampedData<CompilationUnit> data = context.internalResolveCompilationUn
it(source, libraryElement); |
| 10669 TimeCounter_TimeCounterHandle timeCounter = PerformanceStatistics.errors.sta
rt(); | 10928 TimeCounter_TimeCounterHandle timeCounter = PerformanceStatistics.errors.sta
rt(); |
| 10670 try { | 10929 try { |
| 10671 _modificationTime = data.modificationTime; | 10930 _modificationTime = data.modificationTime; |
| 10672 CompilationUnit unit = data.data; | 10931 CompilationUnit unit = data.data; |
| 10673 RecordingErrorListener errorListener = new RecordingErrorListener(); | 10932 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 10674 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); | 10933 ErrorReporter errorReporter = new ErrorReporter(errorListener, source); |
| 10675 TypeProvider typeProvider = context.typeProvider; | 10934 TypeProvider typeProvider = context.typeProvider; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10707 Map<Source, TimestampedData<List<AnalysisError>>> _hintMap; | 10966 Map<Source, TimestampedData<List<AnalysisError>>> _hintMap; |
| 10708 | 10967 |
| 10709 /** | 10968 /** |
| 10710 * Initialize a newly created task to perform analysis within the given contex
t. | 10969 * Initialize a newly created task to perform analysis within the given contex
t. |
| 10711 * | 10970 * |
| 10712 * @param context the context in which the task is to be performed | 10971 * @param context the context in which the task is to be performed |
| 10713 * @param libraryElement the element model for the library being analyzed | 10972 * @param libraryElement the element model for the library being analyzed |
| 10714 */ | 10973 */ |
| 10715 GenerateDartHintsTask(InternalAnalysisContext context, this.libraryElement) :
super(context); | 10974 GenerateDartHintsTask(InternalAnalysisContext context, this.libraryElement) :
super(context); |
| 10716 | 10975 |
| 10976 @override |
| 10717 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartHintsTask(this
); | 10977 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartHintsTask(this
); |
| 10718 | 10978 |
| 10719 /** | 10979 /** |
| 10720 * Return a table mapping the sources that were analyzed to the hints that wer
e generated for the | 10980 * Return a table mapping the sources that were analyzed to the hints that wer
e generated for the |
| 10721 * sources, or `null` if the task has not been performed or if the analysis di
d not complete | 10981 * sources, or `null` if the task has not been performed or if the analysis di
d not complete |
| 10722 * normally. | 10982 * normally. |
| 10723 * | 10983 * |
| 10724 * @return a table mapping the sources that were analyzed to the hints that we
re generated for the | 10984 * @return a table mapping the sources that were analyzed to the hints that we
re generated for the |
| 10725 * sources | 10985 * sources |
| 10726 */ | 10986 */ |
| 10727 Map<Source, TimestampedData<List<AnalysisError>>> get hintMap => _hintMap; | 10987 Map<Source, TimestampedData<List<AnalysisError>>> get hintMap => _hintMap; |
| 10728 | 10988 |
| 10989 @override |
| 10729 String get taskDescription { | 10990 String get taskDescription { |
| 10730 Source librarySource = libraryElement.source; | 10991 Source librarySource = libraryElement.source; |
| 10731 if (librarySource == null) { | 10992 if (librarySource == null) { |
| 10732 return "generate Dart hints for library without source"; | 10993 return "generate Dart hints for library without source"; |
| 10733 } | 10994 } |
| 10734 return "generate Dart hints for ${librarySource.fullName}"; | 10995 return "generate Dart hints for ${librarySource.fullName}"; |
| 10735 } | 10996 } |
| 10736 | 10997 |
| 10998 @override |
| 10737 void internalPerform() { | 10999 void internalPerform() { |
| 10738 RecordingErrorListener errorListener = new RecordingErrorListener(); | 11000 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 10739 List<CompilationUnitElement> parts = libraryElement.parts; | 11001 List<CompilationUnitElement> parts = libraryElement.parts; |
| 10740 int partCount = parts.length; | 11002 int partCount = parts.length; |
| 10741 List<CompilationUnit> compilationUnits = new List<CompilationUnit>(partCount
+ 1); | 11003 List<CompilationUnit> compilationUnits = new List<CompilationUnit>(partCount
+ 1); |
| 10742 Map<Source, TimestampedData<CompilationUnit>> timestampMap = new Map<Source,
TimestampedData<CompilationUnit>>(); | 11004 Map<Source, TimestampedData<CompilationUnit>> timestampMap = new Map<Source,
TimestampedData<CompilationUnit>>(); |
| 10743 // | 11005 // |
| 10744 // Get all of the (fully resolved) compilation units that will be analyzed. | 11006 // Get all of the (fully resolved) compilation units that will be analyzed. |
| 10745 // | 11007 // |
| 10746 Source unitSource = libraryElement.definingCompilationUnit.source; | 11008 Source unitSource = libraryElement.definingCompilationUnit.source; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10818 * @param context the context in which the task is to be performed | 11080 * @param context the context in which the task is to be performed |
| 10819 * @param source the source to be parsed | 11081 * @param source the source to be parsed |
| 10820 * @param contentData the time-stamped contents of the source | 11082 * @param contentData the time-stamped contents of the source |
| 10821 */ | 11083 */ |
| 10822 GetContentTask(InternalAnalysisContext context, this.source) : super(context)
{ | 11084 GetContentTask(InternalAnalysisContext context, this.source) : super(context)
{ |
| 10823 if (source == null) { | 11085 if (source == null) { |
| 10824 throw new IllegalArgumentException("Cannot get contents of null source"); | 11086 throw new IllegalArgumentException("Cannot get contents of null source"); |
| 10825 } | 11087 } |
| 10826 } | 11088 } |
| 10827 | 11089 |
| 11090 @override |
| 10828 accept(AnalysisTaskVisitor visitor) => visitor.visitGetContentTask(this); | 11091 accept(AnalysisTaskVisitor visitor) => visitor.visitGetContentTask(this); |
| 10829 | 11092 |
| 10830 /** | 11093 /** |
| 10831 * Return the contents of the source, or `null` if the task has not completed
or if there | 11094 * Return the contents of the source, or `null` if the task has not completed
or if there |
| 10832 * was an exception while getting the contents. | 11095 * was an exception while getting the contents. |
| 10833 * | 11096 * |
| 10834 * @return the contents of the source | 11097 * @return the contents of the source |
| 10835 */ | 11098 */ |
| 10836 String get content => _content; | 11099 String get content => _content; |
| 10837 | 11100 |
| 10838 /** | 11101 /** |
| 10839 * Return the time at which the contents of the source that was parsed were la
st modified, or a | 11102 * Return the time at which the contents of the source that was parsed were la
st modified, or a |
| 10840 * negative value if the task has not yet been performed or if an exception oc
curred. | 11103 * negative value if the task has not yet been performed or if an exception oc
curred. |
| 10841 * | 11104 * |
| 10842 * @return the time at which the contents of the source that was parsed were l
ast modified | 11105 * @return the time at which the contents of the source that was parsed were l
ast modified |
| 10843 */ | 11106 */ |
| 10844 int get modificationTime => _modificationTime; | 11107 int get modificationTime => _modificationTime; |
| 10845 | 11108 |
| 10846 /** | 11109 /** |
| 10847 * Return `true` if this task is complete. Unlike most tasks, this task is all
owed to be | 11110 * Return `true` if this task is complete. Unlike most tasks, this task is all
owed to be |
| 10848 * visited more than once in order to support asynchronous IO. If the task is
not complete when it | 11111 * visited more than once in order to support asynchronous IO. If the task is
not complete when it |
| 10849 * is visited synchronously as part of the [AnalysisTask#perform] | 11112 * is visited synchronously as part of the [AnalysisTask#perform] |
| 10850 * method, it will be visited again, using the same visitor, when the IO opera
tion has been | 11113 * method, it will be visited again, using the same visitor, when the IO opera
tion has been |
| 10851 * performed. | 11114 * performed. |
| 10852 * | 11115 * |
| 10853 * @return `true` if this task is complete | 11116 * @return `true` if this task is complete |
| 10854 */ | 11117 */ |
| 10855 bool get isComplete => _complete; | 11118 bool get isComplete => _complete; |
| 10856 | 11119 |
| 11120 @override |
| 10857 String get taskDescription => "get contents of ${source.fullName}"; | 11121 String get taskDescription => "get contents of ${source.fullName}"; |
| 10858 | 11122 |
| 11123 @override |
| 10859 void internalPerform() { | 11124 void internalPerform() { |
| 10860 _complete = true; | 11125 _complete = true; |
| 10861 try { | 11126 try { |
| 10862 TimestampedData<String> data = context.getContents(source); | 11127 TimestampedData<String> data = context.getContents(source); |
| 10863 _content = data.data; | 11128 _content = data.data; |
| 10864 _modificationTime = data.modificationTime; | 11129 _modificationTime = data.modificationTime; |
| 10865 } on JavaException catch (exception) { | 11130 } on JavaException catch (exception) { |
| 10866 throw new AnalysisException.con2("Could not get contents of ${source}", ex
ception); | 11131 throw new AnalysisException.con2("Could not get contents of ${source}", ex
ception); |
| 10867 } | 11132 } |
| 10868 } | 11133 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 10883 CompilationUnit _updatedUnit; | 11148 CompilationUnit _updatedUnit; |
| 10884 | 11149 |
| 10885 /** | 11150 /** |
| 10886 * Initialize a newly created task to perform analysis within the given contex
t. | 11151 * Initialize a newly created task to perform analysis within the given contex
t. |
| 10887 * | 11152 * |
| 10888 * @param context the context in which the task is to be performed | 11153 * @param context the context in which the task is to be performed |
| 10889 * @param cache the incremental analysis cache used to perform the analysis | 11154 * @param cache the incremental analysis cache used to perform the analysis |
| 10890 */ | 11155 */ |
| 10891 IncrementalAnalysisTask(InternalAnalysisContext context, this.cache) : super(c
ontext); | 11156 IncrementalAnalysisTask(InternalAnalysisContext context, this.cache) : super(c
ontext); |
| 10892 | 11157 |
| 11158 @override |
| 10893 accept(AnalysisTaskVisitor visitor) => visitor.visitIncrementalAnalysisTask(th
is); | 11159 accept(AnalysisTaskVisitor visitor) => visitor.visitIncrementalAnalysisTask(th
is); |
| 10894 | 11160 |
| 10895 /** | 11161 /** |
| 10896 * Return the compilation unit that was produced by incrementally updating the
existing | 11162 * Return the compilation unit that was produced by incrementally updating the
existing |
| 10897 * compilation unit, or `null` if the task has not yet been performed, could n
ot be | 11163 * compilation unit, or `null` if the task has not yet been performed, could n
ot be |
| 10898 * performed, or if an exception occurred. | 11164 * performed, or if an exception occurred. |
| 10899 * | 11165 * |
| 10900 * @return the compilation unit | 11166 * @return the compilation unit |
| 10901 */ | 11167 */ |
| 10902 CompilationUnit get compilationUnit => _updatedUnit; | 11168 CompilationUnit get compilationUnit => _updatedUnit; |
| 10903 | 11169 |
| 10904 /** | 11170 /** |
| 10905 * Return the source that is to be incrementally analyzed. | 11171 * Return the source that is to be incrementally analyzed. |
| 10906 * | 11172 * |
| 10907 * @return the source | 11173 * @return the source |
| 10908 */ | 11174 */ |
| 10909 Source get source => cache != null ? cache.source : null; | 11175 Source get source => cache != null ? cache.source : null; |
| 10910 | 11176 |
| 11177 @override |
| 10911 String get taskDescription => "incremental analysis ${(cache != null ? cache.s
ource : "null")}"; | 11178 String get taskDescription => "incremental analysis ${(cache != null ? cache.s
ource : "null")}"; |
| 10912 | 11179 |
| 11180 @override |
| 10913 void internalPerform() { | 11181 void internalPerform() { |
| 10914 if (cache == null) { | 11182 if (cache == null) { |
| 10915 return; | 11183 return; |
| 10916 } | 11184 } |
| 10917 // Only handle small changes | 11185 // Only handle small changes |
| 10918 if (cache.oldLength > 0 || cache.newLength > 30) { | 11186 if (cache.oldLength > 0 || cache.newLength > 30) { |
| 10919 return; | 11187 return; |
| 10920 } | 11188 } |
| 10921 // Produce an updated token stream | 11189 // Produce an updated token stream |
| 10922 CharacterReader reader = new CharSequenceReader(cache.newContents); | 11190 CharacterReader reader = new CharSequenceReader(cache.newContents); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11001 * | 11269 * |
| 11002 * @param context the context in which the task is to be performed | 11270 * @param context the context in which the task is to be performed |
| 11003 * @param source the source to be parsed | 11271 * @param source the source to be parsed |
| 11004 * @param modificationTime the time at which the contents of the source were l
ast modified | 11272 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 11005 * @param tokenStream the head of the token stream used for parsing | 11273 * @param tokenStream the head of the token stream used for parsing |
| 11006 */ | 11274 */ |
| 11007 ParseDartTask(InternalAnalysisContext context, this.source, this.modificationT
ime, Token tokenStream) : super(context) { | 11275 ParseDartTask(InternalAnalysisContext context, this.source, this.modificationT
ime, Token tokenStream) : super(context) { |
| 11008 this._tokenStream = tokenStream; | 11276 this._tokenStream = tokenStream; |
| 11009 } | 11277 } |
| 11010 | 11278 |
| 11279 @override |
| 11011 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this); | 11280 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this); |
| 11012 | 11281 |
| 11013 /** | 11282 /** |
| 11014 * Return the compilation unit that was produced by parsing the source, or `nu
ll` if the | 11283 * Return the compilation unit that was produced by parsing the source, or `nu
ll` if the |
| 11015 * task has not yet been performed or if an exception occurred. | 11284 * task has not yet been performed or if an exception occurred. |
| 11016 * | 11285 * |
| 11017 * @return the compilation unit that was produced by parsing the source | 11286 * @return the compilation unit that was produced by parsing the source |
| 11018 */ | 11287 */ |
| 11019 CompilationUnit get compilationUnit => _unit; | 11288 CompilationUnit get compilationUnit => _unit; |
| 11020 | 11289 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 11035 bool get hasLibraryDirective => _containsLibraryDirective; | 11304 bool get hasLibraryDirective => _containsLibraryDirective; |
| 11036 | 11305 |
| 11037 /** | 11306 /** |
| 11038 * Return `true` if the source contains a 'part of' directive, or `false` if t
he task | 11307 * Return `true` if the source contains a 'part of' directive, or `false` if t
he task |
| 11039 * has not yet been performed or if an exception occurred. | 11308 * has not yet been performed or if an exception occurred. |
| 11040 * | 11309 * |
| 11041 * @return `true` if the source contains a 'part of' directive | 11310 * @return `true` if the source contains a 'part of' directive |
| 11042 */ | 11311 */ |
| 11043 bool get hasPartOfDirective => _containsPartOfDirective; | 11312 bool get hasPartOfDirective => _containsPartOfDirective; |
| 11044 | 11313 |
| 11314 @override |
| 11045 String get taskDescription { | 11315 String get taskDescription { |
| 11046 if (source == null) { | 11316 if (source == null) { |
| 11047 return "parse as dart null source"; | 11317 return "parse as dart null source"; |
| 11048 } | 11318 } |
| 11049 return "parse as dart ${source.fullName}"; | 11319 return "parse as dart ${source.fullName}"; |
| 11050 } | 11320 } |
| 11051 | 11321 |
| 11322 @override |
| 11052 void internalPerform() { | 11323 void internalPerform() { |
| 11053 RecordingErrorListener errorListener = new RecordingErrorListener(); | 11324 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 11054 InternalAnalysisContext context = this.context; | 11325 InternalAnalysisContext context = this.context; |
| 11055 // | 11326 // |
| 11056 // Then parse the token stream. | 11327 // Then parse the token stream. |
| 11057 // | 11328 // |
| 11058 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); | 11329 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); |
| 11059 try { | 11330 try { |
| 11060 Parser parser = new Parser(source, errorListener); | 11331 Parser parser = new Parser(source, errorListener); |
| 11061 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies
; | 11332 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies
; |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11129 * | 11400 * |
| 11130 * @param context the context in which the task is to be performed | 11401 * @param context the context in which the task is to be performed |
| 11131 * @param source the source to be parsed | 11402 * @param source the source to be parsed |
| 11132 * @param modificationTime the time at which the contents of the source were l
ast modified | 11403 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 11133 * @param content the contents of the source | 11404 * @param content the contents of the source |
| 11134 */ | 11405 */ |
| 11135 ParseHtmlTask(InternalAnalysisContext context, this.source, this.modificationT
ime, String content) : super(context) { | 11406 ParseHtmlTask(InternalAnalysisContext context, this.source, this.modificationT
ime, String content) : super(context) { |
| 11136 this._content = content; | 11407 this._content = content; |
| 11137 } | 11408 } |
| 11138 | 11409 |
| 11410 @override |
| 11139 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this); | 11411 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this); |
| 11140 | 11412 |
| 11141 /** | 11413 /** |
| 11142 * Return the errors that were produced by scanning and parsing the source, or
`null` if the | 11414 * Return the errors that were produced by scanning and parsing the source, or
`null` if the |
| 11143 * task has not yet been performed or if an exception occurred. | 11415 * task has not yet been performed or if an exception occurred. |
| 11144 * | 11416 * |
| 11145 * @return the errors that were produced by scanning and parsing the source | 11417 * @return the errors that were produced by scanning and parsing the source |
| 11146 */ | 11418 */ |
| 11147 List<AnalysisError> get errors => _errors; | 11419 List<AnalysisError> get errors => _errors; |
| 11148 | 11420 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 11161 */ | 11433 */ |
| 11162 LineInfo get lineInfo => _lineInfo; | 11434 LineInfo get lineInfo => _lineInfo; |
| 11163 | 11435 |
| 11164 /** | 11436 /** |
| 11165 * Return an array containing the sources of the libraries that are referenced
within the HTML. | 11437 * Return an array containing the sources of the libraries that are referenced
within the HTML. |
| 11166 * | 11438 * |
| 11167 * @return the sources of the libraries that are referenced within the HTML | 11439 * @return the sources of the libraries that are referenced within the HTML |
| 11168 */ | 11440 */ |
| 11169 List<Source> get referencedLibraries => _referencedLibraries; | 11441 List<Source> get referencedLibraries => _referencedLibraries; |
| 11170 | 11442 |
| 11443 @override |
| 11171 String get taskDescription { | 11444 String get taskDescription { |
| 11172 if (source == null) { | 11445 if (source == null) { |
| 11173 return "parse as html null source"; | 11446 return "parse as html null source"; |
| 11174 } | 11447 } |
| 11175 return "parse as html ${source.fullName}"; | 11448 return "parse as html ${source.fullName}"; |
| 11176 } | 11449 } |
| 11177 | 11450 |
| 11451 @override |
| 11178 void internalPerform() { | 11452 void internalPerform() { |
| 11179 try { | 11453 try { |
| 11180 ht.AbstractScanner scanner = new ht.StringScanner(source, _content); | 11454 ht.AbstractScanner scanner = new ht.StringScanner(source, _content); |
| 11181 scanner.passThroughElements = <String> [_TAG_SCRIPT]; | 11455 scanner.passThroughElements = <String> [_TAG_SCRIPT]; |
| 11182 ht.Token token = scanner.tokenize(); | 11456 ht.Token token = scanner.tokenize(); |
| 11183 _lineInfo = new LineInfo(scanner.lineStarts); | 11457 _lineInfo = new LineInfo(scanner.lineStarts); |
| 11184 RecordingErrorListener errorListener = new RecordingErrorListener(); | 11458 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 11185 _unit = new ht.HtmlParser(source, errorListener).parse(token, _lineInfo); | 11459 _unit = new ht.HtmlParser(source, errorListener).parse(token, _lineInfo); |
| 11186 _errors = errorListener.getErrorsForSource(source); | 11460 _errors = errorListener.getErrorsForSource(source); |
| 11187 _referencedLibraries = librarySources; | 11461 _referencedLibraries = librarySources; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 11205 } | 11479 } |
| 11206 } | 11480 } |
| 11207 | 11481 |
| 11208 class RecursiveXmlVisitor_ParseHtmlTask_getLibrarySources extends ht.RecursiveXm
lVisitor<Object> { | 11482 class RecursiveXmlVisitor_ParseHtmlTask_getLibrarySources extends ht.RecursiveXm
lVisitor<Object> { |
| 11209 final ParseHtmlTask ParseHtmlTask_this; | 11483 final ParseHtmlTask ParseHtmlTask_this; |
| 11210 | 11484 |
| 11211 List<Source> libraries; | 11485 List<Source> libraries; |
| 11212 | 11486 |
| 11213 RecursiveXmlVisitor_ParseHtmlTask_getLibrarySources(this.ParseHtmlTask_this, t
his.libraries) : super(); | 11487 RecursiveXmlVisitor_ParseHtmlTask_getLibrarySources(this.ParseHtmlTask_this, t
his.libraries) : super(); |
| 11214 | 11488 |
| 11489 @override |
| 11215 Object visitHtmlScriptTagNode(ht.HtmlScriptTagNode node) { | 11490 Object visitHtmlScriptTagNode(ht.HtmlScriptTagNode node) { |
| 11216 ht.XmlAttributeNode scriptAttribute = null; | 11491 ht.XmlAttributeNode scriptAttribute = null; |
| 11217 for (ht.XmlAttributeNode attribute in node.attributes) { | 11492 for (ht.XmlAttributeNode attribute in node.attributes) { |
| 11218 if (javaStringEqualsIgnoreCase(attribute.name, ParseHtmlTask._ATTRIBUTE_SR
C)) { | 11493 if (javaStringEqualsIgnoreCase(attribute.name, ParseHtmlTask._ATTRIBUTE_SR
C)) { |
| 11219 scriptAttribute = attribute; | 11494 scriptAttribute = attribute; |
| 11220 } | 11495 } |
| 11221 } | 11496 } |
| 11222 if (scriptAttribute != null) { | 11497 if (scriptAttribute != null) { |
| 11223 try { | 11498 try { |
| 11224 Uri uri = new Uri(path: scriptAttribute.text); | 11499 Uri uri = new Uri(path: scriptAttribute.text); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11283 * @param unit the HTML unit to be resolved | 11558 * @param unit the HTML unit to be resolved |
| 11284 * @param component the component that uses this HTML template, not `null` | 11559 * @param component the component that uses this HTML template, not `null` |
| 11285 * @param application the Angular application to resolve in context of | 11560 * @param application the Angular application to resolve in context of |
| 11286 */ | 11561 */ |
| 11287 ResolveAngularComponentTemplateTask(InternalAnalysisContext context, this.sour
ce, this.modificationTime, ht.HtmlUnit unit, AngularComponentElement component,
AngularApplication application) : super(context) { | 11562 ResolveAngularComponentTemplateTask(InternalAnalysisContext context, this.sour
ce, this.modificationTime, ht.HtmlUnit unit, AngularComponentElement component,
AngularApplication application) : super(context) { |
| 11288 this._unit = unit; | 11563 this._unit = unit; |
| 11289 this._component = component; | 11564 this._component = component; |
| 11290 this._application = application; | 11565 this._application = application; |
| 11291 } | 11566 } |
| 11292 | 11567 |
| 11568 @override |
| 11293 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularComponentTem
plateTask(this); | 11569 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularComponentTem
plateTask(this); |
| 11294 | 11570 |
| 11295 List<AnalysisError> get resolutionErrors => _resolutionErrors; | 11571 List<AnalysisError> get resolutionErrors => _resolutionErrors; |
| 11296 | 11572 |
| 11297 /** | 11573 /** |
| 11298 * Return the [HtmlUnit] that was resolved by this task. | 11574 * Return the [HtmlUnit] that was resolved by this task. |
| 11299 * | 11575 * |
| 11300 * @return the [HtmlUnit] that was resolved by this task | 11576 * @return the [HtmlUnit] that was resolved by this task |
| 11301 */ | 11577 */ |
| 11302 ht.HtmlUnit get resolvedUnit => _resolvedUnit; | 11578 ht.HtmlUnit get resolvedUnit => _resolvedUnit; |
| 11303 | 11579 |
| 11580 @override |
| 11304 String get taskDescription => "resolving Angular template ${source}"; | 11581 String get taskDescription => "resolving Angular template ${source}"; |
| 11305 | 11582 |
| 11583 @override |
| 11306 void internalPerform() { | 11584 void internalPerform() { |
| 11307 // | 11585 // |
| 11308 // Prepare for resolution. | 11586 // Prepare for resolution. |
| 11309 // | 11587 // |
| 11310 RecordingErrorListener errorListener = new RecordingErrorListener(); | 11588 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 11311 LineInfo lineInfo = context.getLineInfo(source); | 11589 LineInfo lineInfo = context.getLineInfo(source); |
| 11312 // | 11590 // |
| 11313 // Perform resolution. | 11591 // Perform resolution. |
| 11314 // | 11592 // |
| 11315 if (_application != null) { | 11593 if (_application != null) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11369 * | 11647 * |
| 11370 * @param context the context in which the task is to be performed | 11648 * @param context the context in which the task is to be performed |
| 11371 * @param source the source to be resolved | 11649 * @param source the source to be resolved |
| 11372 * @param modificationTime the time at which the contents of the source were l
ast modified | 11650 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 11373 * @param unit the HTML unit to be resolved | 11651 * @param unit the HTML unit to be resolved |
| 11374 */ | 11652 */ |
| 11375 ResolveAngularEntryHtmlTask(InternalAnalysisContext context, this.source, this
.modificationTime, ht.HtmlUnit unit) : super(context) { | 11653 ResolveAngularEntryHtmlTask(InternalAnalysisContext context, this.source, this
.modificationTime, ht.HtmlUnit unit) : super(context) { |
| 11376 this._unit = unit; | 11654 this._unit = unit; |
| 11377 } | 11655 } |
| 11378 | 11656 |
| 11657 @override |
| 11379 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularEntryHtmlTas
k(this); | 11658 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularEntryHtmlTas
k(this); |
| 11380 | 11659 |
| 11381 /** | 11660 /** |
| 11382 * Returns the [AngularApplication] for the Web application with this Angular
entry point, | 11661 * Returns the [AngularApplication] for the Web application with this Angular
entry point, |
| 11383 * maybe `null` if not an Angular entry point. | 11662 * maybe `null` if not an Angular entry point. |
| 11384 */ | 11663 */ |
| 11385 AngularApplication get application => _application; | 11664 AngularApplication get application => _application; |
| 11386 | 11665 |
| 11387 HtmlElement get element => _element; | 11666 HtmlElement get element => _element; |
| 11388 | 11667 |
| 11389 /** | 11668 /** |
| 11390 * The resolution errors that were discovered while resolving the source. | 11669 * The resolution errors that were discovered while resolving the source. |
| 11391 */ | 11670 */ |
| 11392 List<AnalysisError> get entryErrors => _errorListener.getErrorsForSource(sourc
e); | 11671 List<AnalysisError> get entryErrors => _errorListener.getErrorsForSource(sourc
e); |
| 11393 | 11672 |
| 11394 /** | 11673 /** |
| 11395 * Returns [AnalysisError]s recorded for the given [Source]. | 11674 * Returns [AnalysisError]s recorded for the given [Source]. |
| 11396 */ | 11675 */ |
| 11397 List<AnalysisError> getErrors(Source source) => _errorListener.getErrorsForSou
rce(source); | 11676 List<AnalysisError> getErrors(Source source) => _errorListener.getErrorsForSou
rce(source); |
| 11398 | 11677 |
| 11399 /** | 11678 /** |
| 11400 * Return the [HtmlUnit] that was resolved by this task. | 11679 * Return the [HtmlUnit] that was resolved by this task. |
| 11401 * | 11680 * |
| 11402 * @return the [HtmlUnit] that was resolved by this task | 11681 * @return the [HtmlUnit] that was resolved by this task |
| 11403 */ | 11682 */ |
| 11404 ht.HtmlUnit get resolvedUnit => _resolvedUnit; | 11683 ht.HtmlUnit get resolvedUnit => _resolvedUnit; |
| 11405 | 11684 |
| 11685 @override |
| 11406 String get taskDescription { | 11686 String get taskDescription { |
| 11407 if (source == null) { | 11687 if (source == null) { |
| 11408 return "resolve as Angular entry point null source"; | 11688 return "resolve as Angular entry point null source"; |
| 11409 } | 11689 } |
| 11410 return "resolve as Angular entry point ${source.fullName}"; | 11690 return "resolve as Angular entry point ${source.fullName}"; |
| 11411 } | 11691 } |
| 11412 | 11692 |
| 11693 @override |
| 11413 void internalPerform() { | 11694 void internalPerform() { |
| 11414 // | 11695 // |
| 11415 // Prepare for resolution. | 11696 // Prepare for resolution. |
| 11416 // | 11697 // |
| 11417 LineInfo lineInfo = context.getLineInfo(source); | 11698 LineInfo lineInfo = context.getLineInfo(source); |
| 11418 // | 11699 // |
| 11419 // Try to resolve as an Angular entry point. | 11700 // Try to resolve as an Angular entry point. |
| 11420 // | 11701 // |
| 11421 _application = new AngularHtmlUnitResolver(context, _errorListener, source,
lineInfo, _unit).calculateAngularApplication(); | 11702 _application = new AngularHtmlUnitResolver(context, _errorListener, source,
lineInfo, _unit).calculateAngularApplication(); |
| 11422 // | 11703 // |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11472 * | 11753 * |
| 11473 * @param context the context in which the task is to be performed | 11754 * @param context the context in which the task is to be performed |
| 11474 * @param source the source to be parsed | 11755 * @param source the source to be parsed |
| 11475 * @param modificationTime the time at which the contents of the source were l
ast modified | 11756 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 11476 * @param unit the compilation unit used to resolve the dependencies | 11757 * @param unit the compilation unit used to resolve the dependencies |
| 11477 */ | 11758 */ |
| 11478 ResolveDartDependenciesTask(InternalAnalysisContext context, this.source, this
.modificationTime, CompilationUnit unit) : super(context) { | 11759 ResolveDartDependenciesTask(InternalAnalysisContext context, this.source, this
.modificationTime, CompilationUnit unit) : super(context) { |
| 11479 this._unit = unit; | 11760 this._unit = unit; |
| 11480 } | 11761 } |
| 11481 | 11762 |
| 11763 @override |
| 11482 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartDependenciesTas
k(this); | 11764 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartDependenciesTas
k(this); |
| 11483 | 11765 |
| 11484 /** | 11766 /** |
| 11485 * Return an array containing the sources referenced by 'export' directives, o
r an empty array if | 11767 * Return an array containing the sources referenced by 'export' directives, o
r an empty array if |
| 11486 * the task has not yet been performed or if an exception occurred. | 11768 * the task has not yet been performed or if an exception occurred. |
| 11487 * | 11769 * |
| 11488 * @return an array containing the sources referenced by 'export' directives | 11770 * @return an array containing the sources referenced by 'export' directives |
| 11489 */ | 11771 */ |
| 11490 List<Source> get exportedSources => _toArray(_exportedSources); | 11772 List<Source> get exportedSources => _toArray(_exportedSources); |
| 11491 | 11773 |
| 11492 /** | 11774 /** |
| 11493 * Return an array containing the sources referenced by 'import' directives, o
r an empty array if | 11775 * Return an array containing the sources referenced by 'import' directives, o
r an empty array if |
| 11494 * the task has not yet been performed or if an exception occurred. | 11776 * the task has not yet been performed or if an exception occurred. |
| 11495 * | 11777 * |
| 11496 * @return an array containing the sources referenced by 'import' directives | 11778 * @return an array containing the sources referenced by 'import' directives |
| 11497 */ | 11779 */ |
| 11498 List<Source> get importedSources => _toArray(_importedSources); | 11780 List<Source> get importedSources => _toArray(_importedSources); |
| 11499 | 11781 |
| 11500 /** | 11782 /** |
| 11501 * Return an array containing the sources referenced by 'part' directives, or
an empty array if | 11783 * Return an array containing the sources referenced by 'part' directives, or
an empty array if |
| 11502 * the task has not yet been performed or if an exception occurred. | 11784 * the task has not yet been performed or if an exception occurred. |
| 11503 * | 11785 * |
| 11504 * @return an array containing the sources referenced by 'part' directives | 11786 * @return an array containing the sources referenced by 'part' directives |
| 11505 */ | 11787 */ |
| 11506 List<Source> get includedSources => _toArray(_includedSources); | 11788 List<Source> get includedSources => _toArray(_includedSources); |
| 11507 | 11789 |
| 11790 @override |
| 11508 String get taskDescription { | 11791 String get taskDescription { |
| 11509 if (source == null) { | 11792 if (source == null) { |
| 11510 return "resolve dart dependencies null source"; | 11793 return "resolve dart dependencies null source"; |
| 11511 } | 11794 } |
| 11512 return "resolve dart dependencies ${source.fullName}"; | 11795 return "resolve dart dependencies ${source.fullName}"; |
| 11513 } | 11796 } |
| 11514 | 11797 |
| 11798 @override |
| 11515 void internalPerform() { | 11799 void internalPerform() { |
| 11516 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); | 11800 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); |
| 11517 try { | 11801 try { |
| 11518 for (Directive directive in _unit.directives) { | 11802 for (Directive directive in _unit.directives) { |
| 11519 if (directive is ExportDirective) { | 11803 if (directive is ExportDirective) { |
| 11520 Source exportSource = _resolveSource(source, directive); | 11804 Source exportSource = _resolveSource(source, directive); |
| 11521 if (exportSource != null) { | 11805 if (exportSource != null) { |
| 11522 _exportedSources.add(exportSource); | 11806 _exportedSources.add(exportSource); |
| 11523 } | 11807 } |
| 11524 } else if (directive is ImportDirective) { | 11808 } else if (directive is ImportDirective) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11600 | 11884 |
| 11601 /** | 11885 /** |
| 11602 * Initialize a newly created task to perform analysis within the given contex
t. | 11886 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11603 * | 11887 * |
| 11604 * @param context the context in which the task is to be performed | 11888 * @param context the context in which the task is to be performed |
| 11605 * @param unitSource the source representing the file whose compilation unit i
s to be returned | 11889 * @param unitSource the source representing the file whose compilation unit i
s to be returned |
| 11606 * @param librarySource the source representing the library to be resolved | 11890 * @param librarySource the source representing the library to be resolved |
| 11607 */ | 11891 */ |
| 11608 ResolveDartLibraryTask(InternalAnalysisContext context, this.unitSource, this.
librarySource) : super(context); | 11892 ResolveDartLibraryTask(InternalAnalysisContext context, this.unitSource, this.
librarySource) : super(context); |
| 11609 | 11893 |
| 11894 @override |
| 11610 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartLibraryTask(thi
s); | 11895 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartLibraryTask(thi
s); |
| 11611 | 11896 |
| 11612 /** | 11897 /** |
| 11613 * Return the library resolver holding information about the libraries that we
re resolved. | 11898 * Return the library resolver holding information about the libraries that we
re resolved. |
| 11614 * | 11899 * |
| 11615 * @return the library resolver holding information about the libraries that w
ere resolved | 11900 * @return the library resolver holding information about the libraries that w
ere resolved |
| 11616 */ | 11901 */ |
| 11617 LibraryResolver get libraryResolver => _resolver; | 11902 LibraryResolver get libraryResolver => _resolver; |
| 11618 | 11903 |
| 11904 @override |
| 11619 String get taskDescription { | 11905 String get taskDescription { |
| 11620 if (librarySource == null) { | 11906 if (librarySource == null) { |
| 11621 return "resolve library null source"; | 11907 return "resolve library null source"; |
| 11622 } | 11908 } |
| 11623 return "resolve library ${librarySource.fullName}"; | 11909 return "resolve library ${librarySource.fullName}"; |
| 11624 } | 11910 } |
| 11625 | 11911 |
| 11912 @override |
| 11626 void internalPerform() { | 11913 void internalPerform() { |
| 11627 _resolver = new LibraryResolver(context); | 11914 _resolver = new LibraryResolver(context); |
| 11628 _resolver.resolveLibrary(librarySource, true); | 11915 _resolver.resolveLibrary(librarySource, true); |
| 11629 } | 11916 } |
| 11630 } | 11917 } |
| 11631 | 11918 |
| 11632 /** | 11919 /** |
| 11633 * Instances of the class `ResolveDartUnitTask` resolve a single Dart file based
on a existing | 11920 * Instances of the class `ResolveDartUnitTask` resolve a single Dart file based
on a existing |
| 11634 * element model. | 11921 * element model. |
| 11635 */ | 11922 */ |
| (...skipping 22 matching lines...) Expand all Loading... |
| 11658 * Initialize a newly created task to perform analysis within the given contex
t. | 11945 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11659 * | 11946 * |
| 11660 * @param context the context in which the task is to be performed | 11947 * @param context the context in which the task is to be performed |
| 11661 * @param source the source to be parsed | 11948 * @param source the source to be parsed |
| 11662 * @param libraryElement the element model for the library containing the sour
ce | 11949 * @param libraryElement the element model for the library containing the sour
ce |
| 11663 */ | 11950 */ |
| 11664 ResolveDartUnitTask(InternalAnalysisContext context, this.source, LibraryEleme
nt libraryElement) : super(context) { | 11951 ResolveDartUnitTask(InternalAnalysisContext context, this.source, LibraryEleme
nt libraryElement) : super(context) { |
| 11665 this._libraryElement = libraryElement; | 11952 this._libraryElement = libraryElement; |
| 11666 } | 11953 } |
| 11667 | 11954 |
| 11955 @override |
| 11668 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this); | 11956 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this); |
| 11669 | 11957 |
| 11670 /** | 11958 /** |
| 11671 * Return the source for the library containing the source that is to be resol
ved. | 11959 * Return the source for the library containing the source that is to be resol
ved. |
| 11672 * | 11960 * |
| 11673 * @return the source for the library containing the source that is to be reso
lved | 11961 * @return the source for the library containing the source that is to be reso
lved |
| 11674 */ | 11962 */ |
| 11675 Source get librarySource => _libraryElement.source; | 11963 Source get librarySource => _libraryElement.source; |
| 11676 | 11964 |
| 11677 /** | 11965 /** |
| 11678 * Return the time at which the contents of the source that was parsed were la
st modified, or a | 11966 * Return the time at which the contents of the source that was parsed were la
st modified, or a |
| 11679 * negative value if the task has not yet been performed or if an exception oc
curred. | 11967 * negative value if the task has not yet been performed or if an exception oc
curred. |
| 11680 * | 11968 * |
| 11681 * @return the time at which the contents of the source that was parsed were l
ast modified | 11969 * @return the time at which the contents of the source that was parsed were l
ast modified |
| 11682 */ | 11970 */ |
| 11683 int get modificationTime => _modificationTime; | 11971 int get modificationTime => _modificationTime; |
| 11684 | 11972 |
| 11685 /** | 11973 /** |
| 11686 * Return the compilation unit that was resolved by this task. | 11974 * Return the compilation unit that was resolved by this task. |
| 11687 * | 11975 * |
| 11688 * @return the compilation unit that was resolved by this task | 11976 * @return the compilation unit that was resolved by this task |
| 11689 */ | 11977 */ |
| 11690 CompilationUnit get resolvedUnit => _resolvedUnit; | 11978 CompilationUnit get resolvedUnit => _resolvedUnit; |
| 11691 | 11979 |
| 11980 @override |
| 11692 String get taskDescription { | 11981 String get taskDescription { |
| 11693 Source librarySource = _libraryElement.source; | 11982 Source librarySource = _libraryElement.source; |
| 11694 if (librarySource == null) { | 11983 if (librarySource == null) { |
| 11695 return "resolve unit null source"; | 11984 return "resolve unit null source"; |
| 11696 } | 11985 } |
| 11697 return "resolve unit ${librarySource.fullName}"; | 11986 return "resolve unit ${librarySource.fullName}"; |
| 11698 } | 11987 } |
| 11699 | 11988 |
| 11989 @override |
| 11700 void internalPerform() { | 11990 void internalPerform() { |
| 11701 TypeProvider typeProvider = (_libraryElement.context as InternalAnalysisCont
ext).typeProvider; | 11991 TypeProvider typeProvider = (_libraryElement.context as InternalAnalysisCont
ext).typeProvider; |
| 11702 ResolvableCompilationUnit resolvableUnit = context.computeResolvableCompilat
ionUnit(source); | 11992 ResolvableCompilationUnit resolvableUnit = context.computeResolvableCompilat
ionUnit(source); |
| 11703 _modificationTime = resolvableUnit.modificationTime; | 11993 _modificationTime = resolvableUnit.modificationTime; |
| 11704 CompilationUnit unit = resolvableUnit.compilationUnit; | 11994 CompilationUnit unit = resolvableUnit.compilationUnit; |
| 11705 if (unit == null) { | 11995 if (unit == null) { |
| 11706 throw new AnalysisException.con1("Internal error: computeResolvableCompila
tionUnit returned a value without a parsed Dart unit"); | 11996 throw new AnalysisException.con1("Internal error: computeResolvableCompila
tionUnit returned a value without a parsed Dart unit"); |
| 11707 } | 11997 } |
| 11708 // | 11998 // |
| 11709 // Resolve names in declarations. | 11999 // Resolve names in declarations. |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11808 * | 12098 * |
| 11809 * @param context the context in which the task is to be performed | 12099 * @param context the context in which the task is to be performed |
| 11810 * @param source the source to be resolved | 12100 * @param source the source to be resolved |
| 11811 * @param modificationTime the time at which the contents of the source were l
ast modified | 12101 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 11812 * @param unit the HTML unit to be resolved | 12102 * @param unit the HTML unit to be resolved |
| 11813 */ | 12103 */ |
| 11814 ResolveHtmlTask(InternalAnalysisContext context, this.source, this.modificatio
nTime, ht.HtmlUnit unit) : super(context) { | 12104 ResolveHtmlTask(InternalAnalysisContext context, this.source, this.modificatio
nTime, ht.HtmlUnit unit) : super(context) { |
| 11815 this._unit = unit; | 12105 this._unit = unit; |
| 11816 } | 12106 } |
| 11817 | 12107 |
| 12108 @override |
| 11818 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveHtmlTask(this); | 12109 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveHtmlTask(this); |
| 11819 | 12110 |
| 11820 HtmlElement get element => _element; | 12111 HtmlElement get element => _element; |
| 11821 | 12112 |
| 11822 List<AnalysisError> get resolutionErrors => _resolutionErrors; | 12113 List<AnalysisError> get resolutionErrors => _resolutionErrors; |
| 11823 | 12114 |
| 11824 /** | 12115 /** |
| 11825 * Return the [HtmlUnit] that was resolved by this task. | 12116 * Return the [HtmlUnit] that was resolved by this task. |
| 11826 * | 12117 * |
| 11827 * @return the [HtmlUnit] that was resolved by this task | 12118 * @return the [HtmlUnit] that was resolved by this task |
| 11828 */ | 12119 */ |
| 11829 ht.HtmlUnit get resolvedUnit => _resolvedUnit; | 12120 ht.HtmlUnit get resolvedUnit => _resolvedUnit; |
| 11830 | 12121 |
| 12122 @override |
| 11831 String get taskDescription { | 12123 String get taskDescription { |
| 11832 if (source == null) { | 12124 if (source == null) { |
| 11833 return "resolve as html null source"; | 12125 return "resolve as html null source"; |
| 11834 } | 12126 } |
| 11835 return "resolve as html ${source.fullName}"; | 12127 return "resolve as html ${source.fullName}"; |
| 11836 } | 12128 } |
| 11837 | 12129 |
| 12130 @override |
| 11838 void internalPerform() { | 12131 void internalPerform() { |
| 11839 // | 12132 // |
| 11840 // Build the standard HTML element. | 12133 // Build the standard HTML element. |
| 11841 // | 12134 // |
| 11842 HtmlUnitBuilder builder = new HtmlUnitBuilder(context); | 12135 HtmlUnitBuilder builder = new HtmlUnitBuilder(context); |
| 11843 _element = builder.buildHtmlElement(source, modificationTime, _unit); | 12136 _element = builder.buildHtmlElement(source, modificationTime, _unit); |
| 11844 RecordingErrorListener errorListener = builder.errorListener; | 12137 RecordingErrorListener errorListener = builder.errorListener; |
| 11845 // | 12138 // |
| 11846 // Record all resolution errors. | 12139 // Record all resolution errors. |
| 11847 // | 12140 // |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11892 * | 12185 * |
| 11893 * @param context the context in which the task is to be performed | 12186 * @param context the context in which the task is to be performed |
| 11894 * @param source the source to be parsed | 12187 * @param source the source to be parsed |
| 11895 * @param modificationTime the time at which the contents of the source were l
ast modified | 12188 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 11896 * @param content the contents of the source | 12189 * @param content the contents of the source |
| 11897 */ | 12190 */ |
| 11898 ScanDartTask(InternalAnalysisContext context, this.source, this.modificationTi
me, String content) : super(context) { | 12191 ScanDartTask(InternalAnalysisContext context, this.source, this.modificationTi
me, String content) : super(context) { |
| 11899 this._content = content; | 12192 this._content = content; |
| 11900 } | 12193 } |
| 11901 | 12194 |
| 12195 @override |
| 11902 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this); | 12196 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this); |
| 11903 | 12197 |
| 11904 /** | 12198 /** |
| 11905 * Return the errors that were produced by scanning the source, or `null` if t
he task has | 12199 * Return the errors that were produced by scanning the source, or `null` if t
he task has |
| 11906 * not yet been performed or if an exception occurred. | 12200 * not yet been performed or if an exception occurred. |
| 11907 * | 12201 * |
| 11908 * @return the errors that were produced by scanning the source | 12202 * @return the errors that were produced by scanning the source |
| 11909 */ | 12203 */ |
| 11910 List<AnalysisError> get errors => _errors; | 12204 List<AnalysisError> get errors => _errors; |
| 11911 | 12205 |
| 11912 /** | 12206 /** |
| 11913 * Return the line information that was produced, or `null` if the task has no
t yet been | 12207 * Return the line information that was produced, or `null` if the task has no
t yet been |
| 11914 * performed or if an exception occurred. | 12208 * performed or if an exception occurred. |
| 11915 * | 12209 * |
| 11916 * @return the line information that was produced | 12210 * @return the line information that was produced |
| 11917 */ | 12211 */ |
| 11918 LineInfo get lineInfo => _lineInfo; | 12212 LineInfo get lineInfo => _lineInfo; |
| 11919 | 12213 |
| 11920 /** | 12214 /** |
| 11921 * Return the token stream that was produced by scanning the source, or `null`
if the task | 12215 * Return the token stream that was produced by scanning the source, or `null`
if the task |
| 11922 * has not yet been performed or if an exception occurred. | 12216 * has not yet been performed or if an exception occurred. |
| 11923 * | 12217 * |
| 11924 * @return the token stream that was produced by scanning the source | 12218 * @return the token stream that was produced by scanning the source |
| 11925 */ | 12219 */ |
| 11926 Token get tokenStream => _tokenStream; | 12220 Token get tokenStream => _tokenStream; |
| 11927 | 12221 |
| 12222 @override |
| 11928 String get taskDescription { | 12223 String get taskDescription { |
| 11929 if (source == null) { | 12224 if (source == null) { |
| 11930 return "scan as dart null source"; | 12225 return "scan as dart null source"; |
| 11931 } | 12226 } |
| 11932 return "scan as dart ${source.fullName}"; | 12227 return "scan as dart ${source.fullName}"; |
| 11933 } | 12228 } |
| 11934 | 12229 |
| 12230 @override |
| 11935 void internalPerform() { | 12231 void internalPerform() { |
| 11936 RecordingErrorListener errorListener = new RecordingErrorListener(); | 12232 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 11937 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); | 12233 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); |
| 11938 try { | 12234 try { |
| 11939 Scanner scanner = new Scanner(source, new CharSequenceReader(_content), er
rorListener); | 12235 Scanner scanner = new Scanner(source, new CharSequenceReader(_content), er
rorListener); |
| 11940 scanner.preserveComments = context.analysisOptions.preserveComments; | 12236 scanner.preserveComments = context.analysisOptions.preserveComments; |
| 11941 _tokenStream = scanner.tokenize(); | 12237 _tokenStream = scanner.tokenize(); |
| 11942 _lineInfo = new LineInfo(scanner.lineStarts); | 12238 _lineInfo = new LineInfo(scanner.lineStarts); |
| 11943 _errors = errorListener.getErrorsForSource(source); | 12239 _errors = errorListener.getErrorsForSource(source); |
| 11944 } on JavaException catch (exception) { | 12240 } on JavaException catch (exception) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 11965 * | 12261 * |
| 11966 * @return the unique instance of this class | 12262 * @return the unique instance of this class |
| 11967 */ | 12263 */ |
| 11968 static WaitForAsyncTask get instance => _UniqueInstance; | 12264 static WaitForAsyncTask get instance => _UniqueInstance; |
| 11969 | 12265 |
| 11970 /** | 12266 /** |
| 11971 * Prevent the creation of instances of this class. | 12267 * Prevent the creation of instances of this class. |
| 11972 */ | 12268 */ |
| 11973 WaitForAsyncTask() : super(null); | 12269 WaitForAsyncTask() : super(null); |
| 11974 | 12270 |
| 12271 @override |
| 11975 accept(AnalysisTaskVisitor visitor) => null; | 12272 accept(AnalysisTaskVisitor visitor) => null; |
| 11976 | 12273 |
| 12274 @override |
| 11977 String get taskDescription => "Waiting for async analysis"; | 12275 String get taskDescription => "Waiting for async analysis"; |
| 11978 | 12276 |
| 12277 @override |
| 11979 void internalPerform() { | 12278 void internalPerform() { |
| 11980 } | 12279 } |
| 11981 } | 12280 } |
| 11982 | 12281 |
| 11983 /** | 12282 /** |
| 11984 * The interface `Logger` defines the behavior of objects that can be used to re
ceive | 12283 * The interface `Logger` defines the behavior of objects that can be used to re
ceive |
| 11985 * information about errors within the analysis engine. Implementations usually
write this | 12284 * information about errors within the analysis engine. Implementations usually
write this |
| 11986 * information to a file, but can also record the information for later use (suc
h as during testing) | 12285 * information to a file, but can also record the information for later use (suc
h as during testing) |
| 11987 * or even ignore the information. | 12286 * or even ignore the information. |
| 11988 */ | 12287 */ |
| (...skipping 29 matching lines...) Expand all Loading... |
| 12018 * @param message an explanation of why the error occurred or what it means | 12317 * @param message an explanation of why the error occurred or what it means |
| 12019 * @param exception the exception being logged | 12318 * @param exception the exception being logged |
| 12020 */ | 12319 */ |
| 12021 void logInformation2(String message, Exception exception); | 12320 void logInformation2(String message, Exception exception); |
| 12022 } | 12321 } |
| 12023 | 12322 |
| 12024 /** | 12323 /** |
| 12025 * Implementation of [Logger] that does nothing. | 12324 * Implementation of [Logger] that does nothing. |
| 12026 */ | 12325 */ |
| 12027 class Logger_NullLogger implements Logger { | 12326 class Logger_NullLogger implements Logger { |
| 12327 @override |
| 12028 void logError(String message) { | 12328 void logError(String message) { |
| 12029 } | 12329 } |
| 12030 | 12330 |
| 12331 @override |
| 12031 void logError2(String message, Exception exception) { | 12332 void logError2(String message, Exception exception) { |
| 12032 } | 12333 } |
| 12033 | 12334 |
| 12335 @override |
| 12034 void logInformation(String message) { | 12336 void logInformation(String message) { |
| 12035 } | 12337 } |
| 12036 | 12338 |
| 12339 @override |
| 12037 void logInformation2(String message, Exception exception) { | 12340 void logInformation2(String message, Exception exception) { |
| 12038 } | 12341 } |
| 12039 } | 12342 } |
| OLD | NEW |