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 "dart:math" as math; | 10 import "dart:math" as math; |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 | 912 |
913 /** | 913 /** |
914 * A table mapping the sources known to the context to the information known | 914 * A table mapping the sources known to the context to the information known |
915 * about the source. | 915 * about the source. |
916 */ | 916 */ |
917 AnalysisCache _cache; | 917 AnalysisCache _cache; |
918 | 918 |
919 /** | 919 /** |
920 * A list containing sources for which data should not be flushed. | 920 * A list containing sources for which data should not be flushed. |
921 */ | 921 */ |
922 List<Source> _priorityOrder = Source.EMPTY_ARRAY; | 922 List<Source> _priorityOrder = Source.EMPTY_LIST; |
923 | 923 |
924 /** | 924 /** |
925 * A map from all sources for which there are futures pending to a list of | 925 * A map from all sources for which there are futures pending to a list of |
926 * the corresponding PendingFuture objects. These sources will be analyzed | 926 * the corresponding PendingFuture objects. These sources will be analyzed |
927 * in the same way as priority sources, except with higher priority. | 927 * in the same way as priority sources, except with higher priority. |
928 * | 928 * |
929 * TODO(paulberry): since the size of this map is not constrained (as it is | 929 * TODO(paulberry): since the size of this map is not constrained (as it is |
930 * for _priorityOrder), we run the risk of creating an analysis loop if | 930 * for _priorityOrder), we run the risk of creating an analysis loop if |
931 * re-caching one AST structure causes the AST structure for another source | 931 * re-caching one AST structure causes the AST structure for another source |
932 * with pending futures to be flushed. However, this is unlikely to happen | 932 * with pending futures to be flushed. However, this is unlikely to happen |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 _generateImplicitErrors = options.generateImplicitErrors; | 1083 _generateImplicitErrors = options.generateImplicitErrors; |
1084 _generateSdkErrors = options.generateSdkErrors; | 1084 _generateSdkErrors = options.generateSdkErrors; |
1085 if (needsRecompute) { | 1085 if (needsRecompute) { |
1086 _invalidateAllLocalResolutionInformation(false); | 1086 _invalidateAllLocalResolutionInformation(false); |
1087 } | 1087 } |
1088 } | 1088 } |
1089 | 1089 |
1090 @override | 1090 @override |
1091 void set analysisPriorityOrder(List<Source> sources) { | 1091 void set analysisPriorityOrder(List<Source> sources) { |
1092 if (sources == null || sources.isEmpty) { | 1092 if (sources == null || sources.isEmpty) { |
1093 _priorityOrder = Source.EMPTY_ARRAY; | 1093 _priorityOrder = Source.EMPTY_LIST; |
1094 } else { | 1094 } else { |
1095 while (sources.remove(null)) { | 1095 while (sources.remove(null)) { |
1096 // Nothing else to do. | 1096 // Nothing else to do. |
1097 } | 1097 } |
1098 if (sources.isEmpty) { | 1098 if (sources.isEmpty) { |
1099 _priorityOrder = Source.EMPTY_ARRAY; | 1099 _priorityOrder = Source.EMPTY_LIST; |
1100 } | 1100 } |
1101 // | 1101 // |
1102 // Cap the size of the priority list to being less than the cache size. | 1102 // Cap the size of the priority list to being less than the cache size. |
1103 // Failure to do so can result in an infinite loop in | 1103 // Failure to do so can result in an infinite loop in |
1104 // performAnalysisTask() because re-caching one AST structure | 1104 // performAnalysisTask() because re-caching one AST structure |
1105 // can cause another priority source's AST structure to be flushed. | 1105 // can cause another priority source's AST structure to be flushed. |
1106 // | 1106 // |
1107 int count = math.min( | 1107 int count = math.min( |
1108 sources.length, _options.cacheSize - _PRIORITY_ORDER_SIZE_DELTA); | 1108 sources.length, _options.cacheSize - _PRIORITY_ORDER_SIZE_DELTA); |
1109 _priorityOrder = new List<Source>(count); | 1109 _priorityOrder = new List<Source>(count); |
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1632 AnalysisEngine.instance.logger.logInformation( | 1632 AnalysisEngine.instance.logger.logInformation( |
1633 "Could not compute errors", | 1633 "Could not compute errors", |
1634 new CaughtException(exception, stackTrace)); | 1634 new CaughtException(exception, stackTrace)); |
1635 } | 1635 } |
1636 } | 1636 } |
1637 return AnalysisError.NO_ERRORS; | 1637 return AnalysisError.NO_ERRORS; |
1638 } | 1638 } |
1639 | 1639 |
1640 @override | 1640 @override |
1641 List<Source> computeExportedLibraries(Source source) => _getDartParseData2( | 1641 List<Source> computeExportedLibraries(Source source) => _getDartParseData2( |
1642 source, DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY); | 1642 source, DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_LIST); |
1643 | 1643 |
1644 @override | 1644 @override |
1645 HtmlElement computeHtmlElement(Source source) => | 1645 HtmlElement computeHtmlElement(Source source) => |
1646 _getHtmlResolutionData(source, HtmlEntry.ELEMENT, null); | 1646 _getHtmlResolutionData(source, HtmlEntry.ELEMENT, null); |
1647 | 1647 |
1648 @override | 1648 @override |
1649 List<Source> computeImportedLibraries(Source source) => _getDartParseData2( | 1649 List<Source> computeImportedLibraries(Source source) => _getDartParseData2( |
1650 source, DartEntry.IMPORTED_LIBRARIES, Source.EMPTY_ARRAY); | 1650 source, DartEntry.IMPORTED_LIBRARIES, Source.EMPTY_LIST); |
1651 | 1651 |
1652 @override | 1652 @override |
1653 SourceKind computeKindOf(Source source) { | 1653 SourceKind computeKindOf(Source source) { |
1654 SourceEntry sourceEntry = _getReadableSourceEntry(source); | 1654 SourceEntry sourceEntry = _getReadableSourceEntry(source); |
1655 if (sourceEntry == null) { | 1655 if (sourceEntry == null) { |
1656 return SourceKind.UNKNOWN; | 1656 return SourceKind.UNKNOWN; |
1657 } else if (sourceEntry is DartEntry) { | 1657 } else if (sourceEntry is DartEntry) { |
1658 try { | 1658 try { |
1659 return _getDartParseData(source, sourceEntry, DartEntry.SOURCE_KIND); | 1659 return _getDartParseData(source, sourceEntry, DartEntry.SOURCE_KIND); |
1660 } on AnalysisException { | 1660 } on AnalysisException { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1912 if (sourceEntry is HtmlEntry) { | 1912 if (sourceEntry is HtmlEntry) { |
1913 return sourceEntry.getValue(HtmlEntry.ELEMENT); | 1913 return sourceEntry.getValue(HtmlEntry.ELEMENT); |
1914 } | 1914 } |
1915 return null; | 1915 return null; |
1916 } | 1916 } |
1917 | 1917 |
1918 @override | 1918 @override |
1919 List<Source> getHtmlFilesReferencing(Source source) { | 1919 List<Source> getHtmlFilesReferencing(Source source) { |
1920 SourceKind sourceKind = getKindOf(source); | 1920 SourceKind sourceKind = getKindOf(source); |
1921 if (sourceKind == null) { | 1921 if (sourceKind == null) { |
1922 return Source.EMPTY_ARRAY; | 1922 return Source.EMPTY_LIST; |
1923 } | 1923 } |
1924 List<Source> htmlSources = new List<Source>(); | 1924 List<Source> htmlSources = new List<Source>(); |
1925 while (true) { | 1925 while (true) { |
1926 if (sourceKind == SourceKind.PART) { | 1926 if (sourceKind == SourceKind.PART) { |
1927 List<Source> librarySources = getLibrariesContaining(source); | 1927 List<Source> librarySources = getLibrariesContaining(source); |
1928 MapIterator<Source, SourceEntry> partIterator = _cache.iterator(); | 1928 MapIterator<Source, SourceEntry> partIterator = _cache.iterator(); |
1929 while (partIterator.moveNext()) { | 1929 while (partIterator.moveNext()) { |
1930 SourceEntry sourceEntry = partIterator.value; | 1930 SourceEntry sourceEntry = partIterator.value; |
1931 if (sourceEntry.kind == SourceKind.HTML) { | 1931 if (sourceEntry.kind == SourceKind.HTML) { |
1932 List<Source> referencedLibraries = (sourceEntry as HtmlEntry) | 1932 List<Source> referencedLibraries = (sourceEntry as HtmlEntry) |
(...skipping 12 matching lines...) Expand all Loading... |
1945 .getValue(HtmlEntry.REFERENCED_LIBRARIES); | 1945 .getValue(HtmlEntry.REFERENCED_LIBRARIES); |
1946 if (_contains(referencedLibraries, source)) { | 1946 if (_contains(referencedLibraries, source)) { |
1947 htmlSources.add(iterator.key); | 1947 htmlSources.add(iterator.key); |
1948 } | 1948 } |
1949 } | 1949 } |
1950 } | 1950 } |
1951 } | 1951 } |
1952 break; | 1952 break; |
1953 } | 1953 } |
1954 if (htmlSources.isEmpty) { | 1954 if (htmlSources.isEmpty) { |
1955 return Source.EMPTY_ARRAY; | 1955 return Source.EMPTY_LIST; |
1956 } | 1956 } |
1957 return htmlSources; | 1957 return htmlSources; |
1958 } | 1958 } |
1959 | 1959 |
1960 @override | 1960 @override |
1961 SourceKind getKindOf(Source source) { | 1961 SourceKind getKindOf(Source source) { |
1962 SourceEntry sourceEntry = getReadableSourceEntryOrNull(source); | 1962 SourceEntry sourceEntry = getReadableSourceEntryOrNull(source); |
1963 if (sourceEntry == null) { | 1963 if (sourceEntry == null) { |
1964 return SourceKind.UNKNOWN; | 1964 return SourceKind.UNKNOWN; |
1965 } | 1965 } |
1966 return sourceEntry.kind; | 1966 return sourceEntry.kind; |
1967 } | 1967 } |
1968 | 1968 |
1969 @override | 1969 @override |
1970 List<Source> getLibrariesContaining(Source source) { | 1970 List<Source> getLibrariesContaining(Source source) { |
1971 SourceEntry sourceEntry = getReadableSourceEntryOrNull(source); | 1971 SourceEntry sourceEntry = getReadableSourceEntryOrNull(source); |
1972 if (sourceEntry is DartEntry) { | 1972 if (sourceEntry is DartEntry) { |
1973 return sourceEntry.containingLibraries; | 1973 return sourceEntry.containingLibraries; |
1974 } | 1974 } |
1975 return Source.EMPTY_ARRAY; | 1975 return Source.EMPTY_LIST; |
1976 } | 1976 } |
1977 | 1977 |
1978 @override | 1978 @override |
1979 List<Source> getLibrariesDependingOn(Source librarySource) { | 1979 List<Source> getLibrariesDependingOn(Source librarySource) { |
1980 List<Source> dependentLibraries = new List<Source>(); | 1980 List<Source> dependentLibraries = new List<Source>(); |
1981 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); | 1981 MapIterator<Source, SourceEntry> iterator = _cache.iterator(); |
1982 while (iterator.moveNext()) { | 1982 while (iterator.moveNext()) { |
1983 SourceEntry sourceEntry = iterator.value; | 1983 SourceEntry sourceEntry = iterator.value; |
1984 if (sourceEntry.kind == SourceKind.LIBRARY) { | 1984 if (sourceEntry.kind == SourceKind.LIBRARY) { |
1985 if (_contains( | 1985 if (_contains( |
1986 (sourceEntry as DartEntry).getValue(DartEntry.EXPORTED_LIBRARIES), | 1986 (sourceEntry as DartEntry).getValue(DartEntry.EXPORTED_LIBRARIES), |
1987 librarySource)) { | 1987 librarySource)) { |
1988 dependentLibraries.add(iterator.key); | 1988 dependentLibraries.add(iterator.key); |
1989 } | 1989 } |
1990 if (_contains( | 1990 if (_contains( |
1991 (sourceEntry as DartEntry).getValue(DartEntry.IMPORTED_LIBRARIES), | 1991 (sourceEntry as DartEntry).getValue(DartEntry.IMPORTED_LIBRARIES), |
1992 librarySource)) { | 1992 librarySource)) { |
1993 dependentLibraries.add(iterator.key); | 1993 dependentLibraries.add(iterator.key); |
1994 } | 1994 } |
1995 } | 1995 } |
1996 } | 1996 } |
1997 if (dependentLibraries.isEmpty) { | 1997 if (dependentLibraries.isEmpty) { |
1998 return Source.EMPTY_ARRAY; | 1998 return Source.EMPTY_LIST; |
1999 } | 1999 } |
2000 return dependentLibraries; | 2000 return dependentLibraries; |
2001 } | 2001 } |
2002 | 2002 |
2003 @override | 2003 @override |
2004 List<Source> getLibrariesReferencedFromHtml(Source htmlSource) { | 2004 List<Source> getLibrariesReferencedFromHtml(Source htmlSource) { |
2005 SourceEntry sourceEntry = getReadableSourceEntryOrNull(htmlSource); | 2005 SourceEntry sourceEntry = getReadableSourceEntryOrNull(htmlSource); |
2006 if (sourceEntry is HtmlEntry) { | 2006 if (sourceEntry is HtmlEntry) { |
2007 HtmlEntry htmlEntry = sourceEntry; | 2007 HtmlEntry htmlEntry = sourceEntry; |
2008 return htmlEntry.getValue(HtmlEntry.REFERENCED_LIBRARIES); | 2008 return htmlEntry.getValue(HtmlEntry.REFERENCED_LIBRARIES); |
2009 } | 2009 } |
2010 return Source.EMPTY_ARRAY; | 2010 return Source.EMPTY_LIST; |
2011 } | 2011 } |
2012 | 2012 |
2013 @override | 2013 @override |
2014 LibraryElement getLibraryElement(Source source) { | 2014 LibraryElement getLibraryElement(Source source) { |
2015 SourceEntry sourceEntry = getReadableSourceEntryOrNull(source); | 2015 SourceEntry sourceEntry = getReadableSourceEntryOrNull(source); |
2016 if (sourceEntry is DartEntry) { | 2016 if (sourceEntry is DartEntry) { |
2017 return sourceEntry.getValue(DartEntry.ELEMENT); | 2017 return sourceEntry.getValue(DartEntry.ELEMENT); |
2018 } | 2018 } |
2019 return null; | 2019 return null; |
2020 } | 2020 } |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2294 elementMap.forEach((Source librarySource, LibraryElement library) { | 2294 elementMap.forEach((Source librarySource, LibraryElement library) { |
2295 // | 2295 // |
2296 // Cache the element in the library's info. | 2296 // Cache the element in the library's info. |
2297 // | 2297 // |
2298 DartEntry dartEntry = _getReadableDartEntry(librarySource); | 2298 DartEntry dartEntry = _getReadableDartEntry(librarySource); |
2299 if (dartEntry != null) { | 2299 if (dartEntry != null) { |
2300 _recordElementData(dartEntry, library, library.source, htmlSource); | 2300 _recordElementData(dartEntry, library, library.source, htmlSource); |
2301 dartEntry.setState(SourceEntry.CONTENT, CacheState.FLUSHED); | 2301 dartEntry.setState(SourceEntry.CONTENT, CacheState.FLUSHED); |
2302 dartEntry.setValue(SourceEntry.LINE_INFO, new LineInfo(<int>[0])); | 2302 dartEntry.setValue(SourceEntry.LINE_INFO, new LineInfo(<int>[0])); |
2303 // DartEntry.ELEMENT - set in recordElementData | 2303 // DartEntry.ELEMENT - set in recordElementData |
2304 dartEntry.setValue(DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY); | 2304 dartEntry.setValue(DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_LIST); |
2305 dartEntry.setValue(DartEntry.IMPORTED_LIBRARIES, Source.EMPTY_ARRAY); | 2305 dartEntry.setValue(DartEntry.IMPORTED_LIBRARIES, Source.EMPTY_LIST); |
2306 dartEntry.setValue(DartEntry.INCLUDED_PARTS, Source.EMPTY_ARRAY); | 2306 dartEntry.setValue(DartEntry.INCLUDED_PARTS, Source.EMPTY_LIST); |
2307 // DartEntry.IS_CLIENT - set in recordElementData | 2307 // DartEntry.IS_CLIENT - set in recordElementData |
2308 // DartEntry.IS_LAUNCHABLE - set in recordElementData | 2308 // DartEntry.IS_LAUNCHABLE - set in recordElementData |
2309 dartEntry.setValue(DartEntry.PARSE_ERRORS, AnalysisError.NO_ERRORS); | 2309 dartEntry.setValue(DartEntry.PARSE_ERRORS, AnalysisError.NO_ERRORS); |
2310 dartEntry.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); | 2310 dartEntry.setState(DartEntry.PARSED_UNIT, CacheState.FLUSHED); |
2311 dartEntry.setState(DartEntry.PUBLIC_NAMESPACE, CacheState.FLUSHED); | 2311 dartEntry.setState(DartEntry.PUBLIC_NAMESPACE, CacheState.FLUSHED); |
2312 dartEntry.setValue(DartEntry.SCAN_ERRORS, AnalysisError.NO_ERRORS); | 2312 dartEntry.setValue(DartEntry.SCAN_ERRORS, AnalysisError.NO_ERRORS); |
2313 dartEntry.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); | 2313 dartEntry.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); |
2314 dartEntry.setState(DartEntry.TOKEN_STREAM, CacheState.FLUSHED); | 2314 dartEntry.setState(DartEntry.TOKEN_STREAM, CacheState.FLUSHED); |
2315 dartEntry.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySource, | 2315 dartEntry.setValueInLibrary(DartEntry.RESOLUTION_ERRORS, librarySource, |
2316 AnalysisError.NO_ERRORS); | 2316 AnalysisError.NO_ERRORS); |
(...skipping 3023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5340 } | 5340 } |
5341 return sources; | 5341 return sources; |
5342 } | 5342 } |
5343 | 5343 |
5344 /** | 5344 /** |
5345 * Return the sources described by the given [descriptor]. | 5345 * Return the sources described by the given [descriptor]. |
5346 */ | 5346 */ |
5347 List<Source> _getSources(Source source, DartEntry dartEntry, | 5347 List<Source> _getSources(Source source, DartEntry dartEntry, |
5348 DataDescriptor<List<Source>> descriptor) { | 5348 DataDescriptor<List<Source>> descriptor) { |
5349 if (dartEntry == null) { | 5349 if (dartEntry == null) { |
5350 return Source.EMPTY_ARRAY; | 5350 return Source.EMPTY_LIST; |
5351 } | 5351 } |
5352 CacheState exportState = dartEntry.getState(descriptor); | 5352 CacheState exportState = dartEntry.getState(descriptor); |
5353 if (exportState == CacheState.ERROR) { | 5353 if (exportState == CacheState.ERROR) { |
5354 return Source.EMPTY_ARRAY; | 5354 return Source.EMPTY_LIST; |
5355 } else if (exportState != CacheState.VALID) { | 5355 } else if (exportState != CacheState.VALID) { |
5356 if (_taskData == null) { | 5356 if (_taskData == null) { |
5357 _taskData = | 5357 _taskData = |
5358 AnalysisContextImpl_this._createParseDartTask(source, dartEntry); | 5358 AnalysisContextImpl_this._createParseDartTask(source, dartEntry); |
5359 } | 5359 } |
5360 return Source.EMPTY_ARRAY; | 5360 return Source.EMPTY_LIST; |
5361 } | 5361 } |
5362 return dartEntry.getValue(descriptor); | 5362 return dartEntry.getValue(descriptor); |
5363 } | 5363 } |
5364 } | 5364 } |
5365 | 5365 |
5366 /** | 5366 /** |
5367 * Information about the next task to be performed. Each data has an implicit | 5367 * Information about the next task to be performed. Each data has an implicit |
5368 * associated source: the source that might need to be analyzed. There are | 5368 * associated source: the source that might need to be analyzed. There are |
5369 * essentially three states that can be represented: | 5369 * essentially three states that can be represented: |
5370 * | 5370 * |
(...skipping 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7245 */ | 7245 */ |
7246 static final DataDescriptor<CompilationUnit> BUILT_UNIT = | 7246 static final DataDescriptor<CompilationUnit> BUILT_UNIT = |
7247 new DataDescriptor<CompilationUnit>("DartEntry.BUILT_UNIT"); | 7247 new DataDescriptor<CompilationUnit>("DartEntry.BUILT_UNIT"); |
7248 | 7248 |
7249 /** | 7249 /** |
7250 * The data descriptor representing the list of libraries that contain this | 7250 * The data descriptor representing the list of libraries that contain this |
7251 * compilation unit. | 7251 * compilation unit. |
7252 */ | 7252 */ |
7253 static final DataDescriptor<List<Source>> CONTAINING_LIBRARIES = | 7253 static final DataDescriptor<List<Source>> CONTAINING_LIBRARIES = |
7254 new DataDescriptor<List<Source>>( | 7254 new DataDescriptor<List<Source>>( |
7255 "DartEntry.CONTAINING_LIBRARIES", Source.EMPTY_ARRAY); | 7255 "DartEntry.CONTAINING_LIBRARIES", Source.EMPTY_LIST); |
7256 | 7256 |
7257 /** | 7257 /** |
7258 * The data descriptor representing the library element for the library. This | 7258 * The data descriptor representing the library element for the library. This |
7259 * data is only available for Dart files that are the defining compilation | 7259 * data is only available for Dart files that are the defining compilation |
7260 * unit of a library. | 7260 * unit of a library. |
7261 */ | 7261 */ |
7262 static final DataDescriptor<LibraryElement> ELEMENT = | 7262 static final DataDescriptor<LibraryElement> ELEMENT = |
7263 new DataDescriptor<LibraryElement>("DartEntry.ELEMENT"); | 7263 new DataDescriptor<LibraryElement>("DartEntry.ELEMENT"); |
7264 | 7264 |
7265 /** | 7265 /** |
7266 * The data descriptor representing the list of exported libraries. This data | 7266 * The data descriptor representing the list of exported libraries. This data |
7267 * is only available for Dart files that are the defining compilation unit of | 7267 * is only available for Dart files that are the defining compilation unit of |
7268 * a library. | 7268 * a library. |
7269 */ | 7269 */ |
7270 static final DataDescriptor<List<Source>> EXPORTED_LIBRARIES = | 7270 static final DataDescriptor<List<Source>> EXPORTED_LIBRARIES = |
7271 new DataDescriptor<List<Source>>( | 7271 new DataDescriptor<List<Source>>( |
7272 "DartEntry.EXPORTED_LIBRARIES", Source.EMPTY_ARRAY); | 7272 "DartEntry.EXPORTED_LIBRARIES", Source.EMPTY_LIST); |
7273 | 7273 |
7274 /** | 7274 /** |
7275 * The data descriptor representing the hints resulting from auditing the | 7275 * The data descriptor representing the hints resulting from auditing the |
7276 * source. | 7276 * source. |
7277 */ | 7277 */ |
7278 static final DataDescriptor<List<AnalysisError>> HINTS = | 7278 static final DataDescriptor<List<AnalysisError>> HINTS = |
7279 new DataDescriptor<List<AnalysisError>>( | 7279 new DataDescriptor<List<AnalysisError>>( |
7280 "DartEntry.HINTS", AnalysisError.NO_ERRORS); | 7280 "DartEntry.HINTS", AnalysisError.NO_ERRORS); |
7281 | 7281 |
7282 /** | 7282 /** |
7283 * The data descriptor representing the list of imported libraries. This data | 7283 * The data descriptor representing the list of imported libraries. This data |
7284 * is only available for Dart files that are the defining compilation unit of | 7284 * is only available for Dart files that are the defining compilation unit of |
7285 * a library. | 7285 * a library. |
7286 */ | 7286 */ |
7287 static final DataDescriptor<List<Source>> IMPORTED_LIBRARIES = | 7287 static final DataDescriptor<List<Source>> IMPORTED_LIBRARIES = |
7288 new DataDescriptor<List<Source>>( | 7288 new DataDescriptor<List<Source>>( |
7289 "DartEntry.IMPORTED_LIBRARIES", Source.EMPTY_ARRAY); | 7289 "DartEntry.IMPORTED_LIBRARIES", Source.EMPTY_LIST); |
7290 | 7290 |
7291 /** | 7291 /** |
7292 * The data descriptor representing the list of included parts. This data is | 7292 * The data descriptor representing the list of included parts. This data is |
7293 * only available for Dart files that are the defining compilation unit of a | 7293 * only available for Dart files that are the defining compilation unit of a |
7294 * library. | 7294 * library. |
7295 */ | 7295 */ |
7296 static final DataDescriptor<List<Source>> INCLUDED_PARTS = | 7296 static final DataDescriptor<List<Source>> INCLUDED_PARTS = |
7297 new DataDescriptor<List<Source>>( | 7297 new DataDescriptor<List<Source>>( |
7298 "DartEntry.INCLUDED_PARTS", Source.EMPTY_ARRAY); | 7298 "DartEntry.INCLUDED_PARTS", Source.EMPTY_LIST); |
7299 | 7299 |
7300 /** | 7300 /** |
7301 * The data descriptor representing the client flag. This data is only | 7301 * The data descriptor representing the client flag. This data is only |
7302 * available for Dart files that are the defining compilation unit of a | 7302 * available for Dart files that are the defining compilation unit of a |
7303 * library. | 7303 * library. |
7304 */ | 7304 */ |
7305 static final DataDescriptor<bool> IS_CLIENT = | 7305 static final DataDescriptor<bool> IS_CLIENT = |
7306 new DataDescriptor<bool>("DartEntry.IS_CLIENT", false); | 7306 new DataDescriptor<bool>("DartEntry.IS_CLIENT", false); |
7307 | 7307 |
7308 /** | 7308 /** |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8540 * The data descriptor representing the resolved AST structure. | 8540 * The data descriptor representing the resolved AST structure. |
8541 */ | 8541 */ |
8542 static final DataDescriptor<ht.HtmlUnit> RESOLVED_UNIT = | 8542 static final DataDescriptor<ht.HtmlUnit> RESOLVED_UNIT = |
8543 new DataDescriptor<ht.HtmlUnit>("HtmlEntry.RESOLVED_UNIT"); | 8543 new DataDescriptor<ht.HtmlUnit>("HtmlEntry.RESOLVED_UNIT"); |
8544 | 8544 |
8545 /** | 8545 /** |
8546 * The data descriptor representing the list of referenced libraries. | 8546 * The data descriptor representing the list of referenced libraries. |
8547 */ | 8547 */ |
8548 static final DataDescriptor<List<Source>> REFERENCED_LIBRARIES = | 8548 static final DataDescriptor<List<Source>> REFERENCED_LIBRARIES = |
8549 new DataDescriptor<List<Source>>( | 8549 new DataDescriptor<List<Source>>( |
8550 "HtmlEntry.REFERENCED_LIBRARIES", Source.EMPTY_ARRAY); | 8550 "HtmlEntry.REFERENCED_LIBRARIES", Source.EMPTY_LIST); |
8551 | 8551 |
8552 /** | 8552 /** |
8553 * The data descriptor representing the errors resulting from resolving the | 8553 * The data descriptor representing the errors resulting from resolving the |
8554 * source. | 8554 * source. |
8555 */ | 8555 */ |
8556 static final DataDescriptor<List<AnalysisError>> RESOLUTION_ERRORS = | 8556 static final DataDescriptor<List<AnalysisError>> RESOLUTION_ERRORS = |
8557 new DataDescriptor<List<AnalysisError>>( | 8557 new DataDescriptor<List<AnalysisError>>( |
8558 "HtmlEntry.RESOLUTION_ERRORS", AnalysisError.NO_ERRORS); | 8558 "HtmlEntry.RESOLUTION_ERRORS", AnalysisError.NO_ERRORS); |
8559 | 8559 |
8560 /** | 8560 /** |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9420 _errors = errorListener.getErrorsForSource(source); | 9420 _errors = errorListener.getErrorsForSource(source); |
9421 }); | 9421 }); |
9422 } | 9422 } |
9423 | 9423 |
9424 /** | 9424 /** |
9425 * Efficiently convert the given set of [sources] to a list. | 9425 * Efficiently convert the given set of [sources] to a list. |
9426 */ | 9426 */ |
9427 List<Source> _toArray(HashSet<Source> sources) { | 9427 List<Source> _toArray(HashSet<Source> sources) { |
9428 int size = sources.length; | 9428 int size = sources.length; |
9429 if (size == 0) { | 9429 if (size == 0) { |
9430 return Source.EMPTY_ARRAY; | 9430 return Source.EMPTY_LIST; |
9431 } | 9431 } |
9432 return new List.from(sources); | 9432 return new List.from(sources); |
9433 } | 9433 } |
9434 | 9434 |
9435 /** | 9435 /** |
9436 * Return the result of resolving the URI of the given URI-based directive aga
inst the URI of the | 9436 * Return the result of resolving the URI of the given URI-based directive aga
inst the URI of the |
9437 * given library, or `null` if the URI is not valid. | 9437 * given library, or `null` if the URI is not valid. |
9438 * | 9438 * |
9439 * @param context the context in which the resolution is to be performed | 9439 * @param context the context in which the resolution is to be performed |
9440 * @param librarySource the source representing the library containing the dir
ective | 9440 * @param librarySource the source representing the library containing the dir
ective |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9517 ht.HtmlUnit _unit; | 9517 ht.HtmlUnit _unit; |
9518 | 9518 |
9519 /** | 9519 /** |
9520 * The errors that were produced by scanning and parsing the source. | 9520 * The errors that were produced by scanning and parsing the source. |
9521 */ | 9521 */ |
9522 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; | 9522 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; |
9523 | 9523 |
9524 /** | 9524 /** |
9525 * A list containing the sources of the libraries that are referenced within t
he HTML. | 9525 * A list containing the sources of the libraries that are referenced within t
he HTML. |
9526 */ | 9526 */ |
9527 List<Source> _referencedLibraries = Source.EMPTY_ARRAY; | 9527 List<Source> _referencedLibraries = Source.EMPTY_LIST; |
9528 | 9528 |
9529 /** | 9529 /** |
9530 * Initialize a newly created task to perform analysis within the given contex
t. | 9530 * Initialize a newly created task to perform analysis within the given contex
t. |
9531 * | 9531 * |
9532 * @param context the context in which the task is to be performed | 9532 * @param context the context in which the task is to be performed |
9533 * @param source the source to be parsed | 9533 * @param source the source to be parsed |
9534 * @param content the contents of the source | 9534 * @param content the contents of the source |
9535 */ | 9535 */ |
9536 ParseHtmlTask(InternalAnalysisContext context, this.source, this._content) | 9536 ParseHtmlTask(InternalAnalysisContext context, this.source, this._content) |
9537 : super(context); | 9537 : super(context); |
(...skipping 15 matching lines...) Expand all Loading... |
9553 | 9553 |
9554 /** | 9554 /** |
9555 * Return the sources of libraries that are referenced in the specified HTML f
ile. | 9555 * Return the sources of libraries that are referenced in the specified HTML f
ile. |
9556 * | 9556 * |
9557 * @return the sources of libraries that are referenced in the HTML file | 9557 * @return the sources of libraries that are referenced in the HTML file |
9558 */ | 9558 */ |
9559 List<Source> get librarySources { | 9559 List<Source> get librarySources { |
9560 List<Source> libraries = new List<Source>(); | 9560 List<Source> libraries = new List<Source>(); |
9561 _unit.accept(new ParseHtmlTask_getLibrarySources(this, libraries)); | 9561 _unit.accept(new ParseHtmlTask_getLibrarySources(this, libraries)); |
9562 if (libraries.isEmpty) { | 9562 if (libraries.isEmpty) { |
9563 return Source.EMPTY_ARRAY; | 9563 return Source.EMPTY_LIST; |
9564 } | 9564 } |
9565 return libraries; | 9565 return libraries; |
9566 } | 9566 } |
9567 | 9567 |
9568 /** | 9568 /** |
9569 * Return the line information that was produced, or `null` if the task has no
t yet been | 9569 * Return the line information that was produced, or `null` if the task has no
t yet been |
9570 * performed or if an exception occurred. | 9570 * performed or if an exception occurred. |
9571 * | 9571 * |
9572 * @return the line information that was produced | 9572 * @return the line information that was produced |
9573 */ | 9573 */ |
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11700 visitElement(Element element) { | 11700 visitElement(Element element) { |
11701 if (element.id == _id) { | 11701 if (element.id == _id) { |
11702 result = element; | 11702 result = element; |
11703 throw new _ElementByIdFinderException(); | 11703 throw new _ElementByIdFinderException(); |
11704 } | 11704 } |
11705 super.visitElement(element); | 11705 super.visitElement(element); |
11706 } | 11706 } |
11707 } | 11707 } |
11708 | 11708 |
11709 class _ElementByIdFinderException {} | 11709 class _ElementByIdFinderException {} |
OLD | NEW |