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 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
979 if (!source.isInSystemLibrary && (sourceEntry is DartEntry || sourceEntr
y is HtmlEntry)) { | 979 if (!source.isInSystemLibrary && (sourceEntry is DartEntry || sourceEntr
y is HtmlEntry)) { |
980 sourcesToInvalidate.add(source); | 980 sourcesToInvalidate.add(source); |
981 } | 981 } |
982 } | 982 } |
983 int count = sourcesToInvalidate.length; | 983 int count = sourcesToInvalidate.length; |
984 for (int i = 0; i < count; i++) { | 984 for (int i = 0; i < count; i++) { |
985 Source source = sourcesToInvalidate[i]; | 985 Source source = sourcesToInvalidate[i]; |
986 SourceEntry entry = _getReadableSourceEntry(source); | 986 SourceEntry entry = _getReadableSourceEntry(source); |
987 if (entry is DartEntry) { | 987 if (entry is DartEntry) { |
988 DartEntry dartEntry = entry; | 988 DartEntry dartEntry = entry; |
989 _removeFromParts(source, dartEntry); | |
990 DartEntryImpl dartCopy = dartEntry.writableCopy; | 989 DartEntryImpl dartCopy = dartEntry.writableCopy; |
991 dartCopy.invalidateAllResolutionInformation(); | 990 dartCopy.invalidateAllResolutionInformation(); |
992 _cache.put(source, dartCopy); | 991 _cache.put(source, dartCopy); |
993 SourcePriority priority = SourcePriority.UNKNOWN; | 992 SourcePriority priority = SourcePriority.UNKNOWN; |
994 SourceKind kind = dartCopy.kind; | 993 SourceKind kind = dartCopy.kind; |
995 if (kind == SourceKind.LIBRARY) { | 994 if (kind == SourceKind.LIBRARY) { |
996 priority = SourcePriority.LIBRARY; | 995 priority = SourcePriority.LIBRARY; |
997 } else if (kind == SourceKind.PART) { | 996 } else if (kind == SourceKind.PART) { |
998 priority = SourcePriority.NORMAL_PART; | 997 priority = SourcePriority.NORMAL_PART; |
999 } | 998 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 } on ObsoleteSourceAnalysisException catch (exception) { | 1133 } on ObsoleteSourceAnalysisException catch (exception) { |
1135 AnalysisEngine.instance.logger.logInformation2("Could not compute ${Source
Entry.LINE_INFO.toString()}", exception); | 1134 AnalysisEngine.instance.logger.logInformation2("Could not compute ${Source
Entry.LINE_INFO.toString()}", exception); |
1136 } | 1135 } |
1137 return null; | 1136 return null; |
1138 } | 1137 } |
1139 | 1138 |
1140 @override | 1139 @override |
1141 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) { | 1140 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) { |
1142 DartEntry dartEntry = _getReadableDartEntry(source); | 1141 DartEntry dartEntry = _getReadableDartEntry(source); |
1143 if (dartEntry == null) { | 1142 if (dartEntry == null) { |
1144 throw new AnalysisException.con1("computeResolvableCompilationUnit for non
-Dart: ${source.fullName}"); | 1143 throw new AnalysisException("computeResolvableCompilationUnit for non-Dart
: ${source.fullName}"); |
1145 } | 1144 } |
1146 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); | 1145 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); |
1147 DartEntryImpl dartCopy = dartEntry.writableCopy; | 1146 DartEntryImpl dartCopy = dartEntry.writableCopy; |
1148 CompilationUnit unit = dartCopy.resolvableCompilationUnit; | 1147 CompilationUnit unit = dartCopy.resolvableCompilationUnit; |
1149 if (unit == null) { | 1148 if (unit == null) { |
1150 throw new AnalysisException.con2("Internal error: computeResolvableCompila
tionUnit could not parse ${source.fullName}", dartEntry.exception); | 1149 throw new AnalysisException("Internal error: computeResolvableCompilationU
nit could not parse ${source.fullName}", new CaughtException(dartEntry.exception
, null)); |
1151 } | 1150 } |
1152 _cache.put(source, dartCopy); | 1151 _cache.put(source, dartCopy); |
1153 return new ResolvableCompilationUnit.con1(dartCopy.modificationTime, unit); | 1152 return new ResolvableCompilationUnit.con1(dartCopy.modificationTime, unit); |
1154 } | 1153 } |
1155 | 1154 |
1156 @override | 1155 @override |
1157 void dispose() { | 1156 void dispose() { |
1158 _disposed = true; | 1157 _disposed = true; |
1159 } | 1158 } |
1160 | 1159 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1433 } | 1432 } |
1434 Namespace namespace = null; | 1433 Namespace namespace = null; |
1435 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { | 1434 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { |
1436 namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE); | 1435 namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE); |
1437 } | 1436 } |
1438 if (namespace == null) { | 1437 if (namespace == null) { |
1439 NamespaceBuilder builder = new NamespaceBuilder(); | 1438 NamespaceBuilder builder = new NamespaceBuilder(); |
1440 namespace = builder.createPublicNamespaceForLibrary(library); | 1439 namespace = builder.createPublicNamespaceForLibrary(library); |
1441 dartEntry = _getReadableDartEntry(source); | 1440 dartEntry = _getReadableDartEntry(source); |
1442 if (dartEntry == null) { | 1441 if (dartEntry == null) { |
1443 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}")); | 1442 AnalysisEngine.instance.logger.logError2("Could not compute the public n
amespace for ${library.source.fullName}", new CaughtException(new AnalysisExcept
ion("A Dart file became a non-Dart file: ${source.fullName}"), null)); |
1444 return null; | 1443 return null; |
1445 } | 1444 } |
1446 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { | 1445 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { |
1447 DartEntryImpl dartCopy = _getReadableDartEntry(source).writableCopy; | 1446 DartEntryImpl dartCopy = _getReadableDartEntry(source).writableCopy; |
1448 dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace); | 1447 dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace); |
1449 _cache.put(source, dartCopy); | 1448 _cache.put(source, dartCopy); |
1450 } | 1449 } |
1451 } | 1450 } |
1452 return namespace; | 1451 return namespace; |
1453 } | 1452 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1569 } | 1568 } |
1570 } | 1569 } |
1571 statistics.partitionData = _cache.partitionData; | 1570 statistics.partitionData = _cache.partitionData; |
1572 return statistics; | 1571 return statistics; |
1573 } | 1572 } |
1574 | 1573 |
1575 @override | 1574 @override |
1576 TypeProvider get typeProvider { | 1575 TypeProvider get typeProvider { |
1577 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); | 1576 Source coreSource = sourceFactory.forUri(DartSdk.DART_CORE); |
1578 if (coreSource == null) { | 1577 if (coreSource == null) { |
1579 throw new AnalysisException.con1("Could not create a source for dart:core"
); | 1578 throw new AnalysisException("Could not create a source for dart:core"); |
1580 } | 1579 } |
1581 LibraryElement coreElement = computeLibraryElement(coreSource); | 1580 LibraryElement coreElement = computeLibraryElement(coreSource); |
1582 if (coreElement == null) { | 1581 if (coreElement == null) { |
1583 throw new AnalysisException.con1("Could not create an element for dart:cor
e"); | 1582 throw new AnalysisException("Could not create an element for dart:core"); |
1584 } | 1583 } |
1585 return new TypeProviderImpl(coreElement); | 1584 return new TypeProviderImpl(coreElement); |
1586 } | 1585 } |
1587 | 1586 |
1588 @override | 1587 @override |
1589 bool isClientLibrary(Source librarySource) { | 1588 bool isClientLibrary(Source librarySource) { |
1590 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); | 1589 SourceEntry sourceEntry = _getReadableSourceEntry(librarySource); |
1591 if (sourceEntry is DartEntry) { | 1590 if (sourceEntry is DartEntry) { |
1592 DartEntry dartEntry = sourceEntry; | 1591 DartEntry dartEntry = sourceEntry; |
1593 return dartEntry.getValue(DartEntry.IS_CLIENT) && dartEntry.getValue(DartE
ntry.IS_LAUNCHABLE); | 1592 return dartEntry.getValue(DartEntry.IS_CLIENT) && dartEntry.getValue(DartE
ntry.IS_LAUNCHABLE); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 /** | 1859 /** |
1861 * Record the results produced by performing a [ResolveDartLibraryCycleTask].
If the results | 1860 * Record the results produced by performing a [ResolveDartLibraryCycleTask].
If the results |
1862 * were computed from data that is now out-of-date, then the results will not
be recorded. | 1861 * were computed from data that is now out-of-date, then the results will not
be recorded. |
1863 * | 1862 * |
1864 * @param task the task that was performed | 1863 * @param task the task that was performed |
1865 * @return an entry containing the computed results | 1864 * @return an entry containing the computed results |
1866 * @throws AnalysisException if the results could not be recorded | 1865 * @throws AnalysisException if the results could not be recorded |
1867 */ | 1866 */ |
1868 DartEntry recordResolveDartLibraryCycleTaskResults(ResolveDartLibraryCycleTask
task) { | 1867 DartEntry recordResolveDartLibraryCycleTaskResults(ResolveDartLibraryCycleTask
task) { |
1869 LibraryResolver2 resolver = task.libraryResolver; | 1868 LibraryResolver2 resolver = task.libraryResolver; |
1870 AnalysisException thrownException = task.exception; | 1869 CaughtException thrownException = task.exception; |
1871 DartEntry unitEntry = null; | 1870 DartEntry unitEntry = null; |
1872 Source unitSource = task.unitSource; | 1871 Source unitSource = task.unitSource; |
1873 if (resolver != null) { | 1872 if (resolver != null) { |
1874 // | 1873 // |
1875 // The resolver should only be null if an exception was thrown before (or
while) it was | 1874 // The resolver should only be null if an exception was thrown before (or
while) it was |
1876 // being created. | 1875 // being created. |
1877 // | 1876 // |
1878 List<ResolvableLibrary> resolvedLibraries = resolver.resolvedLibraries; | 1877 List<ResolvableLibrary> resolvedLibraries = resolver.resolvedLibraries; |
1879 if (resolvedLibraries == null) { | 1878 if (resolvedLibraries == null) { |
1880 // | 1879 // |
1881 // The resolved libraries should only be null if an exception was thrown
during resolution. | 1880 // The resolved libraries should only be null if an exception was thrown
during resolution. |
1882 // | 1881 // |
1883 unitEntry = _getReadableDartEntry(unitSource); | 1882 unitEntry = _getReadableDartEntry(unitSource); |
1884 if (unitEntry == null) { | 1883 if (unitEntry == null) { |
1885 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${unitSource.fullName}"); | 1884 throw new AnalysisException("A Dart file became a non-Dart file: ${uni
tSource.fullName}"); |
1886 } | 1885 } |
1887 DartEntryImpl dartCopy = unitEntry.writableCopy; | 1886 DartEntryImpl dartCopy = unitEntry.writableCopy; |
1888 if (thrownException == null) { | 1887 if (thrownException == null) { |
1889 dartCopy.recordResolutionError(new AnalysisException.con1("In recordRe
solveDartLibraryCycleTaskResults, resolvedLibraries was null and there was no th
rown exception")); | 1888 dartCopy.recordResolutionError(new CaughtException(new AnalysisExcepti
on("In recordResolveDartLibraryCycleTaskResults, resolvedLibraries was null and
there was no thrown exception"), null)); |
1890 } else { | 1889 } else { |
1891 dartCopy.recordResolutionError(thrownException); | 1890 dartCopy.recordResolutionError(thrownException); |
1892 } | 1891 } |
1893 _cache.put(unitSource, dartCopy); | 1892 _cache.put(unitSource, dartCopy); |
1894 _cache.remove(unitSource); | 1893 _cache.remove(unitSource); |
1895 if (thrownException != null) { | 1894 if (thrownException != null) { |
1896 throw thrownException; | 1895 throw thrownException; |
1897 } | 1896 } |
1898 return dartCopy; | 1897 return dartCopy; |
1899 } | 1898 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1967 } | 1966 } |
1968 _logInformation(writer.toString()); | 1967 _logInformation(writer.toString()); |
1969 } | 1968 } |
1970 } | 1969 } |
1971 if (thrownException != null) { | 1970 if (thrownException != null) { |
1972 throw thrownException; | 1971 throw thrownException; |
1973 } | 1972 } |
1974 if (unitEntry == null) { | 1973 if (unitEntry == null) { |
1975 unitEntry = _getReadableDartEntry(unitSource); | 1974 unitEntry = _getReadableDartEntry(unitSource); |
1976 if (unitEntry == null) { | 1975 if (unitEntry == null) { |
1977 throw new AnalysisException.con1("A Dart file became a non-Dart file: ${
unitSource.fullName}"); | 1976 throw new AnalysisException("A Dart file became a non-Dart file: ${unitS
ource.fullName}"); |
1978 } | 1977 } |
1979 } | 1978 } |
1980 return unitEntry; | 1979 return unitEntry; |
1981 } | 1980 } |
1982 | 1981 |
1983 DartEntry recordResolveDartLibraryTaskResults(ResolveDartLibraryTask task) { | 1982 DartEntry recordResolveDartLibraryTaskResults(ResolveDartLibraryTask task) { |
1984 LibraryResolver resolver = task.libraryResolver; | 1983 LibraryResolver resolver = task.libraryResolver; |
1985 AnalysisException thrownException = task.exception; | 1984 CaughtException thrownException = task.exception; |
1986 DartEntry unitEntry = null; | 1985 DartEntry unitEntry = null; |
1987 Source unitSource = task.unitSource; | 1986 Source unitSource = task.unitSource; |
1988 if (resolver != null) { | 1987 if (resolver != null) { |
1989 // | 1988 // |
1990 // The resolver should only be null if an exception was thrown before (or
while) it was | 1989 // The resolver should only be null if an exception was thrown before (or
while) it was |
1991 // being created. | 1990 // being created. |
1992 // | 1991 // |
1993 Set<Library> resolvedLibraries = resolver.resolvedLibraries; | 1992 Set<Library> resolvedLibraries = resolver.resolvedLibraries; |
1994 if (resolvedLibraries == null) { | 1993 if (resolvedLibraries == null) { |
1995 // | 1994 // |
1996 // The resolved libraries should only be null if an exception was thrown
during resolution. | 1995 // The resolved libraries should only be null if an exception was thrown
during resolution. |
1997 // | 1996 // |
1998 unitEntry = _getReadableDartEntry(unitSource); | 1997 unitEntry = _getReadableDartEntry(unitSource); |
1999 if (unitEntry == null) { | 1998 if (unitEntry == null) { |
2000 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${unitSource.fullName}"); | 1999 throw new AnalysisException("A Dart file became a non-Dart file: ${uni
tSource.fullName}"); |
2001 } | 2000 } |
2002 DartEntryImpl dartCopy = unitEntry.writableCopy; | 2001 DartEntryImpl dartCopy = unitEntry.writableCopy; |
2003 if (thrownException == null) { | 2002 if (thrownException == null) { |
2004 dartCopy.recordResolutionError(new AnalysisException.con1("In recordRe
solveDartLibraryTaskResults, resolvedLibraries was null and there was no thrown
exception")); | 2003 dartCopy.recordResolutionError(new CaughtException(new AnalysisExcepti
on("In recordResolveDartLibraryTaskResults, resolvedLibraries was null and there
was no thrown exception"), null)); |
2005 } else { | 2004 } else { |
2006 dartCopy.recordResolutionError(thrownException); | 2005 dartCopy.recordResolutionError(thrownException); |
2007 } | 2006 } |
2008 _cache.put(unitSource, dartCopy); | 2007 _cache.put(unitSource, dartCopy); |
2009 _cache.remove(unitSource); | 2008 _cache.remove(unitSource); |
2010 if (thrownException != null) { | 2009 if (thrownException != null) { |
2011 throw thrownException; | 2010 throw thrownException; |
2012 } | 2011 } |
2013 return dartCopy; | 2012 return dartCopy; |
2014 } | 2013 } |
2015 if (_allModificationTimesMatch2(resolvedLibraries)) { | 2014 if (_allModificationTimesMatch2(resolvedLibraries)) { |
2016 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); | 2015 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); |
2017 RecordingErrorListener errorListener = resolver.errorListener; | 2016 RecordingErrorListener errorListener = resolver.errorListener; |
2018 for (Library library in resolvedLibraries) { | 2017 for (Library library in resolvedLibraries) { |
2019 Source librarySource = library.librarySource; | 2018 Source librarySource = library.librarySource; |
2020 for (Source source in library.compilationUnitSources) { | 2019 for (Source source in library.compilationUnitSources) { |
2021 CompilationUnit unit = library.getAST(source); | 2020 CompilationUnit unit = library.getAST(source); |
2022 List<AnalysisError> errors = errorListener.getErrorsForSource(source
); | 2021 List<AnalysisError> errors = errorListener.getErrorsForSource(source
); |
2023 LineInfo lineInfo = getLineInfo(source); | 2022 LineInfo lineInfo = getLineInfo(source); |
2024 DartEntry dartEntry = _cache.get(source) as DartEntry; | 2023 DartEntry dartEntry = _cache.get(source) as DartEntry; |
2025 int sourceTime = getModificationStamp(source); | 2024 int sourceTime = getModificationStamp(source); |
2026 if (dartEntry.modificationTime != sourceTime) { | 2025 if (dartEntry.modificationTime != sourceTime) { |
2027 // The source has changed without the context being notified. Simu
late notification. | 2026 // The source has changed without the context being notified. Simu
late notification. |
2028 _sourceChanged(source); | 2027 _sourceChanged(source); |
2029 dartEntry = _getReadableDartEntry(source); | 2028 dartEntry = _getReadableDartEntry(source); |
2030 if (dartEntry == null) { | 2029 if (dartEntry == null) { |
2031 throw new AnalysisException.con1("A Dart file became a non-Dart
file: ${source.fullName}"); | 2030 throw new AnalysisException("A Dart file became a non-Dart file:
${source.fullName}"); |
2032 } | 2031 } |
2033 } | 2032 } |
2034 DartEntryImpl dartCopy = dartEntry.writableCopy; | 2033 DartEntryImpl dartCopy = dartEntry.writableCopy; |
2035 if (thrownException == null) { | 2034 if (thrownException == null) { |
2036 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo); | 2035 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo); |
2037 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); | 2036 dartCopy.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); |
2038 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource,
unit); | 2037 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource,
unit); |
2039 dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySou
rce, errors); | 2038 dartCopy.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySou
rce, errors); |
2040 if (source == librarySource) { | 2039 if (source == librarySource) { |
2041 _recordElementData(dartCopy, library.libraryElement, librarySour
ce, htmlSource); | 2040 _recordElementData(dartCopy, library.libraryElement, librarySour
ce, htmlSource); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2093 } | 2092 } |
2094 _logInformation(writer.toString()); | 2093 _logInformation(writer.toString()); |
2095 } | 2094 } |
2096 } | 2095 } |
2097 if (thrownException != null) { | 2096 if (thrownException != null) { |
2098 throw thrownException; | 2097 throw thrownException; |
2099 } | 2098 } |
2100 if (unitEntry == null) { | 2099 if (unitEntry == null) { |
2101 unitEntry = _getReadableDartEntry(unitSource); | 2100 unitEntry = _getReadableDartEntry(unitSource); |
2102 if (unitEntry == null) { | 2101 if (unitEntry == null) { |
2103 throw new AnalysisException.con1("A Dart file became a non-Dart file: ${
unitSource.fullName}"); | 2102 throw new AnalysisException("A Dart file became a non-Dart file: ${unitS
ource.fullName}"); |
2104 } | 2103 } |
2105 } | 2104 } |
2106 return unitEntry; | 2105 return unitEntry; |
2107 } | 2106 } |
2108 | 2107 |
2109 /** | 2108 /** |
2110 * Record that we have accessed the AST structure associated with the given so
urce. At the moment, | 2109 * Record that we have accessed the AST structure associated with the given so
urce. At the moment, |
2111 * there is no differentiation between the parsed and resolved forms of the AS
T. | 2110 * there is no differentiation between the parsed and resolved forms of the AS
T. |
2112 * | 2111 * |
2113 * @param source the source whose AST structure was accessed | 2112 * @param source the source whose AST structure was accessed |
(...skipping 30 matching lines...) Expand all Loading... |
2144 * not happen) | 2143 * not happen) |
2145 */ | 2144 */ |
2146 bool _allModificationTimesMatch(List<ResolvableLibrary> resolvedLibraries) { | 2145 bool _allModificationTimesMatch(List<ResolvableLibrary> resolvedLibraries) { |
2147 bool allTimesMatch = true; | 2146 bool allTimesMatch = true; |
2148 for (ResolvableLibrary library in resolvedLibraries) { | 2147 for (ResolvableLibrary library in resolvedLibraries) { |
2149 for (Source source in library.compilationUnitSources) { | 2148 for (Source source in library.compilationUnitSources) { |
2150 DartEntry dartEntry = _getReadableDartEntry(source); | 2149 DartEntry dartEntry = _getReadableDartEntry(source); |
2151 if (dartEntry == null) { | 2150 if (dartEntry == null) { |
2152 // This shouldn't be possible because we should never have performed t
he task if the | 2151 // This shouldn't be possible because we should never have performed t
he task if the |
2153 // source didn't represent a Dart file, but check to be safe. | 2152 // source didn't represent a Dart file, but check to be safe. |
2154 throw new AnalysisException.con1("Internal error: attempting to resolv
e non-Dart file as a Dart file: ${source.fullName}"); | 2153 throw new AnalysisException("Internal error: attempting to resolve non
-Dart file as a Dart file: ${source.fullName}"); |
2155 } | 2154 } |
2156 int sourceTime = getModificationStamp(source); | 2155 int sourceTime = getModificationStamp(source); |
2157 int resultTime = library.getModificationTime(source); | 2156 int resultTime = library.getModificationTime(source); |
2158 if (sourceTime != resultTime) { | 2157 if (sourceTime != resultTime) { |
2159 // The source has changed without the context being notified. Simulate
notification. | 2158 // The source has changed without the context being notified. Simulate
notification. |
2160 _sourceChanged(source); | 2159 _sourceChanged(source); |
2161 allTimesMatch = false; | 2160 allTimesMatch = false; |
2162 } | 2161 } |
2163 } | 2162 } |
2164 } | 2163 } |
(...skipping 10 matching lines...) Expand all Loading... |
2175 * not happen) | 2174 * not happen) |
2176 */ | 2175 */ |
2177 bool _allModificationTimesMatch2(Set<Library> resolvedLibraries) { | 2176 bool _allModificationTimesMatch2(Set<Library> resolvedLibraries) { |
2178 bool allTimesMatch = true; | 2177 bool allTimesMatch = true; |
2179 for (Library library in resolvedLibraries) { | 2178 for (Library library in resolvedLibraries) { |
2180 for (Source source in library.compilationUnitSources) { | 2179 for (Source source in library.compilationUnitSources) { |
2181 DartEntry dartEntry = _getReadableDartEntry(source); | 2180 DartEntry dartEntry = _getReadableDartEntry(source); |
2182 if (dartEntry == null) { | 2181 if (dartEntry == null) { |
2183 // This shouldn't be possible because we should never have performed t
he task if the | 2182 // This shouldn't be possible because we should never have performed t
he task if the |
2184 // source didn't represent a Dart file, but check to be safe. | 2183 // source didn't represent a Dart file, but check to be safe. |
2185 throw new AnalysisException.con1("Internal error: attempting to resolv
e non-Dart file as a Dart file: ${source.fullName}"); | 2184 throw new AnalysisException("Internal error: attempting to resolve non
-Dart file as a Dart file: ${source.fullName}"); |
2186 } | 2185 } |
2187 int sourceTime = getModificationStamp(source); | 2186 int sourceTime = getModificationStamp(source); |
2188 int resultTime = library.getModificationTime(source); | 2187 int resultTime = library.getModificationTime(source); |
2189 if (sourceTime != resultTime) { | 2188 if (sourceTime != resultTime) { |
2190 // The source has changed without the context being notified. Simulate
notification. | 2189 // The source has changed without the context being notified. Simulate
notification. |
2191 _sourceChanged(source); | 2190 _sourceChanged(source); |
2192 allTimesMatch = false; | 2191 allTimesMatch = false; |
2193 } | 2192 } |
2194 } | 2193 } |
2195 } | 2194 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2337 // If not, compute the information. Unless the modification date of the so
urce continues to | 2336 // If not, compute the information. Unless the modification date of the so
urce continues to |
2338 // change, this loop will eventually terminate. | 2337 // change, this loop will eventually terminate. |
2339 // | 2338 // |
2340 try { | 2339 try { |
2341 if (dartEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { | 2340 if (dartEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { |
2342 dartEntry = new GetContentTask(this, source).perform(_resultRecorder)
as DartEntry; | 2341 dartEntry = new GetContentTask(this, source).perform(_resultRecorder)
as DartEntry; |
2343 } | 2342 } |
2344 dartEntry = new ScanDartTask(this, source, dartEntry.modificationTime, d
artEntry.getValue(SourceEntry.CONTENT)).perform(_resultRecorder) as DartEntry; | 2343 dartEntry = new ScanDartTask(this, source, dartEntry.modificationTime, d
artEntry.getValue(SourceEntry.CONTENT)).perform(_resultRecorder) as DartEntry; |
2345 } on AnalysisException catch (exception) { | 2344 } on AnalysisException catch (exception) { |
2346 throw exception; | 2345 throw exception; |
2347 } on JavaException catch (exception) { | 2346 } on JavaException catch (exception, stackTrace) { |
2348 throw new AnalysisException.con3(exception); | 2347 throw new AnalysisException("Exception", new CaughtException(exception,
stackTrace)); |
2349 } | 2348 } |
2350 state = dartEntry.getState(descriptor); | 2349 state = dartEntry.getState(descriptor); |
2351 } | 2350 } |
2352 return dartEntry; | 2351 return dartEntry; |
2353 } | 2352 } |
2354 | 2353 |
2355 /** | 2354 /** |
2356 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which | 2355 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which |
2357 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or | 2356 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or |
2358 * [CacheState#ERROR]. This method assumes that the data can be produced by ve
rifying the | 2357 * [CacheState#ERROR]. This method assumes that the data can be produced by ve
rifying the |
(...skipping 14 matching lines...) Expand all Loading... |
2373 // | 2372 // |
2374 CacheState state = dartEntry.getStateInLibrary(descriptor, librarySource); | 2373 CacheState state = dartEntry.getStateInLibrary(descriptor, librarySource); |
2375 while (state != CacheState.ERROR && state != CacheState.VALID) { | 2374 while (state != CacheState.ERROR && state != CacheState.VALID) { |
2376 // | 2375 // |
2377 // If not, compute the information. Unless the modification date of the so
urce continues to | 2376 // If not, compute the information. Unless the modification date of the so
urce continues to |
2378 // change, this loop will eventually terminate. | 2377 // change, this loop will eventually terminate. |
2379 // | 2378 // |
2380 LibraryElement library = computeLibraryElement(librarySource); | 2379 LibraryElement library = computeLibraryElement(librarySource); |
2381 CompilationUnit unit = resolveCompilationUnit(unitSource, library); | 2380 CompilationUnit unit = resolveCompilationUnit(unitSource, library); |
2382 if (unit == null) { | 2381 if (unit == null) { |
2383 throw new AnalysisException.con1("Could not resolve compilation unit ${u
nitSource.fullName} in ${librarySource.fullName}"); | 2382 throw new AnalysisException("Could not resolve compilation unit ${unitSo
urce.fullName} in ${librarySource.fullName}"); |
2384 } | 2383 } |
2385 dartEntry = new GenerateDartErrorsTask(this, unitSource, dartEntry.modific
ationTime, unit, library).perform(_resultRecorder) as DartEntry; | 2384 dartEntry = new GenerateDartErrorsTask(this, unitSource, dartEntry.modific
ationTime, unit, library).perform(_resultRecorder) as DartEntry; |
2386 state = dartEntry.getStateInLibrary(descriptor, librarySource); | 2385 state = dartEntry.getStateInLibrary(descriptor, librarySource); |
2387 } | 2386 } |
2388 return dartEntry; | 2387 return dartEntry; |
2389 } | 2388 } |
2390 | 2389 |
2391 /** | 2390 /** |
2392 * Given a source for an HTML file, return a cache entry in which all of the d
ata represented by | 2391 * Given a source for an HTML file, return a cache entry in which all of the d
ata represented by |
2393 * the state of the given descriptors is either [CacheState#VALID] or | 2392 * the state of the given descriptors is either [CacheState#VALID] or |
(...skipping 25 matching lines...) Expand all Loading... |
2419 // If not, compute the information. Unless the modification date of the so
urce continues to | 2418 // If not, compute the information. Unless the modification date of the so
urce continues to |
2420 // change, this loop will eventually terminate. | 2419 // change, this loop will eventually terminate. |
2421 // | 2420 // |
2422 try { | 2421 try { |
2423 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { | 2422 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { |
2424 htmlEntry = new GetContentTask(this, source).perform(_resultRecorder)
as HtmlEntry; | 2423 htmlEntry = new GetContentTask(this, source).perform(_resultRecorder)
as HtmlEntry; |
2425 } | 2424 } |
2426 htmlEntry = new ParseHtmlTask(this, source, htmlEntry.modificationTime,
htmlEntry.getValue(SourceEntry.CONTENT)).perform(_resultRecorder) as HtmlEntry; | 2425 htmlEntry = new ParseHtmlTask(this, source, htmlEntry.modificationTime,
htmlEntry.getValue(SourceEntry.CONTENT)).perform(_resultRecorder) as HtmlEntry; |
2427 } on AnalysisException catch (exception) { | 2426 } on AnalysisException catch (exception) { |
2428 throw exception; | 2427 throw exception; |
2429 } on JavaException catch (exception) { | 2428 } on JavaException catch (exception, stackTrace) { |
2430 throw new AnalysisException.con3(exception); | 2429 throw new AnalysisException("Exception", new CaughtException(exception,
stackTrace)); |
2431 } | 2430 } |
2432 state = htmlEntry.getState(descriptor); | 2431 state = htmlEntry.getState(descriptor); |
2433 } | 2432 } |
2434 return htmlEntry; | 2433 return htmlEntry; |
2435 } | 2434 } |
2436 | 2435 |
2437 /** | 2436 /** |
2438 * Given a source for an HTML file, return a cache entry in which the state of
the data | 2437 * Given a source for an HTML file, return a cache entry in which the state of
the data |
2439 * represented by the given descriptor is either [CacheState#VALID] or | 2438 * represented by the given descriptor is either [CacheState#VALID] or |
2440 * [CacheState#ERROR]. This method assumes that the data can be produced by re
solving the | 2439 * [CacheState#ERROR]. This method assumes that the data can be produced by re
solving the |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2534 AnalysisContextImpl_CycleBuilder builder = new AnalysisContextImpl_CycleBu
ilder(this); | 2533 AnalysisContextImpl_CycleBuilder builder = new AnalysisContextImpl_CycleBu
ilder(this); |
2535 builder.computeCycleContaining(source); | 2534 builder.computeCycleContaining(source); |
2536 AnalysisContextImpl_TaskData taskData = builder.taskData; | 2535 AnalysisContextImpl_TaskData taskData = builder.taskData; |
2537 if (taskData != null) { | 2536 if (taskData != null) { |
2538 return taskData; | 2537 return taskData; |
2539 } | 2538 } |
2540 DartEntryImpl dartCopy = dartEntry.writableCopy; | 2539 DartEntryImpl dartCopy = dartEntry.writableCopy; |
2541 dartCopy.setStateInLibrary(DartEntry.BUILT_UNIT, source, CacheState.IN_PRO
CESS); | 2540 dartCopy.setStateInLibrary(DartEntry.BUILT_UNIT, source, CacheState.IN_PRO
CESS); |
2542 _cache.put(source, dartCopy); | 2541 _cache.put(source, dartCopy); |
2543 return new AnalysisContextImpl_TaskData(new BuildDartElementModelTask(this
, source, builder.librariesInCycle), false); | 2542 return new AnalysisContextImpl_TaskData(new BuildDartElementModelTask(this
, source, builder.librariesInCycle), false); |
2544 } on AnalysisException catch (exception) { | 2543 } on AnalysisException catch (exception, stackTrace) { |
2545 DartEntryImpl dartCopy = dartEntry.writableCopy; | 2544 DartEntryImpl dartCopy = dartEntry.writableCopy; |
2546 dartCopy.recordBuildElementErrorInLibrary(source, exception); | 2545 dartCopy.recordBuildElementErrorInLibrary(source, new CaughtException(exce
ption, stackTrace)); |
2547 _cache.put(source, dartCopy); | 2546 _cache.put(source, dartCopy); |
2548 AnalysisEngine.instance.logger.logError2("Internal error trying to compute
the next analysis task", exception); | 2547 AnalysisEngine.instance.logger.logError2("Internal error trying to compute
the next analysis task", new CaughtException(exception, stackTrace)); |
2549 } | 2548 } |
2550 return new AnalysisContextImpl_TaskData(null, false); | 2549 return new AnalysisContextImpl_TaskData(null, false); |
2551 } | 2550 } |
2552 | 2551 |
2553 /** | 2552 /** |
2554 * Create a [GenerateDartErrorsTask] for the given source, marking the verific
ation errors | 2553 * Create a [GenerateDartErrorsTask] for the given source, marking the verific
ation errors |
2555 * as being in-process. The compilation unit and the library can be the same i
f the compilation | 2554 * as being in-process. The compilation unit and the library can be the same i
f the compilation |
2556 * unit is the defining compilation unit of the library. | 2555 * unit is the defining compilation unit of the library. |
2557 * | 2556 * |
2558 * @param unitSource the source for the compilation unit to be verified | 2557 * @param unitSource the source for the compilation unit to be verified |
2559 * @param unitEntry the entry for the compilation unit | 2558 * @param unitEntry the entry for the compilation unit |
2560 * @param librarySource the source for the library containing the compilation
unit | 2559 * @param librarySource the source for the library containing the compilation
unit |
2561 * @param libraryEntry the entry for the library | 2560 * @param libraryEntry the entry for the library |
2562 * @return task data representing the created task | 2561 * @return task data representing the created task |
2563 */ | 2562 */ |
2564 AnalysisContextImpl_TaskData _createGenerateDartErrorsTask(Source unitSource,
DartEntry unitEntry, Source librarySource, DartEntry libraryEntry) { | 2563 AnalysisContextImpl_TaskData _createGenerateDartErrorsTask(Source unitSource,
DartEntry unitEntry, Source librarySource, DartEntry libraryEntry) { |
2565 if (unitEntry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource) != C
acheState.VALID || libraryEntry.getState(DartEntry.ELEMENT) != CacheState.VALID)
{ | 2564 if (unitEntry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource) != C
acheState.VALID || libraryEntry.getState(DartEntry.ELEMENT) != CacheState.VALID)
{ |
2566 return _createResolveDartLibraryTask(librarySource, libraryEntry); | 2565 return _createResolveDartLibraryTask(librarySource, libraryEntry); |
2567 } | 2566 } |
2568 CompilationUnit unit = unitEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT,
librarySource); | 2567 CompilationUnit unit = unitEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT,
librarySource); |
2569 if (unit == null) { | 2568 if (unit == null) { |
2570 AnalysisException exception = new AnalysisException.con1("Entry has VALID
state for RESOLVED_UNIT but null value for ${unitSource.fullName} in ${librarySo
urce.fullName}"); | 2569 CaughtException exception = new CaughtException(new AnalysisException("Ent
ry has VALID state for RESOLVED_UNIT but null value for ${unitSource.fullName} i
n ${librarySource.fullName}"), null); |
2571 AnalysisEngine.instance.logger.logInformation2(exception.toString(), excep
tion); | 2570 AnalysisEngine.instance.logger.logInformation2(exception.toString(), excep
tion); |
2572 DartEntryImpl dartCopy = unitEntry.writableCopy; | 2571 DartEntryImpl dartCopy = unitEntry.writableCopy; |
2573 dartCopy.recordResolutionError(exception); | 2572 dartCopy.recordResolutionError(exception); |
2574 _cache.put(unitSource, dartCopy); | 2573 _cache.put(unitSource, dartCopy); |
2575 return new AnalysisContextImpl_TaskData(null, false); | 2574 return new AnalysisContextImpl_TaskData(null, false); |
2576 } | 2575 } |
2577 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT); | 2576 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT); |
2578 DartEntryImpl dartCopy = unitEntry.writableCopy; | 2577 DartEntryImpl dartCopy = unitEntry.writableCopy; |
2579 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, Cac
heState.IN_PROCESS); | 2578 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, Cac
heState.IN_PROCESS); |
2580 _cache.put(unitSource, dartCopy); | 2579 _cache.put(unitSource, dartCopy); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2756 */ | 2755 */ |
2757 AnalysisContextImpl_TaskData _createResolveDartLibraryTask(Source source, Dart
Entry dartEntry) { | 2756 AnalysisContextImpl_TaskData _createResolveDartLibraryTask(Source source, Dart
Entry dartEntry) { |
2758 try { | 2757 try { |
2759 AnalysisContextImpl_CycleBuilder builder = new AnalysisContextImpl_CycleBu
ilder(this); | 2758 AnalysisContextImpl_CycleBuilder builder = new AnalysisContextImpl_CycleBu
ilder(this); |
2760 builder.computeCycleContaining(source); | 2759 builder.computeCycleContaining(source); |
2761 AnalysisContextImpl_TaskData taskData = builder.taskData; | 2760 AnalysisContextImpl_TaskData taskData = builder.taskData; |
2762 if (taskData != null) { | 2761 if (taskData != null) { |
2763 return taskData; | 2762 return taskData; |
2764 } | 2763 } |
2765 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryCycleTask(th
is, source, source, builder.librariesInCycle), false); | 2764 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryCycleTask(th
is, source, source, builder.librariesInCycle), false); |
2766 } on AnalysisException catch (exception) { | 2765 } on AnalysisException catch (exception, stackTrace) { |
2767 DartEntryImpl dartCopy = dartEntry.writableCopy; | 2766 DartEntryImpl dartCopy = dartEntry.writableCopy; |
2768 dartCopy.recordResolutionError(exception); | 2767 dartCopy.recordResolutionError(new CaughtException(exception, stackTrace))
; |
2769 _cache.put(source, dartCopy); | 2768 _cache.put(source, dartCopy); |
2770 AnalysisEngine.instance.logger.logError2("Internal error trying to create
a ResolveDartLibraryTask", exception); | 2769 AnalysisEngine.instance.logger.logError2("Internal error trying to create
a ResolveDartLibraryTask", new CaughtException(exception, stackTrace)); |
2771 } | 2770 } |
2772 return new AnalysisContextImpl_TaskData(null, false); | 2771 return new AnalysisContextImpl_TaskData(null, false); |
2773 } | 2772 } |
2774 | 2773 |
2775 /** | 2774 /** |
2776 * Create a [ResolveHtmlTask] for the given source, marking the resolved unit
as being | 2775 * Create a [ResolveHtmlTask] for the given source, marking the resolved unit
as being |
2777 * in-process. | 2776 * in-process. |
2778 * | 2777 * |
2779 * @param source the source whose content is to be resolved | 2778 * @param source the source whose content is to be resolved |
2780 * @param htmlEntry the entry for the source | 2779 * @param htmlEntry the entry for the source |
(...skipping 1046 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3827 * Record the results produced by performing a [BuildDartElementModelTask]. If
the results | 3826 * Record the results produced by performing a [BuildDartElementModelTask]. If
the results |
3828 * were computed from data that is now out-of-date, then the results will not
be recorded. | 3827 * were computed from data that is now out-of-date, then the results will not
be recorded. |
3829 * | 3828 * |
3830 * @param task the task that was performed | 3829 * @param task the task that was performed |
3831 * @return an entry containing the recorded results | 3830 * @return an entry containing the recorded results |
3832 * @throws AnalysisException if the results could not be recorded | 3831 * @throws AnalysisException if the results could not be recorded |
3833 */ | 3832 */ |
3834 DartEntry _recordBuildDartElementModelTask(BuildDartElementModelTask task) { | 3833 DartEntry _recordBuildDartElementModelTask(BuildDartElementModelTask task) { |
3835 Source targetLibrary = task.targetLibrary; | 3834 Source targetLibrary = task.targetLibrary; |
3836 List<ResolvableLibrary> builtLibraries = task.librariesInCycle; | 3835 List<ResolvableLibrary> builtLibraries = task.librariesInCycle; |
3837 AnalysisException thrownException = task.exception; | 3836 CaughtException thrownException = task.exception; |
3838 DartEntry targetEntry = null; | 3837 DartEntry targetEntry = null; |
3839 if (_allModificationTimesMatch(builtLibraries)) { | 3838 if (_allModificationTimesMatch(builtLibraries)) { |
3840 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); | 3839 Source htmlSource = sourceFactory.forUri(DartSdk.DART_HTML); |
3841 RecordingErrorListener errorListener = task.errorListener; | 3840 RecordingErrorListener errorListener = task.errorListener; |
3842 for (ResolvableLibrary library in builtLibraries) { | 3841 for (ResolvableLibrary library in builtLibraries) { |
3843 Source librarySource = library.librarySource; | 3842 Source librarySource = library.librarySource; |
3844 for (Source source in library.compilationUnitSources) { | 3843 for (Source source in library.compilationUnitSources) { |
3845 CompilationUnit unit = library.getAST(source); | 3844 CompilationUnit unit = library.getAST(source); |
3846 List<AnalysisError> errors = errorListener.getErrorsForSource(source); | 3845 List<AnalysisError> errors = errorListener.getErrorsForSource(source); |
3847 LineInfo lineInfo = getLineInfo(source); | 3846 LineInfo lineInfo = getLineInfo(source); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3907 } | 3906 } |
3908 } | 3907 } |
3909 _logInformation(writer.toString()); | 3908 _logInformation(writer.toString()); |
3910 } | 3909 } |
3911 if (thrownException != null) { | 3910 if (thrownException != null) { |
3912 throw thrownException; | 3911 throw thrownException; |
3913 } | 3912 } |
3914 if (targetEntry == null) { | 3913 if (targetEntry == null) { |
3915 targetEntry = _getReadableDartEntry(targetLibrary); | 3914 targetEntry = _getReadableDartEntry(targetLibrary); |
3916 if (targetEntry == null) { | 3915 if (targetEntry == null) { |
3917 throw new AnalysisException.con1("A Dart file became a non-Dart file: ${
targetLibrary.fullName}"); | 3916 throw new AnalysisException("A Dart file became a non-Dart file: ${targe
tLibrary.fullName}"); |
3918 } | 3917 } |
3919 } | 3918 } |
3920 return targetEntry; | 3919 return targetEntry; |
3921 } | 3920 } |
3922 | 3921 |
3923 /** | 3922 /** |
3924 * Given a cache entry and a library element, record the library element and o
ther information | 3923 * Given a cache entry and a library element, record the library element and o
ther information |
3925 * gleaned from the element in the cache entry. | 3924 * gleaned from the element in the cache entry. |
3926 * | 3925 * |
3927 * @param dartCopy the cache entry in which data is to be recorded | 3926 * @param dartCopy the cache entry in which data is to be recorded |
(...skipping 11 matching lines...) Expand all Loading... |
3939 * Record the results produced by performing a [GenerateDartErrorsTask]. If th
e results were | 3938 * Record the results produced by performing a [GenerateDartErrorsTask]. If th
e results were |
3940 * computed from data that is now out-of-date, then the results will not be re
corded. | 3939 * computed from data that is now out-of-date, then the results will not be re
corded. |
3941 * | 3940 * |
3942 * @param task the task that was performed | 3941 * @param task the task that was performed |
3943 * @return an entry containing the computed results | 3942 * @return an entry containing the computed results |
3944 * @throws AnalysisException if the results could not be recorded | 3943 * @throws AnalysisException if the results could not be recorded |
3945 */ | 3944 */ |
3946 DartEntry _recordGenerateDartErrorsTask(GenerateDartErrorsTask task) { | 3945 DartEntry _recordGenerateDartErrorsTask(GenerateDartErrorsTask task) { |
3947 Source source = task.source; | 3946 Source source = task.source; |
3948 Source librarySource = task.libraryElement.source; | 3947 Source librarySource = task.libraryElement.source; |
3949 AnalysisException thrownException = task.exception; | 3948 CaughtException thrownException = task.exception; |
3950 DartEntry dartEntry = null; | 3949 DartEntry dartEntry = null; |
3951 SourceEntry sourceEntry = _cache.get(source); | 3950 SourceEntry sourceEntry = _cache.get(source); |
3952 if (sourceEntry == null) { | 3951 if (sourceEntry == null) { |
3953 throw new ObsoleteSourceAnalysisException(source); | 3952 throw new ObsoleteSourceAnalysisException(source); |
3954 } else if (sourceEntry is! DartEntry) { | 3953 } else if (sourceEntry is! DartEntry) { |
3955 // This shouldn't be possible because we should never have performed the t
ask if the source | 3954 // This shouldn't be possible because we should never have performed the t
ask if the source |
3956 // didn't represent a Dart file, but check to be safe. | 3955 // didn't represent a Dart file, but check to be safe. |
3957 throw new AnalysisException.con1("Internal error: attempting to verify non
-Dart file as a Dart file: ${source.fullName}"); | 3956 throw new AnalysisException("Internal error: attempting to verify non-Dart
file as a Dart file: ${source.fullName}"); |
3958 } | 3957 } |
3959 dartEntry = sourceEntry as DartEntry; | 3958 dartEntry = sourceEntry as DartEntry; |
3960 int sourceTime = getModificationStamp(source); | 3959 int sourceTime = getModificationStamp(source); |
3961 int resultTime = task.modificationTime; | 3960 int resultTime = task.modificationTime; |
3962 if (sourceTime == resultTime) { | 3961 if (sourceTime == resultTime) { |
3963 if (dartEntry.modificationTime != sourceTime) { | 3962 if (dartEntry.modificationTime != sourceTime) { |
3964 // The source has changed without the context being notified. Simulate n
otification. | 3963 // The source has changed without the context being notified. Simulate n
otification. |
3965 _sourceChanged(source); | 3964 _sourceChanged(source); |
3966 dartEntry = _getReadableDartEntry(source); | 3965 dartEntry = _getReadableDartEntry(source); |
3967 if (dartEntry == null) { | 3966 if (dartEntry == null) { |
3968 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${source.fullName}"); | 3967 throw new AnalysisException("A Dart file became a non-Dart file: ${sou
rce.fullName}"); |
3969 } | 3968 } |
3970 } | 3969 } |
3971 DartEntryImpl dartCopy = dartEntry.writableCopy; | 3970 DartEntryImpl dartCopy = dartEntry.writableCopy; |
3972 if (thrownException == null) { | 3971 if (thrownException == null) { |
3973 dartCopy.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource,
task.errors); | 3972 dartCopy.setValueInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource,
task.errors); |
3974 ChangeNoticeImpl notice = _getNotice(source); | 3973 ChangeNoticeImpl notice = _getNotice(source); |
3975 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LINE_
INFO)); | 3974 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LINE_
INFO)); |
3976 } else { | 3975 } else { |
3977 dartCopy.recordVerificationErrorInLibrary(librarySource, thrownException
); | 3976 dartCopy.recordVerificationErrorInLibrary(librarySource, thrownException
); |
3978 } | 3977 } |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4012 /** | 4011 /** |
4013 * Record the results produced by performing a [GenerateDartHintsTask]. If the
results were | 4012 * Record the results produced by performing a [GenerateDartHintsTask]. If the
results were |
4014 * computed from data that is now out-of-date, then the results will not be re
corded. | 4013 * computed from data that is now out-of-date, then the results will not be re
corded. |
4015 * | 4014 * |
4016 * @param task the task that was performed | 4015 * @param task the task that was performed |
4017 * @return an entry containing the computed results | 4016 * @return an entry containing the computed results |
4018 * @throws AnalysisException if the results could not be recorded | 4017 * @throws AnalysisException if the results could not be recorded |
4019 */ | 4018 */ |
4020 DartEntry _recordGenerateDartHintsTask(GenerateDartHintsTask task) { | 4019 DartEntry _recordGenerateDartHintsTask(GenerateDartHintsTask task) { |
4021 Source librarySource = task.libraryElement.source; | 4020 Source librarySource = task.libraryElement.source; |
4022 AnalysisException thrownException = task.exception; | 4021 CaughtException thrownException = task.exception; |
4023 DartEntry libraryEntry = null; | 4022 DartEntry libraryEntry = null; |
4024 Map<Source, TimestampedData<List<AnalysisError>>> hintMap = task.hintMap; | 4023 Map<Source, TimestampedData<List<AnalysisError>>> hintMap = task.hintMap; |
4025 if (hintMap == null) { | 4024 if (hintMap == null) { |
4026 // We don't have any information about which sources to mark as invalid ot
her than the library | 4025 // We don't have any information about which sources to mark as invalid ot
her than the library |
4027 // source. | 4026 // source. |
4028 SourceEntry sourceEntry = _cache.get(librarySource); | 4027 SourceEntry sourceEntry = _cache.get(librarySource); |
4029 if (sourceEntry == null) { | 4028 if (sourceEntry == null) { |
4030 throw new ObsoleteSourceAnalysisException(librarySource); | 4029 throw new ObsoleteSourceAnalysisException(librarySource); |
4031 } else if (sourceEntry is! DartEntry) { | 4030 } else if (sourceEntry is! DartEntry) { |
4032 // This shouldn't be possible because we should never have performed the
task if the source | 4031 // This shouldn't be possible because we should never have performed the
task if the source |
4033 // didn't represent a Dart file, but check to be safe. | 4032 // didn't represent a Dart file, but check to be safe. |
4034 throw new AnalysisException.con1("Internal error: attempting to generate
hints for non-Dart file as a Dart file: ${librarySource.fullName}"); | 4033 throw new AnalysisException("Internal error: attempting to generate hint
s for non-Dart file as a Dart file: ${librarySource.fullName}"); |
4035 } | 4034 } |
4036 if (thrownException == null) { | 4035 if (thrownException == null) { |
4037 thrownException = new AnalysisException.con1("GenerateDartHintsTask retu
rned a null hint map without throwing an exception: ${librarySource.fullName}"); | 4036 thrownException = new CaughtException(new AnalysisException("GenerateDar
tHintsTask returned a null hint map without throwing an exception: ${librarySour
ce.fullName}"), null); |
4038 } | 4037 } |
4039 DartEntryImpl dartCopy = (sourceEntry as DartEntry).writableCopy; | 4038 DartEntryImpl dartCopy = (sourceEntry as DartEntry).writableCopy; |
4040 dartCopy.recordHintErrorInLibrary(librarySource, thrownException); | 4039 dartCopy.recordHintErrorInLibrary(librarySource, thrownException); |
4041 _cache.put(librarySource, dartCopy); | 4040 _cache.put(librarySource, dartCopy); |
4042 throw thrownException; | 4041 throw thrownException; |
4043 } | 4042 } |
4044 for (MapEntry<Source, TimestampedData<List<AnalysisError>>> entry in getMapE
ntrySet(hintMap)) { | 4043 for (MapEntry<Source, TimestampedData<List<AnalysisError>>> entry in getMapE
ntrySet(hintMap)) { |
4045 Source unitSource = entry.getKey(); | 4044 Source unitSource = entry.getKey(); |
4046 TimestampedData<List<AnalysisError>> results = entry.getValue(); | 4045 TimestampedData<List<AnalysisError>> results = entry.getValue(); |
4047 SourceEntry sourceEntry = _cache.get(unitSource); | 4046 SourceEntry sourceEntry = _cache.get(unitSource); |
4048 if (sourceEntry is! DartEntry) { | 4047 if (sourceEntry is! DartEntry) { |
4049 // This shouldn't be possible because we should never have performed the
task if the source | 4048 // This shouldn't be possible because we should never have performed the
task if the source |
4050 // didn't represent a Dart file, but check to be safe. | 4049 // didn't represent a Dart file, but check to be safe. |
4051 throw new AnalysisException.con1("Internal error: attempting to parse no
n-Dart file as a Dart file: ${unitSource.fullName}"); | 4050 throw new AnalysisException("Internal error: attempting to parse non-Dar
t file as a Dart file: ${unitSource.fullName}"); |
4052 } | 4051 } |
4053 DartEntry dartEntry = sourceEntry as DartEntry; | 4052 DartEntry dartEntry = sourceEntry as DartEntry; |
4054 if (unitSource == librarySource) { | 4053 if (unitSource == librarySource) { |
4055 libraryEntry = dartEntry; | 4054 libraryEntry = dartEntry; |
4056 } | 4055 } |
4057 int sourceTime = getModificationStamp(unitSource); | 4056 int sourceTime = getModificationStamp(unitSource); |
4058 int resultTime = results.modificationTime; | 4057 int resultTime = results.modificationTime; |
4059 if (sourceTime == resultTime) { | 4058 if (sourceTime == resultTime) { |
4060 if (dartEntry.modificationTime != sourceTime) { | 4059 if (dartEntry.modificationTime != sourceTime) { |
4061 // The source has changed without the context being notified. Simulate
notification. | 4060 // The source has changed without the context being notified. Simulate
notification. |
4062 _sourceChanged(unitSource); | 4061 _sourceChanged(unitSource); |
4063 dartEntry = _getReadableDartEntry(unitSource); | 4062 dartEntry = _getReadableDartEntry(unitSource); |
4064 if (dartEntry == null) { | 4063 if (dartEntry == null) { |
4065 throw new AnalysisException.con1("A Dart file became a non-Dart file
: ${unitSource.fullName}"); | 4064 throw new AnalysisException("A Dart file became a non-Dart file: ${u
nitSource.fullName}"); |
4066 } | 4065 } |
4067 } | 4066 } |
4068 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4067 DartEntryImpl dartCopy = dartEntry.writableCopy; |
4069 if (thrownException == null) { | 4068 if (thrownException == null) { |
4070 dartCopy.setValueInLibrary(DartEntry.HINTS, librarySource, results.dat
a); | 4069 dartCopy.setValueInLibrary(DartEntry.HINTS, librarySource, results.dat
a); |
4071 ChangeNoticeImpl notice = _getNotice(unitSource); | 4070 ChangeNoticeImpl notice = _getNotice(unitSource); |
4072 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LIN
E_INFO)); | 4071 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LIN
E_INFO)); |
4073 } else { | 4072 } else { |
4074 dartCopy.recordHintErrorInLibrary(librarySource, thrownException); | 4073 dartCopy.recordHintErrorInLibrary(librarySource, thrownException); |
4075 } | 4074 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4114 * | 4113 * |
4115 * @param task the task that was performed | 4114 * @param task the task that was performed |
4116 * @return an entry containing the computed results | 4115 * @return an entry containing the computed results |
4117 * @throws AnalysisException if the results could not be recorded | 4116 * @throws AnalysisException if the results could not be recorded |
4118 */ | 4117 */ |
4119 SourceEntry _recordGetContentsTask(GetContentTask task) { | 4118 SourceEntry _recordGetContentsTask(GetContentTask task) { |
4120 if (!task.isComplete) { | 4119 if (!task.isComplete) { |
4121 return null; | 4120 return null; |
4122 } | 4121 } |
4123 Source source = task.source; | 4122 Source source = task.source; |
4124 AnalysisException thrownException = task.exception; | 4123 CaughtException thrownException = task.exception; |
4125 SourceEntry sourceEntry = null; | 4124 SourceEntry sourceEntry = null; |
4126 sourceEntry = _cache.get(source); | 4125 sourceEntry = _cache.get(source); |
4127 if (sourceEntry == null) { | 4126 if (sourceEntry == null) { |
4128 throw new ObsoleteSourceAnalysisException(source); | 4127 throw new ObsoleteSourceAnalysisException(source); |
4129 } | 4128 } |
4130 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; | 4129 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; |
4131 if (thrownException == null) { | 4130 if (thrownException == null) { |
4132 sourceCopy.modificationTime = task.modificationTime; | 4131 sourceCopy.modificationTime = task.modificationTime; |
4133 sourceCopy.setValue(SourceEntry.CONTENT, task.content); | 4132 sourceCopy.setValue(SourceEntry.CONTENT, task.content); |
4134 } else { | 4133 } else { |
(...skipping 28 matching lines...) Expand all Loading... |
4163 /** | 4162 /** |
4164 * Record the results produced by performing a [ParseDartTask]. If the results
were computed | 4163 * Record the results produced by performing a [ParseDartTask]. If the results
were computed |
4165 * from data that is now out-of-date, then the results will not be recorded. | 4164 * from data that is now out-of-date, then the results will not be recorded. |
4166 * | 4165 * |
4167 * @param task the task that was performed | 4166 * @param task the task that was performed |
4168 * @return an entry containing the computed results | 4167 * @return an entry containing the computed results |
4169 * @throws AnalysisException if the results could not be recorded | 4168 * @throws AnalysisException if the results could not be recorded |
4170 */ | 4169 */ |
4171 DartEntry _recordParseDartTaskResults(ParseDartTask task) { | 4170 DartEntry _recordParseDartTaskResults(ParseDartTask task) { |
4172 Source source = task.source; | 4171 Source source = task.source; |
4173 AnalysisException thrownException = task.exception; | 4172 CaughtException thrownException = task.exception; |
4174 DartEntry dartEntry = null; | 4173 DartEntry dartEntry = null; |
4175 SourceEntry sourceEntry = _cache.get(source); | 4174 SourceEntry sourceEntry = _cache.get(source); |
4176 if (sourceEntry == null) { | 4175 if (sourceEntry == null) { |
4177 throw new ObsoleteSourceAnalysisException(source); | 4176 throw new ObsoleteSourceAnalysisException(source); |
4178 } else if (sourceEntry is! DartEntry) { | 4177 } else if (sourceEntry is! DartEntry) { |
4179 // This shouldn't be possible because we should never have performed the t
ask if the source | 4178 // This shouldn't be possible because we should never have performed the t
ask if the source |
4180 // didn't represent a Dart file, but check to be safe. | 4179 // didn't represent a Dart file, but check to be safe. |
4181 throw new AnalysisException.con1("Internal error: attempting to parse non-
Dart file as a Dart file: ${source.fullName}"); | 4180 throw new AnalysisException("Internal error: attempting to parse non-Dart
file as a Dart file: ${source.fullName}"); |
4182 } | 4181 } |
4183 dartEntry = sourceEntry as DartEntry; | 4182 dartEntry = sourceEntry as DartEntry; |
4184 int sourceTime = getModificationStamp(source); | 4183 int sourceTime = getModificationStamp(source); |
4185 int resultTime = task.modificationTime; | 4184 int resultTime = task.modificationTime; |
4186 if (sourceTime == resultTime) { | 4185 if (sourceTime == resultTime) { |
4187 if (dartEntry.modificationTime != sourceTime) { | 4186 if (dartEntry.modificationTime != sourceTime) { |
4188 // The source has changed without the context being notified. Simulate n
otification. | 4187 // The source has changed without the context being notified. Simulate n
otification. |
4189 _sourceChanged(source); | 4188 _sourceChanged(source); |
4190 dartEntry = _getReadableDartEntry(source); | 4189 dartEntry = _getReadableDartEntry(source); |
4191 if (dartEntry == null) { | 4190 if (dartEntry == null) { |
4192 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${source.fullName}"); | 4191 throw new AnalysisException("A Dart file became a non-Dart file: ${sou
rce.fullName}"); |
4193 } | 4192 } |
4194 } | 4193 } |
4195 _removeFromParts(source, dartEntry); | 4194 _removeFromParts(source, dartEntry); |
4196 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4195 DartEntryImpl dartCopy = dartEntry.writableCopy; |
4197 if (thrownException == null) { | 4196 if (thrownException == null) { |
4198 if (task.hasNonPartOfDirective) { | 4197 if (task.hasNonPartOfDirective) { |
4199 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); | 4198 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); |
4200 dartCopy.containingLibrary = source; | 4199 dartCopy.containingLibrary = source; |
4201 _workManager.add(source, SourcePriority.LIBRARY); | 4200 _workManager.add(source, SourcePriority.LIBRARY); |
4202 } else if (task.hasPartOfDirective) { | 4201 } else if (task.hasPartOfDirective) { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4280 /** | 4279 /** |
4281 * Record the results produced by performing a [ParseHtmlTask]. If the results
were computed | 4280 * Record the results produced by performing a [ParseHtmlTask]. If the results
were computed |
4282 * from data that is now out-of-date, then the results will not be recorded. | 4281 * from data that is now out-of-date, then the results will not be recorded. |
4283 * | 4282 * |
4284 * @param task the task that was performed | 4283 * @param task the task that was performed |
4285 * @return an entry containing the computed results | 4284 * @return an entry containing the computed results |
4286 * @throws AnalysisException if the results could not be recorded | 4285 * @throws AnalysisException if the results could not be recorded |
4287 */ | 4286 */ |
4288 HtmlEntry _recordParseHtmlTaskResults(ParseHtmlTask task) { | 4287 HtmlEntry _recordParseHtmlTaskResults(ParseHtmlTask task) { |
4289 Source source = task.source; | 4288 Source source = task.source; |
4290 AnalysisException thrownException = task.exception; | 4289 CaughtException thrownException = task.exception; |
4291 HtmlEntry htmlEntry = null; | 4290 HtmlEntry htmlEntry = null; |
4292 SourceEntry sourceEntry = _cache.get(source); | 4291 SourceEntry sourceEntry = _cache.get(source); |
4293 if (sourceEntry == null) { | 4292 if (sourceEntry == null) { |
4294 throw new ObsoleteSourceAnalysisException(source); | 4293 throw new ObsoleteSourceAnalysisException(source); |
4295 } else if (sourceEntry is! HtmlEntry) { | 4294 } else if (sourceEntry is! HtmlEntry) { |
4296 // This shouldn't be possible because we should never have performed the t
ask if the source | 4295 // This shouldn't be possible because we should never have performed the t
ask if the source |
4297 // didn't represent an HTML file, but check to be safe. | 4296 // didn't represent an HTML file, but check to be safe. |
4298 throw new AnalysisException.con1("Internal error: attempting to parse non-
HTML file as a HTML file: ${source.fullName}"); | 4297 throw new AnalysisException("Internal error: attempting to parse non-HTML
file as a HTML file: ${source.fullName}"); |
4299 } | 4298 } |
4300 htmlEntry = sourceEntry as HtmlEntry; | 4299 htmlEntry = sourceEntry as HtmlEntry; |
4301 int sourceTime = getModificationStamp(source); | 4300 int sourceTime = getModificationStamp(source); |
4302 int resultTime = task.modificationTime; | 4301 int resultTime = task.modificationTime; |
4303 if (sourceTime == resultTime) { | 4302 if (sourceTime == resultTime) { |
4304 if (htmlEntry.modificationTime != sourceTime) { | 4303 if (htmlEntry.modificationTime != sourceTime) { |
4305 // The source has changed without the context being notified. Simulate n
otification. | 4304 // The source has changed without the context being notified. Simulate n
otification. |
4306 _sourceChanged(source); | 4305 _sourceChanged(source); |
4307 htmlEntry = _getReadableHtmlEntry(source); | 4306 htmlEntry = _getReadableHtmlEntry(source); |
4308 if (htmlEntry == null) { | 4307 if (htmlEntry == null) { |
4309 throw new AnalysisException.con1("An HTML file became a non-HTML file:
${source.fullName}"); | 4308 throw new AnalysisException("An HTML file became a non-HTML file: ${so
urce.fullName}"); |
4310 } | 4309 } |
4311 } | 4310 } |
4312 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy; | 4311 HtmlEntryImpl htmlCopy = (sourceEntry as HtmlEntry).writableCopy; |
4313 if (thrownException == null) { | 4312 if (thrownException == null) { |
4314 LineInfo lineInfo = task.lineInfo; | 4313 LineInfo lineInfo = task.lineInfo; |
4315 ht.HtmlUnit unit = task.htmlUnit; | 4314 ht.HtmlUnit unit = task.htmlUnit; |
4316 htmlCopy.setValue(SourceEntry.LINE_INFO, lineInfo); | 4315 htmlCopy.setValue(SourceEntry.LINE_INFO, lineInfo); |
4317 htmlCopy.setValue(HtmlEntry.PARSED_UNIT, unit); | 4316 htmlCopy.setValue(HtmlEntry.PARSED_UNIT, unit); |
4318 htmlCopy.setValue(HtmlEntry.PARSE_ERRORS, task.errors); | 4317 htmlCopy.setValue(HtmlEntry.PARSE_ERRORS, task.errors); |
4319 htmlCopy.setValue(HtmlEntry.REFERENCED_LIBRARIES, task.referencedLibrari
es); | 4318 htmlCopy.setValue(HtmlEntry.REFERENCED_LIBRARIES, task.referencedLibrari
es); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4365 | 4364 |
4366 /** | 4365 /** |
4367 * Record the results produced by performing a [PolymerBuildHtmlTask]. If the
results were | 4366 * Record the results produced by performing a [PolymerBuildHtmlTask]. If the
results were |
4368 * computed from data that is now out-of-date, then the results will not be re
corded. | 4367 * computed from data that is now out-of-date, then the results will not be re
corded. |
4369 * | 4368 * |
4370 * @param task the task that was performed | 4369 * @param task the task that was performed |
4371 * @throws AnalysisException if the results could not be recorded | 4370 * @throws AnalysisException if the results could not be recorded |
4372 */ | 4371 */ |
4373 HtmlEntry _recordPolymerBuildHtmlTaskResults(PolymerBuildHtmlTask task) { | 4372 HtmlEntry _recordPolymerBuildHtmlTaskResults(PolymerBuildHtmlTask task) { |
4374 Source source = task.source; | 4373 Source source = task.source; |
4375 AnalysisException thrownException = task.exception; | 4374 CaughtException thrownException = task.exception; |
4376 HtmlEntry htmlEntry = null; | 4375 HtmlEntry htmlEntry = null; |
4377 SourceEntry sourceEntry = _cache.get(source); | 4376 SourceEntry sourceEntry = _cache.get(source); |
4378 if (sourceEntry == null) { | 4377 if (sourceEntry == null) { |
4379 throw new ObsoleteSourceAnalysisException(source); | 4378 throw new ObsoleteSourceAnalysisException(source); |
4380 } else if (sourceEntry is! HtmlEntry) { | 4379 } else if (sourceEntry is! HtmlEntry) { |
4381 // This shouldn't be possible because we should never have performed the t
ask if the source | 4380 // This shouldn't be possible because we should never have performed the t
ask if the source |
4382 // didn't represent an HTML file, but check to be safe. | 4381 // didn't represent an HTML file, but check to be safe. |
4383 throw new AnalysisException.con1("Internal error: attempting to resolve no
n-HTML file as an HTML file: ${source.fullName}"); | 4382 throw new AnalysisException("Internal error: attempting to resolve non-HTM
L file as an HTML file: ${source.fullName}"); |
4384 } | 4383 } |
4385 htmlEntry = sourceEntry as HtmlEntry; | 4384 htmlEntry = sourceEntry as HtmlEntry; |
4386 int sourceTime = getModificationStamp(source); | 4385 int sourceTime = getModificationStamp(source); |
4387 int resultTime = task.modificationTime; | 4386 int resultTime = task.modificationTime; |
4388 if (sourceTime == resultTime) { | 4387 if (sourceTime == resultTime) { |
4389 if (htmlEntry.modificationTime != sourceTime) { | 4388 if (htmlEntry.modificationTime != sourceTime) { |
4390 // The source has changed without the context being notified. Simulate n
otification. | 4389 // The source has changed without the context being notified. Simulate n
otification. |
4391 _sourceChanged(source); | 4390 _sourceChanged(source); |
4392 htmlEntry = _getReadableHtmlEntry(source); | 4391 htmlEntry = _getReadableHtmlEntry(source); |
4393 if (htmlEntry == null) { | 4392 if (htmlEntry == null) { |
4394 throw new AnalysisException.con1("An HTML file became a non-HTML file:
${source.fullName}"); | 4393 throw new AnalysisException("An HTML file became a non-HTML file: ${so
urce.fullName}"); |
4395 } | 4394 } |
4396 } | 4395 } |
4397 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4396 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
4398 if (thrownException == null) { | 4397 if (thrownException == null) { |
4399 htmlCopy.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, task.errors); | 4398 htmlCopy.setValue(HtmlEntry.POLYMER_BUILD_ERRORS, task.errors); |
4400 // notify about errors | 4399 // notify about errors |
4401 ChangeNoticeImpl notice = _getNotice(source); | 4400 ChangeNoticeImpl notice = _getNotice(source); |
4402 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); | 4401 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); |
4403 } else { | 4402 } else { |
4404 htmlCopy.recordResolutionError(thrownException); | 4403 htmlCopy.recordResolutionError(thrownException); |
(...skipping 29 matching lines...) Expand all Loading... |
4434 | 4433 |
4435 /** | 4434 /** |
4436 * Record the results produced by performing a [PolymerResolveHtmlTask]. If th
e results were | 4435 * Record the results produced by performing a [PolymerResolveHtmlTask]. If th
e results were |
4437 * computed from data that is now out-of-date, then the results will not be re
corded. | 4436 * computed from data that is now out-of-date, then the results will not be re
corded. |
4438 * | 4437 * |
4439 * @param task the task that was performed | 4438 * @param task the task that was performed |
4440 * @throws AnalysisException if the results could not be recorded | 4439 * @throws AnalysisException if the results could not be recorded |
4441 */ | 4440 */ |
4442 HtmlEntry _recordPolymerResolveHtmlTaskResults(PolymerResolveHtmlTask task) { | 4441 HtmlEntry _recordPolymerResolveHtmlTaskResults(PolymerResolveHtmlTask task) { |
4443 Source source = task.source; | 4442 Source source = task.source; |
4444 AnalysisException thrownException = task.exception; | 4443 CaughtException thrownException = task.exception; |
4445 HtmlEntry htmlEntry = null; | 4444 HtmlEntry htmlEntry = null; |
4446 SourceEntry sourceEntry = _cache.get(source); | 4445 SourceEntry sourceEntry = _cache.get(source); |
4447 if (sourceEntry == null) { | 4446 if (sourceEntry == null) { |
4448 throw new ObsoleteSourceAnalysisException(source); | 4447 throw new ObsoleteSourceAnalysisException(source); |
4449 } else if (sourceEntry is! HtmlEntry) { | 4448 } else if (sourceEntry is! HtmlEntry) { |
4450 // This shouldn't be possible because we should never have performed the t
ask if the source | 4449 // This shouldn't be possible because we should never have performed the t
ask if the source |
4451 // didn't represent an HTML file, but check to be safe. | 4450 // didn't represent an HTML file, but check to be safe. |
4452 throw new AnalysisException.con1("Internal error: attempting to resolve no
n-HTML file as an HTML file: ${source.fullName}"); | 4451 throw new AnalysisException("Internal error: attempting to resolve non-HTM
L file as an HTML file: ${source.fullName}"); |
4453 } | 4452 } |
4454 htmlEntry = sourceEntry as HtmlEntry; | 4453 htmlEntry = sourceEntry as HtmlEntry; |
4455 int sourceTime = getModificationStamp(source); | 4454 int sourceTime = getModificationStamp(source); |
4456 int resultTime = task.modificationTime; | 4455 int resultTime = task.modificationTime; |
4457 if (sourceTime == resultTime) { | 4456 if (sourceTime == resultTime) { |
4458 if (htmlEntry.modificationTime != sourceTime) { | 4457 if (htmlEntry.modificationTime != sourceTime) { |
4459 // The source has changed without the context being notified. Simulate n
otification. | 4458 // The source has changed without the context being notified. Simulate n
otification. |
4460 _sourceChanged(source); | 4459 _sourceChanged(source); |
4461 htmlEntry = _getReadableHtmlEntry(source); | 4460 htmlEntry = _getReadableHtmlEntry(source); |
4462 if (htmlEntry == null) { | 4461 if (htmlEntry == null) { |
4463 throw new AnalysisException.con1("An HTML file became a non-HTML file:
${source.fullName}"); | 4462 throw new AnalysisException("An HTML file became a non-HTML file: ${so
urce.fullName}"); |
4464 } | 4463 } |
4465 } | 4464 } |
4466 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4465 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
4467 if (thrownException == null) { | 4466 if (thrownException == null) { |
4468 htmlCopy.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, task.errors); | 4467 htmlCopy.setValue(HtmlEntry.POLYMER_RESOLUTION_ERRORS, task.errors); |
4469 // notify about errors | 4468 // notify about errors |
4470 ChangeNoticeImpl notice = _getNotice(source); | 4469 ChangeNoticeImpl notice = _getNotice(source); |
4471 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); | 4470 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); |
4472 } else { | 4471 } else { |
4473 htmlCopy.recordResolutionError(thrownException); | 4472 htmlCopy.recordResolutionError(thrownException); |
(...skipping 29 matching lines...) Expand all Loading... |
4503 | 4502 |
4504 /** | 4503 /** |
4505 * Record the results produced by performing a [ResolveAngularComponentTemplat
eTask]. If the | 4504 * Record the results produced by performing a [ResolveAngularComponentTemplat
eTask]. If the |
4506 * results were computed from data that is now out-of-date, then the results w
ill not be recorded. | 4505 * results were computed from data that is now out-of-date, then the results w
ill not be recorded. |
4507 * | 4506 * |
4508 * @param task the task that was performed | 4507 * @param task the task that was performed |
4509 * @throws AnalysisException if the results could not be recorded | 4508 * @throws AnalysisException if the results could not be recorded |
4510 */ | 4509 */ |
4511 HtmlEntry _recordResolveAngularComponentTemplateTaskResults(ResolveAngularComp
onentTemplateTask task) { | 4510 HtmlEntry _recordResolveAngularComponentTemplateTaskResults(ResolveAngularComp
onentTemplateTask task) { |
4512 Source source = task.source; | 4511 Source source = task.source; |
4513 AnalysisException thrownException = task.exception; | 4512 CaughtException thrownException = task.exception; |
4514 HtmlEntry htmlEntry = null; | 4513 HtmlEntry htmlEntry = null; |
4515 SourceEntry sourceEntry = _cache.get(source); | 4514 SourceEntry sourceEntry = _cache.get(source); |
4516 if (sourceEntry == null) { | 4515 if (sourceEntry == null) { |
4517 throw new ObsoleteSourceAnalysisException(source); | 4516 throw new ObsoleteSourceAnalysisException(source); |
4518 } else if (sourceEntry is! HtmlEntry) { | 4517 } else if (sourceEntry is! HtmlEntry) { |
4519 // This shouldn't be possible because we should never have performed the t
ask if the source | 4518 // This shouldn't be possible because we should never have performed the t
ask if the source |
4520 // didn't represent an HTML file, but check to be safe. | 4519 // didn't represent an HTML file, but check to be safe. |
4521 throw new AnalysisException.con1("Internal error: attempting to resolve no
n-HTML file as an HTML file: ${source.fullName}"); | 4520 throw new AnalysisException("Internal error: attempting to resolve non-HTM
L file as an HTML file: ${source.fullName}"); |
4522 } | 4521 } |
4523 htmlEntry = sourceEntry as HtmlEntry; | 4522 htmlEntry = sourceEntry as HtmlEntry; |
4524 int sourceTime = getModificationStamp(source); | 4523 int sourceTime = getModificationStamp(source); |
4525 int resultTime = task.modificationTime; | 4524 int resultTime = task.modificationTime; |
4526 if (sourceTime == resultTime) { | 4525 if (sourceTime == resultTime) { |
4527 if (htmlEntry.modificationTime != sourceTime) { | 4526 if (htmlEntry.modificationTime != sourceTime) { |
4528 // The source has changed without the context being notified. Simulate n
otification. | 4527 // The source has changed without the context being notified. Simulate n
otification. |
4529 _sourceChanged(source); | 4528 _sourceChanged(source); |
4530 htmlEntry = _getReadableHtmlEntry(source); | 4529 htmlEntry = _getReadableHtmlEntry(source); |
4531 if (htmlEntry == null) { | 4530 if (htmlEntry == null) { |
4532 throw new AnalysisException.con1("An HTML file became a non-HTML file:
${source.fullName}"); | 4531 throw new AnalysisException("An HTML file became a non-HTML file: ${so
urce.fullName}"); |
4533 } | 4532 } |
4534 } | 4533 } |
4535 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4534 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
4536 if (thrownException == null) { | 4535 if (thrownException == null) { |
4537 htmlCopy.setValue(HtmlEntry.ANGULAR_ERRORS, task.resolutionErrors); | 4536 htmlCopy.setValue(HtmlEntry.ANGULAR_ERRORS, task.resolutionErrors); |
4538 // notify about errors | 4537 // notify about errors |
4539 ChangeNoticeImpl notice = _getNotice(source); | 4538 ChangeNoticeImpl notice = _getNotice(source); |
4540 notice.htmlUnit = task.resolvedUnit; | 4539 notice.htmlUnit = task.resolvedUnit; |
4541 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); | 4540 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); |
4542 } else { | 4541 } else { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4582 | 4581 |
4583 /** | 4582 /** |
4584 * Record the results produced by performing a [ResolveAngularEntryHtmlTask].
If the results | 4583 * Record the results produced by performing a [ResolveAngularEntryHtmlTask].
If the results |
4585 * were computed from data that is now out-of-date, then the results will not
be recorded. | 4584 * were computed from data that is now out-of-date, then the results will not
be recorded. |
4586 * | 4585 * |
4587 * @param task the task that was performed | 4586 * @param task the task that was performed |
4588 * @throws AnalysisException if the results could not be recorded | 4587 * @throws AnalysisException if the results could not be recorded |
4589 */ | 4588 */ |
4590 HtmlEntry _recordResolveAngularEntryHtmlTaskResults(ResolveAngularEntryHtmlTas
k task) { | 4589 HtmlEntry _recordResolveAngularEntryHtmlTaskResults(ResolveAngularEntryHtmlTas
k task) { |
4591 Source source = task.source; | 4590 Source source = task.source; |
4592 AnalysisException thrownException = task.exception; | 4591 CaughtException thrownException = task.exception; |
4593 HtmlEntry htmlEntry = null; | 4592 HtmlEntry htmlEntry = null; |
4594 SourceEntry sourceEntry = _cache.get(source); | 4593 SourceEntry sourceEntry = _cache.get(source); |
4595 if (sourceEntry == null) { | 4594 if (sourceEntry == null) { |
4596 throw new ObsoleteSourceAnalysisException(source); | 4595 throw new ObsoleteSourceAnalysisException(source); |
4597 } else if (sourceEntry is! HtmlEntry) { | 4596 } else if (sourceEntry is! HtmlEntry) { |
4598 // This shouldn't be possible because we should never have performed the t
ask if the source | 4597 // This shouldn't be possible because we should never have performed the t
ask if the source |
4599 // didn't represent an HTML file, but check to be safe. | 4598 // didn't represent an HTML file, but check to be safe. |
4600 throw new AnalysisException.con1("Internal error: attempting to resolve no
n-HTML file as an HTML file: ${source.fullName}"); | 4599 throw new AnalysisException("Internal error: attempting to resolve non-HTM
L file as an HTML file: ${source.fullName}"); |
4601 } | 4600 } |
4602 htmlEntry = sourceEntry as HtmlEntry; | 4601 htmlEntry = sourceEntry as HtmlEntry; |
4603 int sourceTime = getModificationStamp(source); | 4602 int sourceTime = getModificationStamp(source); |
4604 int resultTime = task.modificationTime; | 4603 int resultTime = task.modificationTime; |
4605 if (sourceTime == resultTime) { | 4604 if (sourceTime == resultTime) { |
4606 if (htmlEntry.modificationTime != sourceTime) { | 4605 if (htmlEntry.modificationTime != sourceTime) { |
4607 // The source has changed without the context being notified. Simulate n
otification. | 4606 // The source has changed without the context being notified. Simulate n
otification. |
4608 _sourceChanged(source); | 4607 _sourceChanged(source); |
4609 htmlEntry = _getReadableHtmlEntry(source); | 4608 htmlEntry = _getReadableHtmlEntry(source); |
4610 if (htmlEntry == null) { | 4609 if (htmlEntry == null) { |
4611 throw new AnalysisException.con1("An HTML file became a non-HTML file:
${source.fullName}"); | 4610 throw new AnalysisException("An HTML file became a non-HTML file: ${so
urce.fullName}"); |
4612 } | 4611 } |
4613 } | 4612 } |
4614 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4613 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
4615 if (thrownException == null) { | 4614 if (thrownException == null) { |
4616 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit); | 4615 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit); |
4617 _recordAngularEntryPoint(htmlCopy, task); | 4616 _recordAngularEntryPoint(htmlCopy, task); |
4618 _cache.storedAst(source); | 4617 _cache.storedAst(source); |
4619 ChangeNoticeImpl notice = _getNotice(source); | 4618 ChangeNoticeImpl notice = _getNotice(source); |
4620 notice.htmlUnit = task.resolvedUnit; | 4619 notice.htmlUnit = task.resolvedUnit; |
4621 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); | 4620 notice.setErrors(htmlCopy.allErrors, htmlCopy.getValue(SourceEntry.LINE_
INFO)); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4664 * Record the results produced by performing a [ResolveDartUnitTask]. If the r
esults were | 4663 * Record the results produced by performing a [ResolveDartUnitTask]. If the r
esults were |
4665 * computed from data that is now out-of-date, then the results will not be re
corded. | 4664 * computed from data that is now out-of-date, then the results will not be re
corded. |
4666 * | 4665 * |
4667 * @param task the task that was performed | 4666 * @param task the task that was performed |
4668 * @return an entry containing the computed results | 4667 * @return an entry containing the computed results |
4669 * @throws AnalysisException if the results could not be recorded | 4668 * @throws AnalysisException if the results could not be recorded |
4670 */ | 4669 */ |
4671 DartEntry _recordResolveDartUnitTaskResults(ResolveDartUnitTask task) { | 4670 DartEntry _recordResolveDartUnitTaskResults(ResolveDartUnitTask task) { |
4672 Source unitSource = task.source; | 4671 Source unitSource = task.source; |
4673 Source librarySource = task.librarySource; | 4672 Source librarySource = task.librarySource; |
4674 AnalysisException thrownException = task.exception; | 4673 CaughtException thrownException = task.exception; |
4675 DartEntry dartEntry = null; | 4674 DartEntry dartEntry = null; |
4676 SourceEntry sourceEntry = _cache.get(unitSource); | 4675 SourceEntry sourceEntry = _cache.get(unitSource); |
4677 if (sourceEntry == null) { | 4676 if (sourceEntry == null) { |
4678 throw new ObsoleteSourceAnalysisException(unitSource); | 4677 throw new ObsoleteSourceAnalysisException(unitSource); |
4679 } else if (sourceEntry is! DartEntry) { | 4678 } else if (sourceEntry is! DartEntry) { |
4680 // This shouldn't be possible because we should never have performed the t
ask if the source | 4679 // This shouldn't be possible because we should never have performed the t
ask if the source |
4681 // didn't represent a Dart file, but check to be safe. | 4680 // didn't represent a Dart file, but check to be safe. |
4682 throw new AnalysisException.con1("Internal error: attempting to resolve no
n-Dart file as a Dart file: ${unitSource.fullName}"); | 4681 throw new AnalysisException("Internal error: attempting to resolve non-Dar
t file as a Dart file: ${unitSource.fullName}"); |
4683 } | 4682 } |
4684 dartEntry = sourceEntry as DartEntry; | 4683 dartEntry = sourceEntry as DartEntry; |
4685 int sourceTime = getModificationStamp(unitSource); | 4684 int sourceTime = getModificationStamp(unitSource); |
4686 int resultTime = task.modificationTime; | 4685 int resultTime = task.modificationTime; |
4687 if (sourceTime == resultTime) { | 4686 if (sourceTime == resultTime) { |
4688 if (dartEntry.modificationTime != sourceTime) { | 4687 if (dartEntry.modificationTime != sourceTime) { |
4689 // The source has changed without the context being notified. Simulate n
otification. | 4688 // The source has changed without the context being notified. Simulate n
otification. |
4690 _sourceChanged(unitSource); | 4689 _sourceChanged(unitSource); |
4691 dartEntry = _getReadableDartEntry(unitSource); | 4690 dartEntry = _getReadableDartEntry(unitSource); |
4692 if (dartEntry == null) { | 4691 if (dartEntry == null) { |
4693 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${unitSource.fullName}"); | 4692 throw new AnalysisException("A Dart file became a non-Dart file: ${uni
tSource.fullName}"); |
4694 } | 4693 } |
4695 } | 4694 } |
4696 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4695 DartEntryImpl dartCopy = dartEntry.writableCopy; |
4697 if (thrownException == null) { | 4696 if (thrownException == null) { |
4698 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource, task.
resolvedUnit); | 4697 dartCopy.setValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource, task.
resolvedUnit); |
4699 _cache.storedAst(unitSource); | 4698 _cache.storedAst(unitSource); |
4700 } else { | 4699 } else { |
4701 dartCopy.recordResolutionErrorInLibrary(librarySource, thrownException); | 4700 dartCopy.recordResolutionErrorInLibrary(librarySource, thrownException); |
4702 _cache.removedAst(unitSource); | 4701 _cache.removedAst(unitSource); |
4703 } | 4702 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4739 /** | 4738 /** |
4740 * Record the results produced by performing a [ResolveHtmlTask]. If the resul
ts were | 4739 * Record the results produced by performing a [ResolveHtmlTask]. If the resul
ts were |
4741 * computed from data that is now out-of-date, then the results will not be re
corded. | 4740 * computed from data that is now out-of-date, then the results will not be re
corded. |
4742 * | 4741 * |
4743 * @param task the task that was performed | 4742 * @param task the task that was performed |
4744 * @return an entry containing the computed results | 4743 * @return an entry containing the computed results |
4745 * @throws AnalysisException if the results could not be recorded | 4744 * @throws AnalysisException if the results could not be recorded |
4746 */ | 4745 */ |
4747 HtmlEntry _recordResolveHtmlTaskResults(ResolveHtmlTask task) { | 4746 HtmlEntry _recordResolveHtmlTaskResults(ResolveHtmlTask task) { |
4748 Source source = task.source; | 4747 Source source = task.source; |
4749 AnalysisException thrownException = task.exception; | 4748 CaughtException thrownException = task.exception; |
4750 HtmlEntry htmlEntry = null; | 4749 HtmlEntry htmlEntry = null; |
4751 SourceEntry sourceEntry = _cache.get(source); | 4750 SourceEntry sourceEntry = _cache.get(source); |
4752 if (sourceEntry == null) { | 4751 if (sourceEntry == null) { |
4753 throw new ObsoleteSourceAnalysisException(source); | 4752 throw new ObsoleteSourceAnalysisException(source); |
4754 } else if (sourceEntry is! HtmlEntry) { | 4753 } else if (sourceEntry is! HtmlEntry) { |
4755 // This shouldn't be possible because we should never have performed the t
ask if the source | 4754 // This shouldn't be possible because we should never have performed the t
ask if the source |
4756 // didn't represent an HTML file, but check to be safe. | 4755 // didn't represent an HTML file, but check to be safe. |
4757 throw new AnalysisException.con1("Internal error: attempting to resolve no
n-HTML file as an HTML file: ${source.fullName}"); | 4756 throw new AnalysisException("Internal error: attempting to resolve non-HTM
L file as an HTML file: ${source.fullName}"); |
4758 } | 4757 } |
4759 htmlEntry = sourceEntry as HtmlEntry; | 4758 htmlEntry = sourceEntry as HtmlEntry; |
4760 int sourceTime = getModificationStamp(source); | 4759 int sourceTime = getModificationStamp(source); |
4761 int resultTime = task.modificationTime; | 4760 int resultTime = task.modificationTime; |
4762 if (sourceTime == resultTime) { | 4761 if (sourceTime == resultTime) { |
4763 if (htmlEntry.modificationTime != sourceTime) { | 4762 if (htmlEntry.modificationTime != sourceTime) { |
4764 // The source has changed without the context being notified. Simulate n
otification. | 4763 // The source has changed without the context being notified. Simulate n
otification. |
4765 _sourceChanged(source); | 4764 _sourceChanged(source); |
4766 htmlEntry = _getReadableHtmlEntry(source); | 4765 htmlEntry = _getReadableHtmlEntry(source); |
4767 if (htmlEntry == null) { | 4766 if (htmlEntry == null) { |
4768 throw new AnalysisException.con1("An HTML file became a non-HTML file:
${source.fullName}"); | 4767 throw new AnalysisException("An HTML file became a non-HTML file: ${so
urce.fullName}"); |
4769 } | 4768 } |
4770 } | 4769 } |
4771 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 4770 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
4772 if (thrownException == null) { | 4771 if (thrownException == null) { |
4773 htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.FLUSHED); | 4772 htmlCopy.setState(HtmlEntry.PARSED_UNIT, CacheState.FLUSHED); |
4774 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit); | 4773 htmlCopy.setValue(HtmlEntry.RESOLVED_UNIT, task.resolvedUnit); |
4775 htmlCopy.setValue(HtmlEntry.ELEMENT, task.element); | 4774 htmlCopy.setValue(HtmlEntry.ELEMENT, task.element); |
4776 htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors); | 4775 htmlCopy.setValue(HtmlEntry.RESOLUTION_ERRORS, task.resolutionErrors); |
4777 _cache.storedAst(source); | 4776 _cache.storedAst(source); |
4778 ChangeNoticeImpl notice = _getNotice(source); | 4777 ChangeNoticeImpl notice = _getNotice(source); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4821 /** | 4820 /** |
4822 * Record the results produced by performing a [ScanDartTask]. If the results
were computed | 4821 * Record the results produced by performing a [ScanDartTask]. If the results
were computed |
4823 * from data that is now out-of-date, then the results will not be recorded. | 4822 * from data that is now out-of-date, then the results will not be recorded. |
4824 * | 4823 * |
4825 * @param task the task that was performed | 4824 * @param task the task that was performed |
4826 * @return an entry containing the computed results | 4825 * @return an entry containing the computed results |
4827 * @throws AnalysisException if the results could not be recorded | 4826 * @throws AnalysisException if the results could not be recorded |
4828 */ | 4827 */ |
4829 DartEntry _recordScanDartTaskResults(ScanDartTask task) { | 4828 DartEntry _recordScanDartTaskResults(ScanDartTask task) { |
4830 Source source = task.source; | 4829 Source source = task.source; |
4831 AnalysisException thrownException = task.exception; | 4830 CaughtException thrownException = task.exception; |
4832 DartEntry dartEntry = null; | 4831 DartEntry dartEntry = null; |
4833 SourceEntry sourceEntry = _cache.get(source); | 4832 SourceEntry sourceEntry = _cache.get(source); |
4834 if (sourceEntry == null) { | 4833 if (sourceEntry == null) { |
4835 throw new ObsoleteSourceAnalysisException(source); | 4834 throw new ObsoleteSourceAnalysisException(source); |
4836 } else if (sourceEntry is! DartEntry) { | 4835 } else if (sourceEntry is! DartEntry) { |
4837 // This shouldn't be possible because we should never have performed the t
ask if the source | 4836 // This shouldn't be possible because we should never have performed the t
ask if the source |
4838 // didn't represent a Dart file, but check to be safe. | 4837 // didn't represent a Dart file, but check to be safe. |
4839 throw new AnalysisException.con1("Internal error: attempting to parse non-
Dart file as a Dart file: ${source.fullName}"); | 4838 throw new AnalysisException("Internal error: attempting to parse non-Dart
file as a Dart file: ${source.fullName}"); |
4840 } | 4839 } |
4841 dartEntry = sourceEntry as DartEntry; | 4840 dartEntry = sourceEntry as DartEntry; |
4842 int sourceTime = getModificationStamp(source); | 4841 int sourceTime = getModificationStamp(source); |
4843 int resultTime = task.modificationTime; | 4842 int resultTime = task.modificationTime; |
4844 if (sourceTime == resultTime) { | 4843 if (sourceTime == resultTime) { |
4845 if (dartEntry.modificationTime != sourceTime) { | 4844 if (dartEntry.modificationTime != sourceTime) { |
4846 // The source has changed without the context being notified. Simulate n
otification. | 4845 // The source has changed without the context being notified. Simulate n
otification. |
4847 _sourceChanged(source); | 4846 _sourceChanged(source); |
4848 dartEntry = _getReadableDartEntry(source); | 4847 dartEntry = _getReadableDartEntry(source); |
4849 if (dartEntry == null) { | 4848 if (dartEntry == null) { |
4850 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${source.fullName}"); | 4849 throw new AnalysisException("A Dart file became a non-Dart file: ${sou
rce.fullName}"); |
4851 } | 4850 } |
4852 } | 4851 } |
4853 DartEntryImpl dartCopy = dartEntry.writableCopy; | 4852 DartEntryImpl dartCopy = dartEntry.writableCopy; |
4854 if (thrownException == null) { | 4853 if (thrownException == null) { |
4855 LineInfo lineInfo = task.lineInfo; | 4854 LineInfo lineInfo = task.lineInfo; |
4856 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo); | 4855 dartCopy.setValue(SourceEntry.LINE_INFO, lineInfo); |
4857 dartCopy.setValue(DartEntry.TOKEN_STREAM, task.tokenStream); | 4856 dartCopy.setValue(DartEntry.TOKEN_STREAM, task.tokenStream); |
4858 dartCopy.setValue(DartEntry.SCAN_ERRORS, task.errors); | 4857 dartCopy.setValue(DartEntry.SCAN_ERRORS, task.errors); |
4859 _cache.storedAst(source); | 4858 _cache.storedAst(source); |
4860 _workManager.add(source, SourcePriority.NORMAL_PART); | 4859 _workManager.add(source, SourcePriority.NORMAL_PART); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5044 /** | 5043 /** |
5045 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 5044 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
5046 * | 5045 * |
5047 * @param source the source that has been deleted | 5046 * @param source the source that has been deleted |
5048 */ | 5047 */ |
5049 void _sourceDeleted(Source source) { | 5048 void _sourceDeleted(Source source) { |
5050 SourceEntry sourceEntry = _cache.get(source); | 5049 SourceEntry sourceEntry = _cache.get(source); |
5051 if (sourceEntry is HtmlEntry) { | 5050 if (sourceEntry is HtmlEntry) { |
5052 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy; | 5051 HtmlEntryImpl htmlCopy = sourceEntry.writableCopy; |
5053 _invalidateAngularResolution(htmlCopy); | 5052 _invalidateAngularResolution(htmlCopy); |
5054 htmlCopy.recordContentError(new AnalysisException.con1("This source was ma
rked as being deleted")); | 5053 htmlCopy.recordContentError(new CaughtException(new AnalysisException("Thi
s source was marked as being deleted"), null)); |
5055 _cache.put(source, htmlCopy); | 5054 _cache.put(source, htmlCopy); |
5056 } else if (sourceEntry is DartEntry) { | 5055 } else if (sourceEntry is DartEntry) { |
5057 Set<Source> libraries = new Set<Source>(); | 5056 Set<Source> libraries = new Set<Source>(); |
5058 for (Source librarySource in getLibrariesContaining(source)) { | 5057 for (Source librarySource in getLibrariesContaining(source)) { |
5059 libraries.add(librarySource); | 5058 libraries.add(librarySource); |
5060 for (Source dependentLibrary in getLibrariesDependingOn(librarySource))
{ | 5059 for (Source dependentLibrary in getLibrariesDependingOn(librarySource))
{ |
5061 libraries.add(dependentLibrary); | 5060 libraries.add(dependentLibrary); |
5062 } | 5061 } |
5063 } | 5062 } |
5064 for (Source librarySource in libraries) { | 5063 for (Source librarySource in libraries) { |
5065 _invalidateLibraryResolution(librarySource); | 5064 _invalidateLibraryResolution(librarySource); |
5066 } | 5065 } |
5067 DartEntryImpl dartCopy = sourceEntry.writableCopy; | 5066 DartEntryImpl dartCopy = sourceEntry.writableCopy; |
5068 dartCopy.recordContentError(new AnalysisException.con1("This source was ma
rked as being deleted")); | 5067 dartCopy.recordContentError(new CaughtException(new AnalysisException("Thi
s source was marked as being deleted"), null)); |
5069 _cache.put(source, dartCopy); | 5068 _cache.put(source, dartCopy); |
5070 } | 5069 } |
5071 _workManager.remove(source); | 5070 _workManager.remove(source); |
5072 _removeFromPriorityOrder(source); | 5071 _removeFromPriorityOrder(source); |
5073 } | 5072 } |
5074 | 5073 |
5075 /** | 5074 /** |
5076 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 5075 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
5077 * | 5076 * |
5078 * @param source the source that has been removed | 5077 * @param source the source that has been removed |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5748 */ | 5747 */ |
5749 abstract class AnalysisContextStatistics { | 5748 abstract class AnalysisContextStatistics { |
5750 /** | 5749 /** |
5751 * Return the statistics for each kind of cached data. | 5750 * Return the statistics for each kind of cached data. |
5752 */ | 5751 */ |
5753 List<AnalysisContextStatistics_CacheRow> get cacheRows; | 5752 List<AnalysisContextStatistics_CacheRow> get cacheRows; |
5754 | 5753 |
5755 /** | 5754 /** |
5756 * Return the exceptions that caused some entries to have a state of [CacheSta
te#ERROR]. | 5755 * Return the exceptions that caused some entries to have a state of [CacheSta
te#ERROR]. |
5757 */ | 5756 */ |
5758 List<AnalysisException> get exceptions; | 5757 List<CaughtException> get exceptions; |
5759 | 5758 |
5760 /** | 5759 /** |
5761 * Return information about each of the partitions in the cache. | 5760 * Return information about each of the partitions in the cache. |
5762 */ | 5761 */ |
5763 List<AnalysisContextStatistics_PartitionData> get partitionData; | 5762 List<AnalysisContextStatistics_PartitionData> get partitionData; |
5764 | 5763 |
5765 /** | 5764 /** |
5766 * Return an array containing all of the sources in the cache. | 5765 * Return an array containing all of the sources in the cache. |
5767 */ | 5766 */ |
5768 List<Source> get sources; | 5767 List<Source> get sources; |
5769 } | 5768 } |
5770 | 5769 |
5771 /** | 5770 /** |
5772 * Implementation of the [AnalysisContextStatistics]. | 5771 * Implementation of the [AnalysisContextStatistics]. |
5773 */ | 5772 */ |
5774 class AnalysisContextStatisticsImpl implements AnalysisContextStatistics { | 5773 class AnalysisContextStatisticsImpl implements AnalysisContextStatistics { |
5775 Map<String, AnalysisContextStatistics_CacheRow> _dataMap = new Map<String, Ana
lysisContextStatistics_CacheRow>(); | 5774 Map<String, AnalysisContextStatistics_CacheRow> _dataMap = new Map<String, Ana
lysisContextStatistics_CacheRow>(); |
5776 | 5775 |
5777 List<Source> _sources = new List<Source>(); | 5776 List<Source> _sources = new List<Source>(); |
5778 | 5777 |
5779 Set<AnalysisException> _exceptions = new Set<AnalysisException>(); | 5778 Set<CaughtException> _exceptions = new Set<CaughtException>(); |
5780 | 5779 |
5781 List<AnalysisContextStatistics_PartitionData> _partitionData; | 5780 List<AnalysisContextStatistics_PartitionData> _partitionData; |
5782 | 5781 |
5783 void addSource(Source source) { | 5782 void addSource(Source source) { |
5784 _sources.add(source); | 5783 _sources.add(source); |
5785 } | 5784 } |
5786 | 5785 |
5787 @override | 5786 @override |
5788 List<AnalysisContextStatistics_CacheRow> get cacheRows { | 5787 List<AnalysisContextStatistics_CacheRow> get cacheRows { |
5789 Iterable<AnalysisContextStatistics_CacheRow> items = _dataMap.values; | 5788 Iterable<AnalysisContextStatistics_CacheRow> items = _dataMap.values; |
5790 return new List.from(items); | 5789 return new List.from(items); |
5791 } | 5790 } |
5792 | 5791 |
5793 @override | 5792 @override |
5794 List<AnalysisException> get exceptions => new List.from(_exceptions); | 5793 List<CaughtException> get exceptions => new List.from(_exceptions); |
5795 | 5794 |
5796 @override | 5795 @override |
5797 List<AnalysisContextStatistics_PartitionData> get partitionData => _partitionD
ata; | 5796 List<AnalysisContextStatistics_PartitionData> get partitionData => _partitionD
ata; |
5798 | 5797 |
5799 @override | 5798 @override |
5800 List<Source> get sources => new List.from(_sources); | 5799 List<Source> get sources => new List.from(_sources); |
5801 | 5800 |
5802 void putCacheItem(SourceEntry dartEntry, DataDescriptor descriptor) { | 5801 void putCacheItem(SourceEntry dartEntry, DataDescriptor descriptor) { |
5803 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getState(descriptor))
; | 5802 _internalPutCacheItem(dartEntry, descriptor, dartEntry.getState(descriptor))
; |
5804 } | 5803 } |
(...skipping 11 matching lines...) Expand all Loading... |
5816 | 5815 |
5817 void _internalPutCacheItem(SourceEntry dartEntry, DataDescriptor rowDesc, Cach
eState state) { | 5816 void _internalPutCacheItem(SourceEntry dartEntry, DataDescriptor rowDesc, Cach
eState state) { |
5818 String rowName = rowDesc.toString(); | 5817 String rowName = rowDesc.toString(); |
5819 AnalysisContextStatisticsImpl_CacheRowImpl row = _dataMap[rowName] as Analys
isContextStatisticsImpl_CacheRowImpl; | 5818 AnalysisContextStatisticsImpl_CacheRowImpl row = _dataMap[rowName] as Analys
isContextStatisticsImpl_CacheRowImpl; |
5820 if (row == null) { | 5819 if (row == null) { |
5821 row = new AnalysisContextStatisticsImpl_CacheRowImpl(rowName); | 5820 row = new AnalysisContextStatisticsImpl_CacheRowImpl(rowName); |
5822 _dataMap[rowName] = row; | 5821 _dataMap[rowName] = row; |
5823 } | 5822 } |
5824 row._incState(state); | 5823 row._incState(state); |
5825 if (state == CacheState.ERROR) { | 5824 if (state == CacheState.ERROR) { |
5826 AnalysisException exception = dartEntry.exception; | 5825 CaughtException exception = dartEntry.exception; |
5827 if (exception != null) { | 5826 if (exception != null) { |
5828 _exceptions.add(exception); | 5827 _exceptions.add(exception); |
5829 } | 5828 } |
5830 } | 5829 } |
5831 } | 5830 } |
5832 } | 5831 } |
5833 | 5832 |
5834 class AnalysisContextStatisticsImpl_CacheRowImpl implements AnalysisContextStati
stics_CacheRow { | 5833 class AnalysisContextStatisticsImpl_CacheRowImpl implements AnalysisContextStati
stics_CacheRow { |
5835 final String name; | 5834 final String name; |
5836 | 5835 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6169 /** | 6168 /** |
6170 * Initialize an newly created error info with the errors and line information | 6169 * Initialize an newly created error info with the errors and line information |
6171 * | 6170 * |
6172 * @param errors the errors as a result of analysis | 6171 * @param errors the errors as a result of analysis |
6173 * @param lineinfo the line info for the errors | 6172 * @param lineinfo the line info for the errors |
6174 */ | 6173 */ |
6175 AnalysisErrorInfoImpl(this.errors, this.lineInfo); | 6174 AnalysisErrorInfoImpl(this.errors, this.lineInfo); |
6176 } | 6175 } |
6177 | 6176 |
6178 /** | 6177 /** |
6179 * Instances of the class `AnalysisException` represent an exception that occurr
ed during the | |
6180 * analysis of one or more sources. | |
6181 */ | |
6182 class AnalysisException extends JavaException { | |
6183 /** | |
6184 * Initialize a newly created exception. | |
6185 */ | |
6186 AnalysisException() : super(); | |
6187 | |
6188 /** | |
6189 * Initialize a newly created exception to have the given message. | |
6190 * | |
6191 * @param message the message associated with the exception | |
6192 */ | |
6193 AnalysisException.con1(String message) : super(message); | |
6194 | |
6195 /** | |
6196 * Initialize a newly created exception to have the given message and cause. | |
6197 * | |
6198 * @param message the message associated with the exception | |
6199 * @param cause the underlying exception that caused this exception | |
6200 */ | |
6201 AnalysisException.con2(String message, Exception cause) : super(message, cause
); | |
6202 | |
6203 /** | |
6204 * Initialize a newly created exception to have the given cause. | |
6205 * | |
6206 * @param cause the underlying exception that caused this exception | |
6207 */ | |
6208 AnalysisException.con3(Exception cause) : super.withCause(cause); | |
6209 } | |
6210 | |
6211 /** | |
6212 * The enumeration `AnalysisLevel` encodes the different levels at which a sourc
e can be | 6178 * The enumeration `AnalysisLevel` encodes the different levels at which a sourc
e can be |
6213 * analyzed. | 6179 * analyzed. |
6214 */ | 6180 */ |
6215 class AnalysisLevel extends Enum<AnalysisLevel> { | 6181 class AnalysisLevel extends Enum<AnalysisLevel> { |
6216 /** | 6182 /** |
6217 * Indicates a source should be fully analyzed. | 6183 * Indicates a source should be fully analyzed. |
6218 */ | 6184 */ |
6219 static const AnalysisLevel ALL = const AnalysisLevel('ALL', 0); | 6185 static const AnalysisLevel ALL = const AnalysisLevel('ALL', 0); |
6220 | 6186 |
6221 /** | 6187 /** |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6480 abstract class AnalysisTask { | 6446 abstract class AnalysisTask { |
6481 /** | 6447 /** |
6482 * The context in which the task is to be performed. | 6448 * The context in which the task is to be performed. |
6483 */ | 6449 */ |
6484 final InternalAnalysisContext context; | 6450 final InternalAnalysisContext context; |
6485 | 6451 |
6486 /** | 6452 /** |
6487 * The exception that was thrown while performing this task, or `null` if the
task completed | 6453 * The exception that was thrown while performing this task, or `null` if the
task completed |
6488 * successfully. | 6454 * successfully. |
6489 */ | 6455 */ |
6490 AnalysisException _thrownException; | 6456 CaughtException _thrownException; |
6491 | 6457 |
6492 /** | 6458 /** |
6493 * Initialize a newly created task to perform analysis within the given contex
t. | 6459 * Initialize a newly created task to perform analysis within the given contex
t. |
6494 * | 6460 * |
6495 * @param context the context in which the task is to be performed | 6461 * @param context the context in which the task is to be performed |
6496 */ | 6462 */ |
6497 AnalysisTask(this.context); | 6463 AnalysisTask(this.context); |
6498 | 6464 |
6499 /** | 6465 /** |
6500 * Use the given visitor to visit this task. | 6466 * Use the given visitor to visit this task. |
6501 * | 6467 * |
6502 * @param visitor the visitor that should be used to visit this task | 6468 * @param visitor the visitor that should be used to visit this task |
6503 * @return the value returned by the visitor | 6469 * @return the value returned by the visitor |
6504 * @throws AnalysisException if the visitor throws the exception | 6470 * @throws AnalysisException if the visitor throws the exception |
6505 */ | 6471 */ |
6506 accept(AnalysisTaskVisitor visitor); | 6472 accept(AnalysisTaskVisitor visitor); |
6507 | 6473 |
6508 /** | 6474 /** |
6509 * Return the exception that was thrown while performing this task, or `null`
if the task | 6475 * Return the exception that was thrown while performing this task, or `null`
if the task |
6510 * completed successfully. | 6476 * completed successfully. |
6511 * | 6477 * |
6512 * @return the exception that was thrown while performing this task | 6478 * @return the exception that was thrown while performing this task |
6513 */ | 6479 */ |
6514 AnalysisException get exception => _thrownException; | 6480 CaughtException get exception => _thrownException; |
6515 | 6481 |
6516 /** | 6482 /** |
6517 * Perform this analysis task and use the given visitor to visit this task aft
er it has completed. | 6483 * Perform this analysis task and use the given visitor to visit this task aft
er it has completed. |
6518 * | 6484 * |
6519 * @param visitor the visitor used to visit this task after it has completed | 6485 * @param visitor the visitor used to visit this task after it has completed |
6520 * @return the value returned by the visitor | 6486 * @return the value returned by the visitor |
6521 * @throws AnalysisException if the visitor throws the exception | 6487 * @throws AnalysisException if the visitor throws the exception |
6522 */ | 6488 */ |
6523 Object perform(AnalysisTaskVisitor visitor) { | 6489 Object perform(AnalysisTaskVisitor visitor) { |
6524 try { | 6490 try { |
6525 _safelyPerform(); | 6491 _safelyPerform(); |
6526 } on AnalysisException catch (exception) { | 6492 } on AnalysisException catch (exception, stackTrace) { |
6527 _thrownException = exception; | 6493 _thrownException = new CaughtException(exception, stackTrace); |
6528 AnalysisEngine.instance.logger.logInformation2("Task failed: ${taskDescrip
tion}", exception); | 6494 AnalysisEngine.instance.logger.logInformation2("Task failed: ${taskDescrip
tion}", new CaughtException(exception, stackTrace)); |
6529 } | 6495 } |
6530 return accept(visitor); | 6496 return accept(visitor); |
6531 } | 6497 } |
6532 | 6498 |
6533 @override | 6499 @override |
6534 String toString() => taskDescription; | 6500 String toString() => taskDescription; |
6535 | 6501 |
6536 /** | 6502 /** |
6537 * Return a textual description of this task. | 6503 * Return a textual description of this task. |
6538 * | 6504 * |
(...skipping 12 matching lines...) Expand all Loading... |
6551 * Perform this analysis task, ensuring that all exceptions are wrapped in an | 6517 * Perform this analysis task, ensuring that all exceptions are wrapped in an |
6552 * [AnalysisException]. | 6518 * [AnalysisException]. |
6553 * | 6519 * |
6554 * @throws AnalysisException if any exception occurs while performing the task | 6520 * @throws AnalysisException if any exception occurs while performing the task |
6555 */ | 6521 */ |
6556 void _safelyPerform() { | 6522 void _safelyPerform() { |
6557 try { | 6523 try { |
6558 internalPerform(); | 6524 internalPerform(); |
6559 } on AnalysisException catch (exception) { | 6525 } on AnalysisException catch (exception) { |
6560 throw exception; | 6526 throw exception; |
6561 } on JavaException catch (exception) { | 6527 } on JavaException catch (exception, stackTrace) { |
6562 throw new AnalysisException.con3(exception); | 6528 throw new AnalysisException("Exception", new CaughtException(exception, st
ackTrace)); |
6563 } | 6529 } |
6564 } | 6530 } |
6565 } | 6531 } |
6566 | 6532 |
6567 /** | 6533 /** |
6568 * The interface `AnalysisTaskVisitor` defines the behavior of objects that can
visit tasks. | 6534 * The interface `AnalysisTaskVisitor` defines the behavior of objects that can
visit tasks. |
6569 * While tasks are not structured in any interesting way, this class provides th
e ability to | 6535 * While tasks are not structured in any interesting way, this class provides th
e ability to |
6570 * dispatch to an appropriate method. | 6536 * dispatch to an appropriate method. |
6571 */ | 6537 */ |
6572 abstract class AnalysisTaskVisitor<E> { | 6538 abstract class AnalysisTaskVisitor<E> { |
(...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7703 void internalPerform() { | 7669 void internalPerform() { |
7704 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.BuildDartElementModel.internalPerform"); | 7670 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi
ne.BuildDartElementModel.internalPerform"); |
7705 try { | 7671 try { |
7706 // | 7672 // |
7707 // Build the map of libraries that are known. | 7673 // Build the map of libraries that are known. |
7708 // | 7674 // |
7709 _libraryMap = _buildLibraryMap(); | 7675 _libraryMap = _buildLibraryMap(); |
7710 _coreLibrary = _libraryMap[_coreLibrarySource]; | 7676 _coreLibrary = _libraryMap[_coreLibrarySource]; |
7711 LibraryElement coreElement = _coreLibrary.libraryElement; | 7677 LibraryElement coreElement = _coreLibrary.libraryElement; |
7712 if (coreElement == null) { | 7678 if (coreElement == null) { |
7713 throw new AnalysisException.con1("Could not resolve dart:core"); | 7679 throw new AnalysisException("Could not resolve dart:core"); |
7714 } | 7680 } |
7715 instrumentation.metric3("buildLibraryMap", "complete"); | 7681 instrumentation.metric3("buildLibraryMap", "complete"); |
7716 // | 7682 // |
7717 // Build the element models representing the libraries being resolved. Thi
s is done in three | 7683 // Build the element models representing the libraries being resolved. Thi
s is done in three |
7718 // steps. | 7684 // steps. |
7719 // | 7685 // |
7720 // 1. Build the basic element models without making any connections betwee
n elements other than | 7686 // 1. Build the basic element models without making any connections betwee
n elements other than |
7721 // the basic parent/child relationships. This includes building the ele
ments representing the | 7687 // the basic parent/child relationships. This includes building the ele
ments representing the |
7722 // libraries. | 7688 // libraries. |
7723 // | 7689 // |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8170 for (int i = 0; i < _recentlyUsed.length; i++) { | 8136 for (int i = 0; i < _recentlyUsed.length; i++) { |
8171 Source source = _recentlyUsed[i]; | 8137 Source source = _recentlyUsed[i]; |
8172 RetentionPriority priority = _retentionPolicy.getAstPriority(source, _sour
ceMap[source]); | 8138 RetentionPriority priority = _retentionPolicy.getAstPriority(source, _sour
ceMap[source]); |
8173 if (priority == RetentionPriority.LOW) { | 8139 if (priority == RetentionPriority.LOW) { |
8174 return _recentlyUsed.removeAt(i); | 8140 return _recentlyUsed.removeAt(i); |
8175 } else if (priority == RetentionPriority.MEDIUM && sourceToRemove < 0) { | 8141 } else if (priority == RetentionPriority.MEDIUM && sourceToRemove < 0) { |
8176 sourceToRemove = i; | 8142 sourceToRemove = i; |
8177 } | 8143 } |
8178 } | 8144 } |
8179 if (sourceToRemove < 0) { | 8145 if (sourceToRemove < 0) { |
8180 AnalysisEngine.instance.logger.logError2("Internal error: Could not flush
data from the cache", new JavaException()); | 8146 // This happens if the retention policy returns a priority of HIGH for all
of the sources that |
| 8147 // have been recently used. This is the case, for example, when the list o
f priority sources |
| 8148 // is bigger than the current cache size. |
8181 return null; | 8149 return null; |
8182 } | 8150 } |
8183 return _recentlyUsed.removeAt(sourceToRemove); | 8151 return _recentlyUsed.removeAt(sourceToRemove); |
8184 } | 8152 } |
8185 } | 8153 } |
8186 | 8154 |
8187 /** | 8155 /** |
8188 * Instances of the class `CacheRetentionPolicy` define the behavior of objects
that determine | 8156 * Instances of the class `CacheRetentionPolicy` define the behavior of objects
that determine |
8189 * how important it is for data to be retained in the analysis cache. | 8157 * how important it is for data to be retained in the analysis cache. |
8190 */ | 8158 */ |
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9404 } | 9372 } |
9405 | 9373 |
9406 /** | 9374 /** |
9407 * Record that an error occurred while attempting to build the element model f
or the source | 9375 * Record that an error occurred while attempting to build the element model f
or the source |
9408 * represented by this entry. This will set the state of all resolution-based
information as being | 9376 * represented by this entry. This will set the state of all resolution-based
information as being |
9409 * in error, but will not change the state of any parse results. | 9377 * in error, but will not change the state of any parse results. |
9410 * | 9378 * |
9411 * @param librarySource the source of the library in which the element model w
as being built | 9379 * @param librarySource the source of the library in which the element model w
as being built |
9412 * @param exception the exception that shows where the error occurred | 9380 * @param exception the exception that shows where the error occurred |
9413 */ | 9381 */ |
9414 void recordBuildElementErrorInLibrary(Source librarySource, AnalysisException
exception) { | 9382 void recordBuildElementErrorInLibrary(Source librarySource, CaughtException ex
ception) { |
9415 this.exception = exception; | 9383 this.exception = exception; |
9416 _element = null; | 9384 _element = null; |
9417 _elementState = CacheState.ERROR; | 9385 _elementState = CacheState.ERROR; |
9418 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); | 9386 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); |
9419 _clientServerState = CacheState.ERROR; | 9387 _clientServerState = CacheState.ERROR; |
9420 _launchableState = CacheState.ERROR; | 9388 _launchableState = CacheState.ERROR; |
9421 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); | 9389 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); |
9422 state.recordBuildElementError(); | 9390 state.recordBuildElementError(); |
9423 } | 9391 } |
9424 | 9392 |
9425 /** | 9393 /** |
9426 * Record that an in-process model build has stopped without recording results
because the results | 9394 * Record that an in-process model build has stopped without recording results
because the results |
9427 * were invalidated before they could be recorded. | 9395 * were invalidated before they could be recorded. |
9428 */ | 9396 */ |
9429 void recordBuildElementNotInProcess() { | 9397 void recordBuildElementNotInProcess() { |
9430 if (_elementState == CacheState.IN_PROCESS) { | 9398 if (_elementState == CacheState.IN_PROCESS) { |
9431 _elementState = CacheState.INVALID; | 9399 _elementState = CacheState.INVALID; |
9432 } | 9400 } |
9433 if (_clientServerState == CacheState.IN_PROCESS) { | 9401 if (_clientServerState == CacheState.IN_PROCESS) { |
9434 _clientServerState = CacheState.INVALID; | 9402 _clientServerState = CacheState.INVALID; |
9435 } | 9403 } |
9436 if (_launchableState == CacheState.IN_PROCESS) { | 9404 if (_launchableState == CacheState.IN_PROCESS) { |
9437 _launchableState = CacheState.INVALID; | 9405 _launchableState = CacheState.INVALID; |
9438 } | 9406 } |
9439 } | 9407 } |
9440 | 9408 |
9441 @override | 9409 @override |
9442 void recordContentError(AnalysisException exception) { | 9410 void recordContentError(CaughtException exception) { |
9443 super.recordContentError(exception); | 9411 super.recordContentError(exception); |
9444 recordScanError(exception); | 9412 recordScanError(exception); |
9445 } | 9413 } |
9446 | 9414 |
9447 /** | 9415 /** |
9448 * Record that an error occurred while attempting to generate hints for the so
urce represented by | 9416 * Record that an error occurred while attempting to generate hints for the so
urce represented by |
9449 * this entry. This will set the state of all verification information as bein
g in error. | 9417 * this entry. This will set the state of all verification information as bein
g in error. |
9450 * | 9418 * |
9451 * @param librarySource the source of the library in which hints were being ge
nerated | 9419 * @param librarySource the source of the library in which hints were being ge
nerated |
9452 * @param exception the exception that shows where the error occurred | 9420 * @param exception the exception that shows where the error occurred |
9453 */ | 9421 */ |
9454 void recordHintErrorInLibrary(Source librarySource, AnalysisException exceptio
n) { | 9422 void recordHintErrorInLibrary(Source librarySource, CaughtException exception)
{ |
9455 this.exception = exception; | 9423 this.exception = exception; |
9456 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); | 9424 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); |
9457 state.recordHintError(); | 9425 state.recordHintError(); |
9458 } | 9426 } |
9459 | 9427 |
9460 /** | 9428 /** |
9461 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 9429 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
9462 * entry. This will set the state of all information, including any resolution
-based information, | 9430 * entry. This will set the state of all information, including any resolution
-based information, |
9463 * as being in error. | 9431 * as being in error. |
9464 * | 9432 * |
9465 * @param exception the exception that shows where the error occurred | 9433 * @param exception the exception that shows where the error occurred |
9466 */ | 9434 */ |
9467 void recordParseError(AnalysisException exception) { | 9435 void recordParseError(CaughtException exception) { |
9468 _sourceKind = SourceKind.UNKNOWN; | 9436 _sourceKind = SourceKind.UNKNOWN; |
9469 _sourceKindState = CacheState.ERROR; | 9437 _sourceKindState = CacheState.ERROR; |
9470 _parseErrors = AnalysisError.NO_ERRORS; | 9438 _parseErrors = AnalysisError.NO_ERRORS; |
9471 _parseErrorsState = CacheState.ERROR; | 9439 _parseErrorsState = CacheState.ERROR; |
9472 _parsedUnit = null; | 9440 _parsedUnit = null; |
9473 _parsedUnitAccessed = false; | 9441 _parsedUnitAccessed = false; |
9474 _parsedUnitState = CacheState.ERROR; | 9442 _parsedUnitState = CacheState.ERROR; |
9475 _exportedLibraries = Source.EMPTY_ARRAY; | 9443 _exportedLibraries = Source.EMPTY_ARRAY; |
9476 _exportedLibrariesState = CacheState.ERROR; | 9444 _exportedLibrariesState = CacheState.ERROR; |
9477 _importedLibraries = Source.EMPTY_ARRAY; | 9445 _importedLibraries = Source.EMPTY_ARRAY; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9534 } | 9502 } |
9535 } | 9503 } |
9536 | 9504 |
9537 /** | 9505 /** |
9538 * Record that an error occurred while attempting to resolve the source repres
ented by this entry. | 9506 * Record that an error occurred while attempting to resolve the source repres
ented by this entry. |
9539 * This will set the state of all resolution-based information as being in err
or, but will not | 9507 * This will set the state of all resolution-based information as being in err
or, but will not |
9540 * change the state of any parse results. | 9508 * change the state of any parse results. |
9541 * | 9509 * |
9542 * @param exception the exception that shows where the error occurred | 9510 * @param exception the exception that shows where the error occurred |
9543 */ | 9511 */ |
9544 void recordResolutionError(AnalysisException exception) { | 9512 void recordResolutionError(CaughtException exception) { |
9545 this.exception = exception; | 9513 this.exception = exception; |
9546 _element = null; | 9514 _element = null; |
9547 _elementState = CacheState.ERROR; | 9515 _elementState = CacheState.ERROR; |
9548 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); | 9516 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); |
9549 _clientServerState = CacheState.ERROR; | 9517 _clientServerState = CacheState.ERROR; |
9550 _launchableState = CacheState.ERROR; | 9518 _launchableState = CacheState.ERROR; |
9551 _publicNamespace = null; | 9519 _publicNamespace = null; |
9552 _publicNamespaceState = CacheState.ERROR; | 9520 _publicNamespaceState = CacheState.ERROR; |
9553 _resolutionState.recordResolutionErrorsInAllLibraries(); | 9521 _resolutionState.recordResolutionErrorsInAllLibraries(); |
9554 } | 9522 } |
9555 | 9523 |
9556 /** | 9524 /** |
9557 * Record that an error occurred while attempting to resolve the source repres
ented by this entry. | 9525 * Record that an error occurred while attempting to resolve the source repres
ented by this entry. |
9558 * This will set the state of all resolution-based information as being in err
or, but will not | 9526 * This will set the state of all resolution-based information as being in err
or, but will not |
9559 * change the state of any parse results. | 9527 * change the state of any parse results. |
9560 * | 9528 * |
9561 * @param librarySource the source of the library in which resolution was bein
g performed | 9529 * @param librarySource the source of the library in which resolution was bein
g performed |
9562 * @param exception the exception that shows where the error occurred | 9530 * @param exception the exception that shows where the error occurred |
9563 */ | 9531 */ |
9564 void recordResolutionErrorInLibrary(Source librarySource, AnalysisException ex
ception) { | 9532 void recordResolutionErrorInLibrary(Source librarySource, CaughtException exce
ption) { |
9565 this.exception = exception; | 9533 this.exception = exception; |
9566 _element = null; | 9534 _element = null; |
9567 _elementState = CacheState.ERROR; | 9535 _elementState = CacheState.ERROR; |
9568 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); | 9536 clearFlags([_LAUNCHABLE_INDEX, _CLIENT_CODE_INDEX]); |
9569 _clientServerState = CacheState.ERROR; | 9537 _clientServerState = CacheState.ERROR; |
9570 _launchableState = CacheState.ERROR; | 9538 _launchableState = CacheState.ERROR; |
9571 _publicNamespace = null; | 9539 _publicNamespace = null; |
9572 _publicNamespaceState = CacheState.ERROR; | 9540 _publicNamespaceState = CacheState.ERROR; |
9573 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); | 9541 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); |
9574 state.recordResolutionError(); | 9542 state.recordResolutionError(); |
(...skipping 22 matching lines...) Expand all Loading... |
9597 } | 9565 } |
9598 | 9566 |
9599 /** | 9567 /** |
9600 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 9568 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
9601 * entry. This will set the state of all information, including any resolution
-based information, | 9569 * entry. This will set the state of all information, including any resolution
-based information, |
9602 * as being in error. | 9570 * as being in error. |
9603 * | 9571 * |
9604 * @param exception the exception that shows where the error occurred | 9572 * @param exception the exception that shows where the error occurred |
9605 */ | 9573 */ |
9606 @override | 9574 @override |
9607 void recordScanError(AnalysisException exception) { | 9575 void recordScanError(CaughtException exception) { |
9608 super.recordScanError(exception); | 9576 super.recordScanError(exception); |
9609 _scanErrors = AnalysisError.NO_ERRORS; | 9577 _scanErrors = AnalysisError.NO_ERRORS; |
9610 _scanErrorsState = CacheState.ERROR; | 9578 _scanErrorsState = CacheState.ERROR; |
9611 _tokenStream = null; | 9579 _tokenStream = null; |
9612 _tokenStreamState = CacheState.ERROR; | 9580 _tokenStreamState = CacheState.ERROR; |
9613 recordParseError(exception); | 9581 recordParseError(exception); |
9614 } | 9582 } |
9615 | 9583 |
9616 /** | 9584 /** |
9617 * Record that the scan-related information for the associated source is about
to be computed by | 9585 * Record that the scan-related information for the associated source is about
to be computed by |
(...skipping 28 matching lines...) Expand all Loading... |
9646 } | 9614 } |
9647 | 9615 |
9648 /** | 9616 /** |
9649 * Record that an error occurred while attempting to generate errors and warni
ngs for the source | 9617 * Record that an error occurred while attempting to generate errors and warni
ngs for the source |
9650 * represented by this entry. This will set the state of all verification info
rmation as being in | 9618 * represented by this entry. This will set the state of all verification info
rmation as being in |
9651 * error. | 9619 * error. |
9652 * | 9620 * |
9653 * @param librarySource the source of the library in which verification was be
ing performed | 9621 * @param librarySource the source of the library in which verification was be
ing performed |
9654 * @param exception the exception that shows where the error occurred | 9622 * @param exception the exception that shows where the error occurred |
9655 */ | 9623 */ |
9656 void recordVerificationErrorInLibrary(Source librarySource, AnalysisException
exception) { | 9624 void recordVerificationErrorInLibrary(Source librarySource, CaughtException ex
ception) { |
9657 this.exception = exception; | 9625 this.exception = exception; |
9658 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); | 9626 DartEntryImpl_ResolutionState state = _getOrCreateResolutionState(librarySou
rce); |
9659 state.recordVerificationError(); | 9627 state.recordVerificationError(); |
9660 } | 9628 } |
9661 | 9629 |
9662 /** | 9630 /** |
9663 * Remove the given library from the list of libraries that contain this part.
This method should | 9631 * Remove the given library from the list of libraries that contain this part.
This method should |
9664 * only be invoked on entries that represent a part. | 9632 * only be invoked on entries that represent a part. |
9665 * | 9633 * |
9666 * @param librarySource the source of the library to be removed | 9634 * @param librarySource the source of the library to be removed |
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10630 @override | 10598 @override |
10631 String get taskDescription => "get contents of ${source.fullName}"; | 10599 String get taskDescription => "get contents of ${source.fullName}"; |
10632 | 10600 |
10633 @override | 10601 @override |
10634 void internalPerform() { | 10602 void internalPerform() { |
10635 _complete = true; | 10603 _complete = true; |
10636 try { | 10604 try { |
10637 TimestampedData<String> data = context.getContents(source); | 10605 TimestampedData<String> data = context.getContents(source); |
10638 _content = data.data; | 10606 _content = data.data; |
10639 _modificationTime = data.modificationTime; | 10607 _modificationTime = data.modificationTime; |
10640 } on JavaException catch (exception) { | 10608 } on JavaException catch (exception, stackTrace) { |
10641 throw new AnalysisException.con2("Could not get contents of ${source}", ex
ception); | 10609 throw new AnalysisException("Could not get contents of ${source}", new Cau
ghtException(exception, stackTrace)); |
10642 } | 10610 } |
10643 } | 10611 } |
10644 } | 10612 } |
10645 | 10613 |
10646 /** | 10614 /** |
10647 * The interface `HtmlEntry` defines the behavior of objects that maintain the i
nformation | 10615 * The interface `HtmlEntry` defines the behavior of objects that maintain the i
nformation |
10648 * cached by an analysis context about an individual HTML file. | 10616 * cached by an analysis context about an individual HTML file. |
10649 */ | 10617 */ |
10650 abstract class HtmlEntry implements SourceEntry { | 10618 abstract class HtmlEntry implements SourceEntry { |
10651 /** | 10619 /** |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11050 _polymerResolutionErrorsState = CacheState.INVALID; | 11018 _polymerResolutionErrorsState = CacheState.INVALID; |
11051 _element = null; | 11019 _element = null; |
11052 _elementState = CacheState.INVALID; | 11020 _elementState = CacheState.INVALID; |
11053 _resolutionErrors = AnalysisError.NO_ERRORS; | 11021 _resolutionErrors = AnalysisError.NO_ERRORS; |
11054 _resolutionErrorsState = CacheState.INVALID; | 11022 _resolutionErrorsState = CacheState.INVALID; |
11055 _hints = AnalysisError.NO_ERRORS; | 11023 _hints = AnalysisError.NO_ERRORS; |
11056 _hintsState = CacheState.INVALID; | 11024 _hintsState = CacheState.INVALID; |
11057 } | 11025 } |
11058 | 11026 |
11059 @override | 11027 @override |
11060 void recordContentError(AnalysisException exception) { | 11028 void recordContentError(CaughtException exception) { |
11061 super.recordContentError(exception); | 11029 super.recordContentError(exception); |
11062 recordParseError(exception); | 11030 recordParseError(exception); |
11063 } | 11031 } |
11064 | 11032 |
11065 /** | 11033 /** |
11066 * Record that an error was encountered while attempting to parse the source a
ssociated with this | 11034 * Record that an error was encountered while attempting to parse the source a
ssociated with this |
11067 * entry. | 11035 * entry. |
11068 * | 11036 * |
11069 * @param exception the exception that shows where the error occurred | 11037 * @param exception the exception that shows where the error occurred |
11070 */ | 11038 */ |
11071 void recordParseError(AnalysisException exception) { | 11039 void recordParseError(CaughtException exception) { |
11072 // If the scanning and parsing of HTML are separated, the following line can
be removed. | 11040 // If the scanning and parsing of HTML are separated, the following line can
be removed. |
11073 recordScanError(exception); | 11041 recordScanError(exception); |
11074 _parseErrors = AnalysisError.NO_ERRORS; | 11042 _parseErrors = AnalysisError.NO_ERRORS; |
11075 _parseErrorsState = CacheState.ERROR; | 11043 _parseErrorsState = CacheState.ERROR; |
11076 _parsedUnit = null; | 11044 _parsedUnit = null; |
11077 _parsedUnitState = CacheState.ERROR; | 11045 _parsedUnitState = CacheState.ERROR; |
11078 _referencedLibraries = Source.EMPTY_ARRAY; | 11046 _referencedLibraries = Source.EMPTY_ARRAY; |
11079 _referencedLibrariesState = CacheState.ERROR; | 11047 _referencedLibrariesState = CacheState.ERROR; |
11080 recordResolutionError(exception); | 11048 recordResolutionError(exception); |
11081 } | 11049 } |
11082 | 11050 |
11083 /** | 11051 /** |
11084 * Record that an error was encountered while attempting to resolve the source
associated with | 11052 * Record that an error was encountered while attempting to resolve the source
associated with |
11085 * this entry. | 11053 * this entry. |
11086 * | 11054 * |
11087 * @param exception the exception that shows where the error occurred | 11055 * @param exception the exception that shows where the error occurred |
11088 */ | 11056 */ |
11089 void recordResolutionError(AnalysisException exception) { | 11057 void recordResolutionError(CaughtException exception) { |
11090 this.exception = exception; | 11058 this.exception = exception; |
11091 _angularErrors = AnalysisError.NO_ERRORS; | 11059 _angularErrors = AnalysisError.NO_ERRORS; |
11092 _angularErrorsState = CacheState.ERROR; | 11060 _angularErrorsState = CacheState.ERROR; |
11093 _resolvedUnit = null; | 11061 _resolvedUnit = null; |
11094 _resolvedUnitState = CacheState.ERROR; | 11062 _resolvedUnitState = CacheState.ERROR; |
11095 _element = null; | 11063 _element = null; |
11096 _elementState = CacheState.ERROR; | 11064 _elementState = CacheState.ERROR; |
11097 _resolutionErrors = AnalysisError.NO_ERRORS; | 11065 _resolutionErrors = AnalysisError.NO_ERRORS; |
11098 _resolutionErrorsState = CacheState.ERROR; | 11066 _resolutionErrorsState = CacheState.ERROR; |
11099 _hints = AnalysisError.NO_ERRORS; | 11067 _hints = AnalysisError.NO_ERRORS; |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11540 */ | 11508 */ |
11541 static void _checkThread(InstrumentationBuilder instrumentation) { | 11509 static void _checkThread(InstrumentationBuilder instrumentation) { |
11542 } | 11510 } |
11543 | 11511 |
11544 /** | 11512 /** |
11545 * Record an exception that was thrown during analysis. | 11513 * Record an exception that was thrown during analysis. |
11546 * | 11514 * |
11547 * @param instrumentation the instrumentation builder being used to record the
exception | 11515 * @param instrumentation the instrumentation builder being used to record the
exception |
11548 * @param exception the exception being reported | 11516 * @param exception the exception being reported |
11549 */ | 11517 */ |
11550 static void _recordAnalysisException(InstrumentationBuilder instrumentation, A
nalysisException exception) { | 11518 static void _recordAnalysisException(InstrumentationBuilder instrumentation, C
aughtException exception) { |
11551 instrumentation.record(exception); | 11519 instrumentation.record(exception); |
11552 } | 11520 } |
11553 | 11521 |
11554 /** | 11522 /** |
11555 * The unique identifier used to identify this analysis context in the instrum
entation data. | 11523 * The unique identifier used to identify this analysis context in the instrum
entation data. |
11556 */ | 11524 */ |
11557 String _contextId = UUID.randomUUID().toString(); | 11525 String _contextId = UUID.randomUUID().toString(); |
11558 | 11526 |
11559 /** | 11527 /** |
11560 * The analysis context to which all of the non-instrumentation work is delega
ted. | 11528 * The analysis context to which all of the non-instrumentation work is delega
ted. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11635 @override | 11603 @override |
11636 List<Source> computeExportedLibraries(Source source) => _basis.computeExported
Libraries(source); | 11604 List<Source> computeExportedLibraries(Source source) => _basis.computeExported
Libraries(source); |
11637 | 11605 |
11638 @override | 11606 @override |
11639 HtmlElement computeHtmlElement(Source source) { | 11607 HtmlElement computeHtmlElement(Source source) { |
11640 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeHtmlElement"); | 11608 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeHtmlElement"); |
11641 _checkThread(instrumentation); | 11609 _checkThread(instrumentation); |
11642 try { | 11610 try { |
11643 instrumentation.metric3("contextId", _contextId); | 11611 instrumentation.metric3("contextId", _contextId); |
11644 return _basis.computeHtmlElement(source); | 11612 return _basis.computeHtmlElement(source); |
11645 } on AnalysisException catch (e) { | 11613 } on AnalysisException catch (e, stackTrace) { |
11646 _recordAnalysisException(instrumentation, e); | 11614 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); |
11647 throw e; | 11615 throw e; |
11648 } finally { | 11616 } finally { |
11649 instrumentation.log(); | 11617 instrumentation.log(); |
11650 } | 11618 } |
11651 } | 11619 } |
11652 | 11620 |
11653 @override | 11621 @override |
11654 List<Source> computeImportedLibraries(Source source) => _basis.computeImported
Libraries(source); | 11622 List<Source> computeImportedLibraries(Source source) => _basis.computeImported
Libraries(source); |
11655 | 11623 |
11656 @override | 11624 @override |
11657 SourceKind computeKindOf(Source source) { | 11625 SourceKind computeKindOf(Source source) { |
11658 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeKindOf"); | 11626 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeKindOf"); |
11659 _checkThread(instrumentation); | 11627 _checkThread(instrumentation); |
11660 try { | 11628 try { |
11661 instrumentation.metric3("contextId", _contextId); | 11629 instrumentation.metric3("contextId", _contextId); |
11662 return _basis.computeKindOf(source); | 11630 return _basis.computeKindOf(source); |
11663 } finally { | 11631 } finally { |
11664 instrumentation.log(); | 11632 instrumentation.log(); |
11665 } | 11633 } |
11666 } | 11634 } |
11667 | 11635 |
11668 @override | 11636 @override |
11669 LibraryElement computeLibraryElement(Source source) { | 11637 LibraryElement computeLibraryElement(Source source) { |
11670 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeLibraryElement"); | 11638 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeLibraryElement"); |
11671 _checkThread(instrumentation); | 11639 _checkThread(instrumentation); |
11672 try { | 11640 try { |
11673 instrumentation.metric3("contextId", _contextId); | 11641 instrumentation.metric3("contextId", _contextId); |
11674 return _basis.computeLibraryElement(source); | 11642 return _basis.computeLibraryElement(source); |
11675 } on AnalysisException catch (e) { | 11643 } on AnalysisException catch (e, stackTrace) { |
11676 _recordAnalysisException(instrumentation, e); | 11644 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); |
11677 throw e; | 11645 throw e; |
11678 } finally { | 11646 } finally { |
11679 instrumentation.log(); | 11647 instrumentation.log(); |
11680 } | 11648 } |
11681 } | 11649 } |
11682 | 11650 |
11683 @override | 11651 @override |
11684 LineInfo computeLineInfo(Source source) { | 11652 LineInfo computeLineInfo(Source source) { |
11685 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeLineInfo"); | 11653 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
computeLineInfo"); |
11686 _checkThread(instrumentation); | 11654 _checkThread(instrumentation); |
11687 try { | 11655 try { |
11688 instrumentation.metric3("contextId", _contextId); | 11656 instrumentation.metric3("contextId", _contextId); |
11689 return _basis.computeLineInfo(source); | 11657 return _basis.computeLineInfo(source); |
11690 } on AnalysisException catch (e) { | 11658 } on AnalysisException catch (e, stackTrace) { |
11691 _recordAnalysisException(instrumentation, e); | 11659 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); |
11692 throw e; | 11660 throw e; |
11693 } finally { | 11661 } finally { |
11694 instrumentation.log(); | 11662 instrumentation.log(); |
11695 } | 11663 } |
11696 } | 11664 } |
11697 | 11665 |
11698 @override | 11666 @override |
11699 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) => _
basis.computeResolvableCompilationUnit(source); | 11667 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) => _
basis.computeResolvableCompilationUnit(source); |
11700 | 11668 |
11701 @override | 11669 @override |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12114 } | 12082 } |
12115 } | 12083 } |
12116 | 12084 |
12117 @override | 12085 @override |
12118 CompilationUnit parseCompilationUnit(Source source) { | 12086 CompilationUnit parseCompilationUnit(Source source) { |
12119 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
parseCompilationUnit"); | 12087 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
parseCompilationUnit"); |
12120 _checkThread(instrumentation); | 12088 _checkThread(instrumentation); |
12121 try { | 12089 try { |
12122 instrumentation.metric3("contextId", _contextId); | 12090 instrumentation.metric3("contextId", _contextId); |
12123 return _basis.parseCompilationUnit(source); | 12091 return _basis.parseCompilationUnit(source); |
12124 } on AnalysisException catch (e) { | 12092 } on AnalysisException catch (e, stackTrace) { |
12125 _recordAnalysisException(instrumentation, e); | 12093 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); |
12126 throw e; | 12094 throw e; |
12127 } finally { | 12095 } finally { |
12128 instrumentation.log(); | 12096 instrumentation.log(); |
12129 } | 12097 } |
12130 } | 12098 } |
12131 | 12099 |
12132 @override | 12100 @override |
12133 ht.HtmlUnit parseHtmlUnit(Source source) { | 12101 ht.HtmlUnit parseHtmlUnit(Source source) { |
12134 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
parseHtmlUnit"); | 12102 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
parseHtmlUnit"); |
12135 _checkThread(instrumentation); | 12103 _checkThread(instrumentation); |
12136 try { | 12104 try { |
12137 instrumentation.metric3("contextId", _contextId); | 12105 instrumentation.metric3("contextId", _contextId); |
12138 return _basis.parseHtmlUnit(source); | 12106 return _basis.parseHtmlUnit(source); |
12139 } on AnalysisException catch (e) { | 12107 } on AnalysisException catch (e, stackTrace) { |
12140 _recordAnalysisException(instrumentation, e); | 12108 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); |
12141 throw e; | 12109 throw e; |
12142 } finally { | 12110 } finally { |
12143 instrumentation.log(); | 12111 instrumentation.log(); |
12144 } | 12112 } |
12145 } | 12113 } |
12146 | 12114 |
12147 @override | 12115 @override |
12148 AnalysisResult performAnalysisTask() { | 12116 AnalysisResult performAnalysisTask() { |
12149 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
performAnalysisTask"); | 12117 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
performAnalysisTask"); |
12150 _checkThread(instrumentation); | 12118 _checkThread(instrumentation); |
(...skipping 14 matching lines...) Expand all Loading... |
12165 _basis.recordLibraryElements(elementMap); | 12133 _basis.recordLibraryElements(elementMap); |
12166 } | 12134 } |
12167 | 12135 |
12168 @override | 12136 @override |
12169 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { | 12137 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra
ry) { |
12170 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveCompilationUnit"); | 12138 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveCompilationUnit"); |
12171 _checkThread(instrumentation); | 12139 _checkThread(instrumentation); |
12172 try { | 12140 try { |
12173 instrumentation.metric3("contextId", _contextId); | 12141 instrumentation.metric3("contextId", _contextId); |
12174 return _basis.resolveCompilationUnit(unitSource, library); | 12142 return _basis.resolveCompilationUnit(unitSource, library); |
12175 } on AnalysisException catch (e) { | 12143 } on AnalysisException catch (e, stackTrace) { |
12176 _recordAnalysisException(instrumentation, e); | 12144 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); |
12177 throw e; | 12145 throw e; |
12178 } finally { | 12146 } finally { |
12179 instrumentation.log(); | 12147 instrumentation.log(); |
12180 } | 12148 } |
12181 } | 12149 } |
12182 | 12150 |
12183 @override | 12151 @override |
12184 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) { | 12152 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc
e) { |
12185 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveCompilationUnit"); | 12153 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveCompilationUnit"); |
12186 _checkThread(instrumentation); | 12154 _checkThread(instrumentation); |
12187 try { | 12155 try { |
12188 instrumentation.metric3("contextId", _contextId); | 12156 instrumentation.metric3("contextId", _contextId); |
12189 return _basis.resolveCompilationUnit2(unitSource, librarySource); | 12157 return _basis.resolveCompilationUnit2(unitSource, librarySource); |
12190 } on AnalysisException catch (e) { | 12158 } on AnalysisException catch (e, stackTrace) { |
12191 _recordAnalysisException(instrumentation, e); | 12159 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); |
12192 throw e; | 12160 throw e; |
12193 } finally { | 12161 } finally { |
12194 instrumentation.log(); | 12162 instrumentation.log(); |
12195 } | 12163 } |
12196 } | 12164 } |
12197 | 12165 |
12198 @override | 12166 @override |
12199 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) { | 12167 ht.HtmlUnit resolveHtmlUnit(Source htmlSource) { |
12200 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveHtmlUnit"); | 12168 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
resolveHtmlUnit"); |
12201 _checkThread(instrumentation); | 12169 _checkThread(instrumentation); |
12202 try { | 12170 try { |
12203 instrumentation.metric3("contextId", _contextId); | 12171 instrumentation.metric3("contextId", _contextId); |
12204 return _basis.resolveHtmlUnit(htmlSource); | 12172 return _basis.resolveHtmlUnit(htmlSource); |
12205 } on AnalysisException catch (e) { | 12173 } on AnalysisException catch (e, stackTrace) { |
12206 _recordAnalysisException(instrumentation, e); | 12174 _recordAnalysisException(instrumentation, new CaughtException(e, stackTrac
e)); |
12207 throw e; | 12175 throw e; |
12208 } finally { | 12176 } finally { |
12209 instrumentation.log(); | 12177 instrumentation.log(); |
12210 } | 12178 } |
12211 } | 12179 } |
12212 | 12180 |
12213 @override | 12181 @override |
12214 void set analysisOptions(AnalysisOptions options) { | 12182 void set analysisOptions(AnalysisOptions options) { |
12215 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setAnalysisOptions"); | 12183 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
setAnalysisOptions"); |
12216 _checkThread(instrumentation); | 12184 _checkThread(instrumentation); |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12679 /** | 12647 /** |
12680 * The source that was removed while it was being analyzed. | 12648 * The source that was removed while it was being analyzed. |
12681 */ | 12649 */ |
12682 Source _source; | 12650 Source _source; |
12683 | 12651 |
12684 /** | 12652 /** |
12685 * Initialize a newly created exception to represent the removal of the given
source. | 12653 * Initialize a newly created exception to represent the removal of the given
source. |
12686 * | 12654 * |
12687 * @param source the source that was removed while it was being analyzed | 12655 * @param source the source that was removed while it was being analyzed |
12688 */ | 12656 */ |
12689 ObsoleteSourceAnalysisException(Source source) : super.con1("The source '${sou
rce.fullName}' was removed while it was being analyzed") { | 12657 ObsoleteSourceAnalysisException(Source source) : super("The source '${source.f
ullName}' was removed while it was being analyzed") { |
12690 this._source = source; | 12658 this._source = source; |
12691 } | 12659 } |
12692 | 12660 |
12693 /** | 12661 /** |
12694 * Return the source that was removed while it was being analyzed. | 12662 * Return the source that was removed while it was being analyzed. |
12695 * | 12663 * |
12696 * @return the source that was removed | 12664 * @return the source that was removed |
12697 */ | 12665 */ |
12698 Source get source => _source; | 12666 Source get source => _source; |
12699 } | 12667 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12898 if (referencedSource != null) { | 12866 if (referencedSource != null) { |
12899 if (directive is ExportDirective) { | 12867 if (directive is ExportDirective) { |
12900 _exportedSources.add(referencedSource); | 12868 _exportedSources.add(referencedSource); |
12901 } else if (directive is ImportDirective) { | 12869 } else if (directive is ImportDirective) { |
12902 _importedSources.add(referencedSource); | 12870 _importedSources.add(referencedSource); |
12903 } else if (directive is PartDirective) { | 12871 } else if (directive is PartDirective) { |
12904 if (referencedSource != source) { | 12872 if (referencedSource != source) { |
12905 _includedSources.add(referencedSource); | 12873 _includedSources.add(referencedSource); |
12906 } | 12874 } |
12907 } else { | 12875 } else { |
12908 throw new AnalysisException.con1("${runtimeType.toString()} fail
ed to handle a ${directive.runtimeType.toString()}"); | 12876 throw new AnalysisException("${runtimeType.toString()} failed to
handle a ${directive.runtimeType.toString()}"); |
12909 } | 12877 } |
12910 } | 12878 } |
12911 } | 12879 } |
12912 } | 12880 } |
12913 } | 12881 } |
12914 _errors = errorListener.getErrorsForSource(source); | 12882 _errors = errorListener.getErrorsForSource(source); |
12915 } finally { | 12883 } finally { |
12916 timeCounterParse.stop(); | 12884 timeCounterParse.stop(); |
12917 } | 12885 } |
12918 } | 12886 } |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13037 try { | 13005 try { |
13038 ht.AbstractScanner scanner = new ht.StringScanner(source, _content); | 13006 ht.AbstractScanner scanner = new ht.StringScanner(source, _content); |
13039 scanner.passThroughElements = <String> [_TAG_SCRIPT]; | 13007 scanner.passThroughElements = <String> [_TAG_SCRIPT]; |
13040 ht.Token token = scanner.tokenize(); | 13008 ht.Token token = scanner.tokenize(); |
13041 _lineInfo = new LineInfo(scanner.lineStarts); | 13009 _lineInfo = new LineInfo(scanner.lineStarts); |
13042 RecordingErrorListener errorListener = new RecordingErrorListener(); | 13010 RecordingErrorListener errorListener = new RecordingErrorListener(); |
13043 _unit = new ht.HtmlParser(source, errorListener).parse(token, _lineInfo); | 13011 _unit = new ht.HtmlParser(source, errorListener).parse(token, _lineInfo); |
13044 _unit.accept(new RecursiveXmlVisitor_ParseHtmlTask_internalPerform(this, e
rrorListener)); | 13012 _unit.accept(new RecursiveXmlVisitor_ParseHtmlTask_internalPerform(this, e
rrorListener)); |
13045 _errors = errorListener.getErrorsForSource(source); | 13013 _errors = errorListener.getErrorsForSource(source); |
13046 _referencedLibraries = librarySources; | 13014 _referencedLibraries = librarySources; |
13047 } on JavaException catch (exception) { | 13015 } on JavaException catch (exception, stackTrace) { |
13048 throw new AnalysisException.con3(exception); | 13016 throw new AnalysisException("Exception", new CaughtException(exception, st
ackTrace)); |
13049 } | 13017 } |
13050 } | 13018 } |
13051 | 13019 |
13052 /** | 13020 /** |
13053 * Return the sources of libraries that are referenced in the specified HTML f
ile. | 13021 * Return the sources of libraries that are referenced in the specified HTML f
ile. |
13054 * | 13022 * |
13055 * @return the sources of libraries that are referenced in the HTML file | 13023 * @return the sources of libraries that are referenced in the HTML file |
13056 */ | 13024 */ |
13057 List<Source> get librarySources { | 13025 List<Source> get librarySources { |
13058 List<Source> libraries = new List<Source>(); | 13026 List<Source> libraries = new List<Source>(); |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14377 return "resolve unit ${librarySource.fullName}"; | 14345 return "resolve unit ${librarySource.fullName}"; |
14378 } | 14346 } |
14379 | 14347 |
14380 @override | 14348 @override |
14381 void internalPerform() { | 14349 void internalPerform() { |
14382 TypeProvider typeProvider = (_libraryElement.context as InternalAnalysisCont
ext).typeProvider; | 14350 TypeProvider typeProvider = (_libraryElement.context as InternalAnalysisCont
ext).typeProvider; |
14383 ResolvableCompilationUnit resolvableUnit = context.computeResolvableCompilat
ionUnit(source); | 14351 ResolvableCompilationUnit resolvableUnit = context.computeResolvableCompilat
ionUnit(source); |
14384 _modificationTime = resolvableUnit.modificationTime; | 14352 _modificationTime = resolvableUnit.modificationTime; |
14385 CompilationUnit unit = resolvableUnit.compilationUnit; | 14353 CompilationUnit unit = resolvableUnit.compilationUnit; |
14386 if (unit == null) { | 14354 if (unit == null) { |
14387 throw new AnalysisException.con1("Internal error: computeResolvableCompila
tionUnit returned a value without a parsed Dart unit"); | 14355 throw new AnalysisException("Internal error: computeResolvableCompilationU
nit returned a value without a parsed Dart unit"); |
14388 } | 14356 } |
14389 // | 14357 // |
14390 // Resolve names in declarations. | 14358 // Resolve names in declarations. |
14391 // | 14359 // |
14392 new DeclarationResolver().resolve(unit, _find(_libraryElement, source)); | 14360 new DeclarationResolver().resolve(unit, _find(_libraryElement, source)); |
14393 // | 14361 // |
14394 // Resolve the type names. | 14362 // Resolve the type names. |
14395 // | 14363 // |
14396 RecordingErrorListener errorListener = new RecordingErrorListener(); | 14364 RecordingErrorListener errorListener = new RecordingErrorListener(); |
14397 TypeResolverVisitor typeResolverVisitor = new TypeResolverVisitor.con2(_libr
aryElement, source, typeProvider, errorListener); | 14365 TypeResolverVisitor typeResolverVisitor = new TypeResolverVisitor.con2(_libr
aryElement, source, typeProvider, errorListener); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14644 @override | 14612 @override |
14645 void internalPerform() { | 14613 void internalPerform() { |
14646 RecordingErrorListener errorListener = new RecordingErrorListener(); | 14614 RecordingErrorListener errorListener = new RecordingErrorListener(); |
14647 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); | 14615 TimeCounter_TimeCounterHandle timeCounterScan = PerformanceStatistics.scan.s
tart(); |
14648 try { | 14616 try { |
14649 Scanner scanner = new Scanner(source, new CharSequenceReader(_content), er
rorListener); | 14617 Scanner scanner = new Scanner(source, new CharSequenceReader(_content), er
rorListener); |
14650 scanner.preserveComments = context.analysisOptions.preserveComments; | 14618 scanner.preserveComments = context.analysisOptions.preserveComments; |
14651 _tokenStream = scanner.tokenize(); | 14619 _tokenStream = scanner.tokenize(); |
14652 _lineInfo = new LineInfo(scanner.lineStarts); | 14620 _lineInfo = new LineInfo(scanner.lineStarts); |
14653 _errors = errorListener.getErrorsForSource(source); | 14621 _errors = errorListener.getErrorsForSource(source); |
14654 } on JavaException catch (exception) { | 14622 } on JavaException catch (exception, stackTrace) { |
14655 throw new AnalysisException.con3(exception); | 14623 throw new AnalysisException("Exception", new CaughtException(exception, st
ackTrace)); |
14656 } finally { | 14624 } finally { |
14657 timeCounterScan.stop(); | 14625 timeCounterScan.stop(); |
14658 } | 14626 } |
14659 } | 14627 } |
14660 } | 14628 } |
14661 | 14629 |
14662 /** | 14630 /** |
14663 * Instances of the class `SdkAnalysisContext` implement an [AnalysisContext] th
at only | 14631 * Instances of the class `SdkAnalysisContext` implement an [AnalysisContext] th
at only |
14664 * contains sources for a Dart SDK. | 14632 * contains sources for a Dart SDK. |
14665 */ | 14633 */ |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14711 * The data descriptor representing the line information. | 14679 * The data descriptor representing the line information. |
14712 */ | 14680 */ |
14713 static final DataDescriptor<LineInfo> LINE_INFO = new DataDescriptor<LineInfo>
("SourceEntry.LINE_INFO"); | 14681 static final DataDescriptor<LineInfo> LINE_INFO = new DataDescriptor<LineInfo>
("SourceEntry.LINE_INFO"); |
14714 | 14682 |
14715 /** | 14683 /** |
14716 * Return the exception that caused one or more values to have a state of [Cac
heState#ERROR] | 14684 * Return the exception that caused one or more values to have a state of [Cac
heState#ERROR] |
14717 * . | 14685 * . |
14718 * | 14686 * |
14719 * @return the exception that caused one or more values to be uncomputable | 14687 * @return the exception that caused one or more values to be uncomputable |
14720 */ | 14688 */ |
14721 AnalysisException get exception; | 14689 CaughtException get exception; |
14722 | 14690 |
14723 /** | 14691 /** |
14724 * Return `true` if the source was explicitly added to the context or `false`
if the | 14692 * Return `true` if the source was explicitly added to the context or `false`
if the |
14725 * source was implicitly added because it was referenced by another source. | 14693 * source was implicitly added because it was referenced by another source. |
14726 * | 14694 * |
14727 * @return `true` if the source was explicitly added to the context | 14695 * @return `true` if the source was explicitly added to the context |
14728 */ | 14696 */ |
14729 bool get explicitlyAdded; | 14697 bool get explicitlyAdded; |
14730 | 14698 |
14731 /** | 14699 /** |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14781 int _modificationTime = 0; | 14749 int _modificationTime = 0; |
14782 | 14750 |
14783 /** | 14751 /** |
14784 * A bit-encoding of boolean flags associated with this element. | 14752 * A bit-encoding of boolean flags associated with this element. |
14785 */ | 14753 */ |
14786 int _flags = 0; | 14754 int _flags = 0; |
14787 | 14755 |
14788 /** | 14756 /** |
14789 * The exception that caused one or more values to have a state of [CacheState
#ERROR]. | 14757 * The exception that caused one or more values to have a state of [CacheState
#ERROR]. |
14790 */ | 14758 */ |
14791 AnalysisException _exception; | 14759 CaughtException _exception; |
14792 | 14760 |
14793 /** | 14761 /** |
14794 * The state of the cached content. | 14762 * The state of the cached content. |
14795 */ | 14763 */ |
14796 CacheState _contentState = CacheState.INVALID; | 14764 CacheState _contentState = CacheState.INVALID; |
14797 | 14765 |
14798 /** | 14766 /** |
14799 * The content of the source, or `null` if the content is not currently cached
. | 14767 * The content of the source, or `null` if the content is not currently cached
. |
14800 */ | 14768 */ |
14801 String _content; | 14769 String _content; |
(...skipping 18 matching lines...) Expand all Loading... |
14820 /** | 14788 /** |
14821 * Fix the state of the [exception] to match the current state of the entry. | 14789 * Fix the state of the [exception] to match the current state of the entry. |
14822 */ | 14790 */ |
14823 void fixExceptionState() { | 14791 void fixExceptionState() { |
14824 if (hasErrorState) { | 14792 if (hasErrorState) { |
14825 if (_exception == null) { | 14793 if (_exception == null) { |
14826 // | 14794 // |
14827 // This code should never be reached, but is a fail-safe in case an exce
ption is not | 14795 // This code should never be reached, but is a fail-safe in case an exce
ption is not |
14828 // recorded when it should be. | 14796 // recorded when it should be. |
14829 // | 14797 // |
14830 _exception = new AnalysisException.con1("State set to ERROR without sett
ing an exception"); | 14798 _exception = new CaughtException(new AnalysisException("State set to ERR
OR without setting an exception"), null); |
14831 } | 14799 } |
14832 } else { | 14800 } else { |
14833 _exception = null; | 14801 _exception = null; |
14834 } | 14802 } |
14835 } | 14803 } |
14836 | 14804 |
14837 /** | 14805 /** |
14838 * Return the exception that caused one or more values to have a state of [Cac
heState#ERROR] | 14806 * Return the exception that caused one or more values to have a state of [Cac
heState#ERROR] |
14839 * . | 14807 * . |
14840 * | 14808 * |
14841 * @return the exception that caused one or more values to be uncomputable | 14809 * @return the exception that caused one or more values to be uncomputable |
14842 */ | 14810 */ |
14843 @override | 14811 @override |
14844 AnalysisException get exception => _exception; | 14812 CaughtException get exception => _exception; |
14845 | 14813 |
14846 /** | 14814 /** |
14847 * Return `true` if the source was explicitly added to the context or `false`
if the | 14815 * Return `true` if the source was explicitly added to the context or `false`
if the |
14848 * source was implicitly added because it was referenced by another source. | 14816 * source was implicitly added because it was referenced by another source. |
14849 * | 14817 * |
14850 * @return `true` if the source was explicitly added to the context | 14818 * @return `true` if the source was explicitly added to the context |
14851 */ | 14819 */ |
14852 @override | 14820 @override |
14853 bool get explicitlyAdded => getFlag(_EXPLICITLY_ADDED_FLAG); | 14821 bool get explicitlyAdded => getFlag(_EXPLICITLY_ADDED_FLAG); |
14854 | 14822 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14887 _lineInfoState = CacheState.INVALID; | 14855 _lineInfoState = CacheState.INVALID; |
14888 } | 14856 } |
14889 | 14857 |
14890 /** | 14858 /** |
14891 * Record that an error occurred while attempting to get the contents of the s
ource represented by | 14859 * Record that an error occurred while attempting to get the contents of the s
ource represented by |
14892 * this entry. This will set the state of all information, including any resol
ution-based | 14860 * this entry. This will set the state of all information, including any resol
ution-based |
14893 * information, as being in error. | 14861 * information, as being in error. |
14894 * | 14862 * |
14895 * @param exception the exception that shows where the error occurred | 14863 * @param exception the exception that shows where the error occurred |
14896 */ | 14864 */ |
14897 void recordContentError(AnalysisException exception) { | 14865 void recordContentError(CaughtException exception) { |
14898 _content = null; | 14866 _content = null; |
14899 _contentState = CacheState.ERROR; | 14867 _contentState = CacheState.ERROR; |
14900 recordScanError(exception); | 14868 recordScanError(exception); |
14901 } | 14869 } |
14902 | 14870 |
14903 /** | 14871 /** |
14904 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 14872 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
14905 * entry. This will set the state of all information, including any resolution
-based information, | 14873 * entry. This will set the state of all information, including any resolution
-based information, |
14906 * as being in error. | 14874 * as being in error. |
14907 * | 14875 * |
14908 * @param exception the exception that shows where the error occurred | 14876 * @param exception the exception that shows where the error occurred |
14909 */ | 14877 */ |
14910 void recordScanError(AnalysisException exception) { | 14878 void recordScanError(CaughtException exception) { |
14911 this.exception = exception; | 14879 this.exception = exception; |
14912 _lineInfo = null; | 14880 _lineInfo = null; |
14913 _lineInfoState = CacheState.ERROR; | 14881 _lineInfoState = CacheState.ERROR; |
14914 } | 14882 } |
14915 | 14883 |
14916 /** | 14884 /** |
14917 * Set whether the source was explicitly added to the context to match the giv
en value. | 14885 * Set whether the source was explicitly added to the context to match the giv
en value. |
14918 * | 14886 * |
14919 * @param explicitlyAdded `true` if the source was explicitly added to the con
text | 14887 * @param explicitlyAdded `true` if the source was explicitly added to the con
text |
14920 */ | 14888 */ |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15015 * @return `true` if the state of any data value is [CacheState#ERROR] | 14983 * @return `true` if the state of any data value is [CacheState#ERROR] |
15016 */ | 14984 */ |
15017 bool get hasErrorState => _contentState == CacheState.ERROR || _lineInfoState
== CacheState.ERROR; | 14985 bool get hasErrorState => _contentState == CacheState.ERROR || _lineInfoState
== CacheState.ERROR; |
15018 | 14986 |
15019 /** | 14987 /** |
15020 * Set the exception that caused one or more values to have a state of [CacheS
tate#ERROR] to | 14988 * Set the exception that caused one or more values to have a state of [CacheS
tate#ERROR] to |
15021 * the given exception. | 14989 * the given exception. |
15022 * | 14990 * |
15023 * @param exception the exception that caused one or more values to be uncompu
table | 14991 * @param exception the exception that caused one or more values to be uncompu
table |
15024 */ | 14992 */ |
15025 void set exception(AnalysisException exception) { | 14993 void set exception(CaughtException exception) { |
15026 if (exception == null) { | 14994 if (exception == null) { |
15027 throw new IllegalArgumentException("exception cannot be null"); | 14995 throw new IllegalArgumentException("exception cannot be null"); |
15028 } | 14996 } |
15029 this._exception = exception; | 14997 this._exception = exception; |
15030 } | 14998 } |
15031 | 14999 |
15032 /** | 15000 /** |
15033 * Set the value of the flag with the given index to the given value. | 15001 * Set the value of the flag with the given index to the given value. |
15034 * | 15002 * |
15035 * @param index the index of the flag whose value is to be returned | 15003 * @param index the index of the flag whose value is to be returned |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15383 _index++; | 15351 _index++; |
15384 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { | 15352 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { |
15385 _index = 0; | 15353 _index = 0; |
15386 _queueIndex++; | 15354 _queueIndex++; |
15387 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { | 15355 while (_queueIndex < WorkManager_this._workQueues.length && WorkManager_th
is._workQueues[_queueIndex].isEmpty) { |
15388 _queueIndex++; | 15356 _queueIndex++; |
15389 } | 15357 } |
15390 } | 15358 } |
15391 } | 15359 } |
15392 } | 15360 } |
OLD | NEW |