| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 * @param changeSet a description of the changes that are to be applied | 205 * @param changeSet a description of the changes that are to be applied |
| 206 */ | 206 */ |
| 207 void applyChanges(ChangeSet changeSet); | 207 void applyChanges(ChangeSet changeSet); |
| 208 | 208 |
| 209 /** | 209 /** |
| 210 * Return the documentation comment for the given element as it appears in the
original source | 210 * Return the documentation comment for the given element as it appears in the
original source |
| 211 * (complete with the beginning and ending delimiters), or `null` if the eleme
nt does not | 211 * (complete with the beginning and ending delimiters), or `null` if the eleme
nt does not |
| 212 * have a documentation comment associated with it. This can be a long-running
operation if the | 212 * have a documentation comment associated with it. This can be a long-running
operation if the |
| 213 * information needed to access the comment is not cached. | 213 * information needed to access the comment is not cached. |
| 214 * | 214 * |
| 215 * <b>Note:</b> This method cannot be used in an async environment. |
| 216 * |
| 215 * @param element the element whose documentation comment is to be returned | 217 * @param element the element whose documentation comment is to be returned |
| 216 * @return the element's documentation comment | 218 * @return the element's documentation comment |
| 217 * @throws AnalysisException if the documentation comment could not be determi
ned because the | 219 * @throws AnalysisException if the documentation comment could not be determi
ned because the |
| 218 * analysis could not be performed | 220 * analysis could not be performed |
| 219 */ | 221 */ |
| 220 String computeDocumentationComment(Element element); | 222 String computeDocumentationComment(Element element); |
| 221 | 223 |
| 222 /** | 224 /** |
| 223 * Return an array containing all of the errors associated with the given sour
ce. If the errors | 225 * Return an array containing all of the errors associated with the given sour
ce. If the errors |
| 224 * are not already known then the source will be analyzed in order to determin
e the errors | 226 * are not already known then the source will be analyzed in order to determin
e the errors |
| 225 * associated with it. | 227 * associated with it. |
| 226 * | 228 * |
| 227 * <b>Note:</b> This method cannot be used in an async environment | 229 * <b>Note:</b> This method cannot be used in an async environment. |
| 228 * | 230 * |
| 229 * @param source the source whose errors are to be returned | 231 * @param source the source whose errors are to be returned |
| 230 * @return all of the errors associated with the given source | 232 * @return all of the errors associated with the given source |
| 231 * @throws AnalysisException if the errors could not be determined because the
analysis could not | 233 * @throws AnalysisException if the errors could not be determined because the
analysis could not |
| 232 * be performed | 234 * be performed |
| 233 * @see #getErrors(Source) | 235 * @see #getErrors(Source) |
| 234 */ | 236 */ |
| 235 List<AnalysisError> computeErrors(Source source); | 237 List<AnalysisError> computeErrors(Source source); |
| 236 | 238 |
| 237 /** | 239 /** |
| 238 * Return the element model corresponding to the HTML file defined by the give
n source. If the | 240 * Return the element model corresponding to the HTML file defined by the give
n source. If the |
| 239 * element model does not yet exist it will be created. The process of creatin
g an element model | 241 * element model does not yet exist it will be created. The process of creatin
g an element model |
| 240 * for an HTML file can long-running, depending on the size of the file and th
e number of | 242 * for an HTML file can long-running, depending on the size of the file and th
e number of |
| 241 * libraries that are defined in it (via script tags) that also need to have a
model built for | 243 * libraries that are defined in it (via script tags) that also need to have a
model built for |
| 242 * them. | 244 * them. |
| 243 * | 245 * |
| 244 * <b>Note:</b> This method cannot be used in an async environment | 246 * <b>Note:</b> This method cannot be used in an async environment. |
| 245 * | 247 * |
| 246 * @param source the source defining the HTML file whose element model is to b
e returned | 248 * @param source the source defining the HTML file whose element model is to b
e returned |
| 247 * @return the element model corresponding to the HTML file defined by the giv
en source | 249 * @return the element model corresponding to the HTML file defined by the giv
en source |
| 248 * @throws AnalysisException if the element model could not be determined beca
use the analysis | 250 * @throws AnalysisException if the element model could not be determined beca
use the analysis |
| 249 * could not be performed | 251 * could not be performed |
| 250 * @see #getHtmlElement(Source) | 252 * @see #getHtmlElement(Source) |
| 251 */ | 253 */ |
| 252 HtmlElement computeHtmlElement(Source source); | 254 HtmlElement computeHtmlElement(Source source); |
| 253 | 255 |
| 254 /** | 256 /** |
| 255 * Return the kind of the given source, computing it's kind if it is not alrea
dy known. Return | 257 * Return the kind of the given source, computing it's kind if it is not alrea
dy known. Return |
| 256 * [SourceKind#UNKNOWN] if the source is not contained in this context. | 258 * [SourceKind#UNKNOWN] if the source is not contained in this context. |
| 257 * | 259 * |
| 258 * <b>Note:</b> This method cannot be used in an async environment | 260 * <b>Note:</b> This method cannot be used in an async environment. |
| 259 * | 261 * |
| 260 * @param source the source whose kind is to be returned | 262 * @param source the source whose kind is to be returned |
| 261 * @return the kind of the given source | 263 * @return the kind of the given source |
| 262 * @see #getKindOf(Source) | 264 * @see #getKindOf(Source) |
| 263 */ | 265 */ |
| 264 SourceKind computeKindOf(Source source); | 266 SourceKind computeKindOf(Source source); |
| 265 | 267 |
| 266 /** | 268 /** |
| 267 * Return the element model corresponding to the library defined by the given
source. If the | 269 * Return the element model corresponding to the library defined by the given
source. If the |
| 268 * element model does not yet exist it will be created. The process of creatin
g an element model | 270 * element model does not yet exist it will be created. The process of creatin
g an element model |
| 269 * for a library can long-running, depending on the size of the library and th
e number of | 271 * for a library can long-running, depending on the size of the library and th
e number of |
| 270 * libraries that are imported into it that also need to have a model built fo
r them. | 272 * libraries that are imported into it that also need to have a model built fo
r them. |
| 271 * | 273 * |
| 274 * <b>Note:</b> This method cannot be used in an async environment. |
| 275 * |
| 272 * @param source the source defining the library whose element model is to be
returned | 276 * @param source the source defining the library whose element model is to be
returned |
| 273 * @return the element model corresponding to the library defined by the given
source | 277 * @return the element model corresponding to the library defined by the given
source |
| 274 * @throws AnalysisException if the element model could not be determined beca
use the analysis | 278 * @throws AnalysisException if the element model could not be determined beca
use the analysis |
| 275 * could not be performed | 279 * could not be performed |
| 276 * @see #getLibraryElement(Source) | 280 * @see #getLibraryElement(Source) |
| 277 */ | 281 */ |
| 278 LibraryElement computeLibraryElement(Source source); | 282 LibraryElement computeLibraryElement(Source source); |
| 279 | 283 |
| 280 /** | 284 /** |
| 281 * Return the line information for the given source, or `null` if the source i
s not of a | 285 * Return the line information for the given source, or `null` if the source i
s not of a |
| 282 * recognized kind (neither a Dart nor HTML file). If the line information was
not previously | 286 * recognized kind (neither a Dart nor HTML file). If the line information was
not previously |
| 283 * known it will be created. The line information is used to map offsets from
the beginning of the | 287 * known it will be created. The line information is used to map offsets from
the beginning of the |
| 284 * source to line and column pairs. | 288 * source to line and column pairs. |
| 285 * | 289 * |
| 286 * <b>Note:</b> This method cannot be used in an async environment | 290 * <b>Note:</b> This method cannot be used in an async environment. |
| 287 * | 291 * |
| 288 * @param source the source whose line information is to be returned | 292 * @param source the source whose line information is to be returned |
| 289 * @return the line information for the given source | 293 * @return the line information for the given source |
| 290 * @throws AnalysisException if the line information could not be determined b
ecause the analysis | 294 * @throws AnalysisException if the line information could not be determined b
ecause the analysis |
| 291 * could not be performed | 295 * could not be performed |
| 292 * @see #getLineInfo(Source) | 296 * @see #getLineInfo(Source) |
| 293 */ | 297 */ |
| 294 LineInfo computeLineInfo(Source source); | 298 LineInfo computeLineInfo(Source source); |
| 295 | 299 |
| 296 /** | 300 /** |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 * sources should be reanalyzed as part of this context. | 600 * sources should be reanalyzed as part of this context. |
| 597 * | 601 * |
| 598 * @param context the context being merged | 602 * @param context the context being merged |
| 599 */ | 603 */ |
| 600 void mergeContext(AnalysisContext context); | 604 void mergeContext(AnalysisContext context); |
| 601 | 605 |
| 602 /** | 606 /** |
| 603 * Parse a single source to produce an AST structure. The resulting AST struct
ure may or may not | 607 * Parse a single source to produce an AST structure. The resulting AST struct
ure may or may not |
| 604 * be resolved, and may have a slightly different structure depending upon whe
ther it is resolved. | 608 * be resolved, and may have a slightly different structure depending upon whe
ther it is resolved. |
| 605 * | 609 * |
| 606 * <b>Note:</b> This method cannot be used in an async environment | 610 * <b>Note:</b> This method cannot be used in an async environment. |
| 607 * | 611 * |
| 608 * @param source the source to be parsed | 612 * @param source the source to be parsed |
| 609 * @return the AST structure representing the content of the source | 613 * @return the AST structure representing the content of the source |
| 610 * @throws AnalysisException if the analysis could not be performed | 614 * @throws AnalysisException if the analysis could not be performed |
| 611 */ | 615 */ |
| 612 CompilationUnit parseCompilationUnit(Source source); | 616 CompilationUnit parseCompilationUnit(Source source); |
| 613 | 617 |
| 614 /** | 618 /** |
| 615 * Parse a single HTML source to produce an AST structure. The resulting HTML
AST structure may or | 619 * Parse a single HTML source to produce an AST structure. The resulting HTML
AST structure may or |
| 616 * may not be resolved, and may have a slightly different structure depending
upon whether it is | 620 * may not be resolved, and may have a slightly different structure depending
upon whether it is |
| 617 * resolved. | 621 * resolved. |
| 618 * | 622 * |
| 619 * <b>Note:</b> This method cannot be used in an async environment | 623 * <b>Note:</b> This method cannot be used in an async environment. |
| 620 * | 624 * |
| 621 * @param source the HTML source to be parsed | 625 * @param source the HTML source to be parsed |
| 622 * @return the parse result (not `null`) | 626 * @return the parse result (not `null`) |
| 623 * @throws AnalysisException if the analysis could not be performed | 627 * @throws AnalysisException if the analysis could not be performed |
| 624 */ | 628 */ |
| 625 ht.HtmlUnit parseHtmlUnit(Source source); | 629 ht.HtmlUnit parseHtmlUnit(Source source); |
| 626 | 630 |
| 627 /** | 631 /** |
| 628 * Perform the next unit of work required to keep the analysis results up-to-d
ate and return | 632 * Perform the next unit of work required to keep the analysis results up-to-d
ate and return |
| 629 * information about the consequent changes to the analysis results. This meth
od can be long | 633 * information about the consequent changes to the analysis results. This meth
od can be long |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 class AnalysisResult { | 852 class AnalysisResult { |
| 849 /** | 853 /** |
| 850 * The change notices associated with this result, or `null` if there were no
changes and | 854 * The change notices associated with this result, or `null` if there were no
changes and |
| 851 * there is no more work to be done. | 855 * there is no more work to be done. |
| 852 */ | 856 */ |
| 853 List<ChangeNotice> _notices; | 857 List<ChangeNotice> _notices; |
| 854 | 858 |
| 855 /** | 859 /** |
| 856 * The number of milliseconds required to determine which task was to be perfo
rmed. | 860 * The number of milliseconds required to determine which task was to be perfo
rmed. |
| 857 */ | 861 */ |
| 858 final int getTime; | 862 int getTime = 0; |
| 859 | 863 |
| 860 /** | 864 /** |
| 861 * The name of the class of the task that was performed. | 865 * The name of the class of the task that was performed. |
| 862 */ | 866 */ |
| 863 final String taskClassName; | 867 String taskClassName; |
| 864 | 868 |
| 865 /** | 869 /** |
| 866 * The number of milliseconds required to perform the task. | 870 * The number of milliseconds required to perform the task. |
| 867 */ | 871 */ |
| 868 final int performTime; | 872 int performTime = 0; |
| 869 | 873 |
| 870 /** | 874 /** |
| 871 * Initialize a newly created analysis result to have the given values. | 875 * Initialize a newly created analysis result to have the given values. |
| 872 * | 876 * |
| 873 * @param notices the change notices associated with this result | 877 * @param notices the change notices associated with this result |
| 874 * @param getTime the number of milliseconds required to determine which task
was to be performed | 878 * @param getTime the number of milliseconds required to determine which task
was to be performed |
| 875 * @param taskClassName the name of the class of the task that was performed | 879 * @param taskClassName the name of the class of the task that was performed |
| 876 * @param performTime the number of milliseconds required to perform the task | 880 * @param performTime the number of milliseconds required to perform the task |
| 877 */ | 881 */ |
| 878 AnalysisResult(List<ChangeNotice> notices, this.getTime, this.taskClassName, t
his.performTime) { | 882 AnalysisResult(List<ChangeNotice> notices, int getTime, String taskClassName,
int performTime) { |
| 879 this._notices = notices; | 883 this._notices = notices; |
| 884 this.getTime = getTime; |
| 885 this.taskClassName = taskClassName; |
| 886 this.performTime = performTime; |
| 880 } | 887 } |
| 881 | 888 |
| 882 /** | 889 /** |
| 883 * Return the change notices associated with this result, or `null` if there w
ere no changes | 890 * Return the change notices associated with this result, or `null` if there w
ere no changes |
| 884 * and there is no more work to be done. | 891 * and there is no more work to be done. |
| 885 * | 892 * |
| 886 * @return the change notices associated with this result | 893 * @return the change notices associated with this result |
| 887 */ | 894 */ |
| 888 List<ChangeNotice> get changeNotices => _notices; | 895 List<ChangeNotice> get changeNotices => _notices; |
| 889 | 896 |
| (...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1370 * The data descriptor representing the errors reported during Angular resolut
ion. | 1377 * The data descriptor representing the errors reported during Angular resolut
ion. |
| 1371 */ | 1378 */ |
| 1372 static final DataDescriptor<List<AnalysisError>> ANGULAR_ERRORS = new DataDesc
riptor<List<AnalysisError>>("DartEntry.ANGULAR_ERRORS"); | 1379 static final DataDescriptor<List<AnalysisError>> ANGULAR_ERRORS = new DataDesc
riptor<List<AnalysisError>>("DartEntry.ANGULAR_ERRORS"); |
| 1373 | 1380 |
| 1374 /** | 1381 /** |
| 1375 * The data descriptor representing the list of libraries that contain this co
mpilation unit. | 1382 * The data descriptor representing the list of libraries that contain this co
mpilation unit. |
| 1376 */ | 1383 */ |
| 1377 static final DataDescriptor<List<Source>> CONTAINING_LIBRARIES = new DataDescr
iptor<List<Source>>("DartEntry.CONTAINING_LIBRARIES"); | 1384 static final DataDescriptor<List<Source>> CONTAINING_LIBRARIES = new DataDescr
iptor<List<Source>>("DartEntry.CONTAINING_LIBRARIES"); |
| 1378 | 1385 |
| 1379 /** | 1386 /** |
| 1380 * The data descriptor representing the errors reported during the resolution
of directives. | |
| 1381 */ | |
| 1382 static final DataDescriptor<List<AnalysisError>> DIRECTIVE_ERRORS = new DataDe
scriptor<List<AnalysisError>>("DartEntry.DIRECTIVE_ERRORS"); | |
| 1383 | |
| 1384 /** | |
| 1385 * The data descriptor representing the library element for the library. This
data is only | 1387 * The data descriptor representing the library element for the library. This
data is only |
| 1386 * available for Dart files that are the defining compilation unit of a librar
y. | 1388 * available for Dart files that are the defining compilation unit of a librar
y. |
| 1387 */ | 1389 */ |
| 1388 static final DataDescriptor<LibraryElement> ELEMENT = new DataDescriptor<Libra
ryElement>("DartEntry.ELEMENT"); | 1390 static final DataDescriptor<LibraryElement> ELEMENT = new DataDescriptor<Libra
ryElement>("DartEntry.ELEMENT"); |
| 1389 | 1391 |
| 1390 /** | 1392 /** |
| 1391 * The data descriptor representing the list of exported libraries. This data
is only available | 1393 * The data descriptor representing the list of exported libraries. This data
is only available |
| 1392 * for Dart files that are the defining compilation unit of a library. | 1394 * for Dart files that are the defining compilation unit of a library. |
| 1393 */ | 1395 */ |
| 1394 static final DataDescriptor<List<Source>> EXPORTED_LIBRARIES = new DataDescrip
tor<List<Source>>("DartEntry.EXPORTED_LIBRARIES"); | 1396 static final DataDescriptor<List<Source>> EXPORTED_LIBRARIES = new DataDescrip
tor<List<Source>>("DartEntry.EXPORTED_LIBRARIES"); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1521 * Return `true` if the data represented by the given descriptor is marked as
being invalid. | 1523 * Return `true` if the data represented by the given descriptor is marked as
being invalid. |
| 1522 * If the descriptor represents library-specific data then this method will re
turn `true` if | 1524 * If the descriptor represents library-specific data then this method will re
turn `true` if |
| 1523 * the data associated with any library it marked as invalid. | 1525 * the data associated with any library it marked as invalid. |
| 1524 * | 1526 * |
| 1525 * @param descriptor the descriptor representing which data is being tested | 1527 * @param descriptor the descriptor representing which data is being tested |
| 1526 * @return `true` if the data is marked as being invalid | 1528 * @return `true` if the data is marked as being invalid |
| 1527 */ | 1529 */ |
| 1528 bool hasInvalidData(DataDescriptor descriptor); | 1530 bool hasInvalidData(DataDescriptor descriptor); |
| 1529 | 1531 |
| 1530 /** | 1532 /** |
| 1533 * Return `true` if this entry has an AST structure that can be resolved (even
if it needs |
| 1534 * to be copied). |
| 1535 * |
| 1536 * @return `true` if the method [DartEntryImpl#getResolvableCompilationUnit] w
ill |
| 1537 * return a non-`null` result |
| 1538 */ |
| 1539 bool get hasResolvableCompilationUnit; |
| 1540 |
| 1541 /** |
| 1531 * Return `true` if this data is safe to use in refactoring. | 1542 * Return `true` if this data is safe to use in refactoring. |
| 1532 */ | 1543 */ |
| 1533 bool get isRefactoringSafe; | 1544 bool get isRefactoringSafe; |
| 1534 } | 1545 } |
| 1535 | 1546 |
| 1536 /** | 1547 /** |
| 1537 * Instances of the class `DartEntryImpl` implement a [DartEntry]. | 1548 * Instances of the class `DartEntryImpl` implement a [DartEntry]. |
| 1538 */ | 1549 */ |
| 1539 class DartEntryImpl extends SourceEntryImpl implements DartEntry { | 1550 class DartEntryImpl extends SourceEntryImpl implements DartEntry { |
| 1540 /** | 1551 /** |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 */ | 1634 */ |
| 1624 CacheState _includedPartsState = CacheState.INVALID; | 1635 CacheState _includedPartsState = CacheState.INVALID; |
| 1625 | 1636 |
| 1626 /** | 1637 /** |
| 1627 * The list of parts included in the library, or an empty array if the list is
not currently | 1638 * The list of parts included in the library, or an empty array if the list is
not currently |
| 1628 * cached. The list will be empty if the Dart file is a part rather than a lib
rary. | 1639 * cached. The list will be empty if the Dart file is a part rather than a lib
rary. |
| 1629 */ | 1640 */ |
| 1630 List<Source> _includedParts = Source.EMPTY_ARRAY; | 1641 List<Source> _includedParts = Source.EMPTY_ARRAY; |
| 1631 | 1642 |
| 1632 /** | 1643 /** |
| 1633 * The state of the cached directive errors. | |
| 1634 */ | |
| 1635 CacheState _directiveErrorsState = CacheState.INVALID; | |
| 1636 | |
| 1637 /** | |
| 1638 * The errors produced while resolving the directives, or an empty array if th
e errors are not | |
| 1639 * currently cached. | |
| 1640 */ | |
| 1641 List<AnalysisError> _directiveErrors = AnalysisError.NO_ERRORS; | |
| 1642 | |
| 1643 /** | |
| 1644 * The list of libraries that contain this compilation unit. The list will be
empty if there are | 1644 * The list of libraries that contain this compilation unit. The list will be
empty if there are |
| 1645 * no known libraries that contain this compilation unit. | 1645 * no known libraries that contain this compilation unit. |
| 1646 */ | 1646 */ |
| 1647 List<Source> _containingLibraries = new List<Source>(); | 1647 List<Source> _containingLibraries = new List<Source>(); |
| 1648 | 1648 |
| 1649 /** | 1649 /** |
| 1650 * The information known as a result of resolving this compilation unit as par
t of the library | 1650 * The information known as a result of resolving this compilation unit as par
t of the library |
| 1651 * that contains this unit. This field will never be `null`. | 1651 * that contains this unit. This field will never be `null`. |
| 1652 */ | 1652 */ |
| 1653 DartEntryImpl_ResolutionState _resolutionState = new DartEntryImpl_ResolutionS
tate(); | 1653 DartEntryImpl_ResolutionState _resolutionState = new DartEntryImpl_ResolutionS
tate(); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1730 _parsedUnit = null; | 1730 _parsedUnit = null; |
| 1731 } | 1731 } |
| 1732 _resolutionState.flushAstStructures(); | 1732 _resolutionState.flushAstStructures(); |
| 1733 } | 1733 } |
| 1734 | 1734 |
| 1735 @override | 1735 @override |
| 1736 List<AnalysisError> get allErrors { | 1736 List<AnalysisError> get allErrors { |
| 1737 List<AnalysisError> errors = new List<AnalysisError>(); | 1737 List<AnalysisError> errors = new List<AnalysisError>(); |
| 1738 ListUtilities.addAll(errors, _scanErrors); | 1738 ListUtilities.addAll(errors, _scanErrors); |
| 1739 ListUtilities.addAll(errors, _parseErrors); | 1739 ListUtilities.addAll(errors, _parseErrors); |
| 1740 ListUtilities.addAll(errors, _directiveErrors); | |
| 1741 DartEntryImpl_ResolutionState state = _resolutionState; | 1740 DartEntryImpl_ResolutionState state = _resolutionState; |
| 1742 while (state != null) { | 1741 while (state != null) { |
| 1743 ListUtilities.addAll(errors, state._resolutionErrors); | 1742 ListUtilities.addAll(errors, state._resolutionErrors); |
| 1744 ListUtilities.addAll(errors, state._verificationErrors); | 1743 ListUtilities.addAll(errors, state._verificationErrors); |
| 1745 ListUtilities.addAll(errors, state._hints); | 1744 ListUtilities.addAll(errors, state._hints); |
| 1746 state = state._nextState; | 1745 state = state._nextState; |
| 1747 } | 1746 } |
| 1748 ListUtilities.addAll(errors, _angularErrors); | 1747 ListUtilities.addAll(errors, _angularErrors); |
| 1749 if (errors.length == 0) { | 1748 if (errors.length == 0) { |
| 1750 return AnalysisError.NO_ERRORS; | 1749 return AnalysisError.NO_ERRORS; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1815 return state._resolvedUnit.accept(new AstCloner()) as CompilationUnit; | 1814 return state._resolvedUnit.accept(new AstCloner()) as CompilationUnit; |
| 1816 } | 1815 } |
| 1817 state = state._nextState; | 1816 state = state._nextState; |
| 1818 } | 1817 } |
| 1819 ; | 1818 ; |
| 1820 return null; | 1819 return null; |
| 1821 } | 1820 } |
| 1822 | 1821 |
| 1823 @override | 1822 @override |
| 1824 CacheState getState(DataDescriptor descriptor) { | 1823 CacheState getState(DataDescriptor descriptor) { |
| 1825 if (identical(descriptor, DartEntry.DIRECTIVE_ERRORS)) { | 1824 if (identical(descriptor, DartEntry.ELEMENT)) { |
| 1826 return _directiveErrorsState; | |
| 1827 } else if (identical(descriptor, DartEntry.ELEMENT)) { | |
| 1828 return _elementState; | 1825 return _elementState; |
| 1829 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 1826 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 1830 return _exportedLibrariesState; | 1827 return _exportedLibrariesState; |
| 1831 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 1828 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 1832 return _importedLibrariesState; | 1829 return _importedLibrariesState; |
| 1833 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 1830 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| 1834 return _includedPartsState; | 1831 return _includedPartsState; |
| 1835 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { | 1832 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { |
| 1836 return _clientServerState; | 1833 return _clientServerState; |
| 1837 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) { | 1834 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1879 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 1876 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 1880 } | 1877 } |
| 1881 } | 1878 } |
| 1882 | 1879 |
| 1883 @override | 1880 @override |
| 1884 Object getValue(DataDescriptor descriptor) { | 1881 Object getValue(DataDescriptor descriptor) { |
| 1885 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { | 1882 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { |
| 1886 return _angularErrors; | 1883 return _angularErrors; |
| 1887 } else if (identical(descriptor, DartEntry.CONTAINING_LIBRARIES)) { | 1884 } else if (identical(descriptor, DartEntry.CONTAINING_LIBRARIES)) { |
| 1888 return new List.from(_containingLibraries); | 1885 return new List.from(_containingLibraries); |
| 1889 } else if (identical(descriptor, DartEntry.DIRECTIVE_ERRORS)) { | |
| 1890 return _directiveErrors; | |
| 1891 } else if (identical(descriptor, DartEntry.ELEMENT)) { | 1886 } else if (identical(descriptor, DartEntry.ELEMENT)) { |
| 1892 return _element; | 1887 return _element; |
| 1893 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 1888 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 1894 return _exportedLibraries; | 1889 return _exportedLibraries; |
| 1895 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 1890 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 1896 return _importedLibraries; | 1891 return _importedLibraries; |
| 1897 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 1892 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| 1898 return _includedParts; | 1893 return _includedParts; |
| 1899 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { | 1894 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { |
| 1900 return BooleanArray.get(_bitmask, _CLIENT_CODE_INDEX); | 1895 return BooleanArray.get(_bitmask, _CLIENT_CODE_INDEX); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1948 | 1943 |
| 1949 @override | 1944 @override |
| 1950 DartEntryImpl get writableCopy { | 1945 DartEntryImpl get writableCopy { |
| 1951 DartEntryImpl copy = new DartEntryImpl(); | 1946 DartEntryImpl copy = new DartEntryImpl(); |
| 1952 copy.copyFrom(this); | 1947 copy.copyFrom(this); |
| 1953 return copy; | 1948 return copy; |
| 1954 } | 1949 } |
| 1955 | 1950 |
| 1956 @override | 1951 @override |
| 1957 bool hasInvalidData(DataDescriptor descriptor) { | 1952 bool hasInvalidData(DataDescriptor descriptor) { |
| 1958 if (identical(descriptor, DartEntry.DIRECTIVE_ERRORS)) { | 1953 if (identical(descriptor, DartEntry.ELEMENT)) { |
| 1959 return identical(_directiveErrorsState, CacheState.INVALID); | |
| 1960 } else if (identical(descriptor, DartEntry.ELEMENT)) { | |
| 1961 return identical(_elementState, CacheState.INVALID); | 1954 return identical(_elementState, CacheState.INVALID); |
| 1962 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 1955 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 1963 return identical(_exportedLibrariesState, CacheState.INVALID); | 1956 return identical(_exportedLibrariesState, CacheState.INVALID); |
| 1964 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 1957 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 1965 return identical(_importedLibrariesState, CacheState.INVALID); | 1958 return identical(_importedLibrariesState, CacheState.INVALID); |
| 1966 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 1959 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| 1967 return identical(_includedPartsState, CacheState.INVALID); | 1960 return identical(_includedPartsState, CacheState.INVALID); |
| 1968 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { | 1961 } else if (identical(descriptor, DartEntry.IS_CLIENT)) { |
| 1969 return identical(_clientServerState, CacheState.INVALID); | 1962 return identical(_clientServerState, CacheState.INVALID); |
| 1970 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) { | 1963 } else if (identical(descriptor, DartEntry.IS_LAUNCHABLE)) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 1994 return identical(state._hintsState, CacheState.INVALID); | 1987 return identical(state._hintsState, CacheState.INVALID); |
| 1995 } | 1988 } |
| 1996 } | 1989 } |
| 1997 return false; | 1990 return false; |
| 1998 } else { | 1991 } else { |
| 1999 return identical(super.getState(descriptor), CacheState.INVALID); | 1992 return identical(super.getState(descriptor), CacheState.INVALID); |
| 2000 } | 1993 } |
| 2001 } | 1994 } |
| 2002 | 1995 |
| 2003 @override | 1996 @override |
| 1997 bool get hasResolvableCompilationUnit { |
| 1998 if (identical(_parsedUnitState, CacheState.VALID)) { |
| 1999 return true; |
| 2000 } |
| 2001 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2002 while (state != null) { |
| 2003 if (identical(state._resolvedUnitState, CacheState.VALID)) { |
| 2004 return true; |
| 2005 } |
| 2006 state = state._nextState; |
| 2007 } |
| 2008 ; |
| 2009 return false; |
| 2010 } |
| 2011 |
| 2012 @override |
| 2004 void invalidateAllInformation() { | 2013 void invalidateAllInformation() { |
| 2005 super.invalidateAllInformation(); | 2014 super.invalidateAllInformation(); |
| 2006 _scanErrors = AnalysisError.NO_ERRORS; | 2015 _scanErrors = AnalysisError.NO_ERRORS; |
| 2007 _scanErrorsState = CacheState.INVALID; | 2016 _scanErrorsState = CacheState.INVALID; |
| 2008 _tokenStream = null; | 2017 _tokenStream = null; |
| 2009 _tokenStreamState = CacheState.INVALID; | 2018 _tokenStreamState = CacheState.INVALID; |
| 2010 _sourceKind = SourceKind.UNKNOWN; | 2019 _sourceKind = SourceKind.UNKNOWN; |
| 2011 _sourceKindState = CacheState.INVALID; | 2020 _sourceKindState = CacheState.INVALID; |
| 2012 _parseErrors = AnalysisError.NO_ERRORS; | 2021 _parseErrors = AnalysisError.NO_ERRORS; |
| 2013 _parseErrorsState = CacheState.INVALID; | 2022 _parseErrorsState = CacheState.INVALID; |
| 2014 _parsedUnit = null; | 2023 _parsedUnit = null; |
| 2015 _parsedUnitAccessed = false; | 2024 _parsedUnitAccessed = false; |
| 2016 _parsedUnitState = CacheState.INVALID; | 2025 _parsedUnitState = CacheState.INVALID; |
| 2026 _importedLibraries = Source.EMPTY_ARRAY; |
| 2027 _importedLibrariesState = CacheState.INVALID; |
| 2028 _exportedLibraries = Source.EMPTY_ARRAY; |
| 2029 _exportedLibrariesState = CacheState.INVALID; |
| 2030 _includedParts = Source.EMPTY_ARRAY; |
| 2031 _includedPartsState = CacheState.INVALID; |
| 2017 _discardCachedResolutionInformation(); | 2032 _discardCachedResolutionInformation(); |
| 2018 } | 2033 } |
| 2019 | 2034 |
| 2020 /** | 2035 /** |
| 2021 * Invalidate all of the resolution information associated with the compilatio
n unit. | 2036 * Invalidate all of the resolution information associated with the compilatio
n unit. |
| 2022 */ | 2037 */ |
| 2023 void invalidateAllResolutionInformation() { | 2038 void invalidateAllResolutionInformation() { |
| 2024 if (identical(_parsedUnitState, CacheState.FLUSHED)) { | 2039 if (identical(_parsedUnitState, CacheState.FLUSHED)) { |
| 2025 DartEntryImpl_ResolutionState state = _resolutionState; | 2040 DartEntryImpl_ResolutionState state = _resolutionState; |
| 2026 while (state != null) { | 2041 while (state != null) { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2049 return true; | 2064 return true; |
| 2050 } | 2065 } |
| 2051 | 2066 |
| 2052 @override | 2067 @override |
| 2053 void recordContentError() { | 2068 void recordContentError() { |
| 2054 super.recordContentError(); | 2069 super.recordContentError(); |
| 2055 recordScanError(); | 2070 recordScanError(); |
| 2056 } | 2071 } |
| 2057 | 2072 |
| 2058 /** | 2073 /** |
| 2059 * Record that an error occurred while attempting to resolve the directives in
the source | |
| 2060 * represented by this entry. | |
| 2061 */ | |
| 2062 void recordDependencyError() { | |
| 2063 _exportedLibraries = Source.EMPTY_ARRAY; | |
| 2064 _exportedLibrariesState = CacheState.ERROR; | |
| 2065 _importedLibraries = Source.EMPTY_ARRAY; | |
| 2066 _importedLibrariesState = CacheState.ERROR; | |
| 2067 _includedParts = Source.EMPTY_ARRAY; | |
| 2068 _includedPartsState = CacheState.ERROR; | |
| 2069 _directiveErrors = AnalysisError.NO_ERRORS; | |
| 2070 _directiveErrorsState = CacheState.ERROR; | |
| 2071 } | |
| 2072 | |
| 2073 /** | |
| 2074 * Record that the information related to resolving dependencies for the assoc
iated source is | |
| 2075 * about to be computed by the current thread. | |
| 2076 */ | |
| 2077 void recordDependencyInProcess() { | |
| 2078 if (_exportedLibrariesState != CacheState.VALID) { | |
| 2079 _exportedLibrariesState = CacheState.IN_PROCESS; | |
| 2080 } | |
| 2081 if (_importedLibrariesState != CacheState.VALID) { | |
| 2082 _importedLibrariesState = CacheState.IN_PROCESS; | |
| 2083 } | |
| 2084 if (_includedPartsState != CacheState.VALID) { | |
| 2085 _includedPartsState = CacheState.IN_PROCESS; | |
| 2086 } | |
| 2087 if (_directiveErrorsState != CacheState.VALID) { | |
| 2088 _directiveErrorsState = CacheState.IN_PROCESS; | |
| 2089 } | |
| 2090 } | |
| 2091 | |
| 2092 /** | |
| 2093 * Record that an in-process dependency resolution has stopped without recordi
ng results because | |
| 2094 * the results were invalidated before they could be recorded. | |
| 2095 */ | |
| 2096 void recordDependencyNotInProcess() { | |
| 2097 if (identical(_exportedLibrariesState, CacheState.IN_PROCESS)) { | |
| 2098 _exportedLibrariesState = CacheState.INVALID; | |
| 2099 } | |
| 2100 if (identical(_importedLibrariesState, CacheState.IN_PROCESS)) { | |
| 2101 _importedLibrariesState = CacheState.INVALID; | |
| 2102 } | |
| 2103 if (identical(_includedPartsState, CacheState.IN_PROCESS)) { | |
| 2104 _includedPartsState = CacheState.INVALID; | |
| 2105 } | |
| 2106 if (identical(_directiveErrorsState, CacheState.IN_PROCESS)) { | |
| 2107 _directiveErrorsState = CacheState.INVALID; | |
| 2108 } | |
| 2109 } | |
| 2110 | |
| 2111 /** | |
| 2112 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 2074 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
| 2113 * entry. This will set the state of all information, including any resolution
-based information, | 2075 * entry. This will set the state of all information, including any resolution
-based information, |
| 2114 * as being in error. | 2076 * as being in error. |
| 2115 */ | 2077 */ |
| 2116 void recordParseError() { | 2078 void recordParseError() { |
| 2117 _sourceKind = SourceKind.UNKNOWN; | 2079 _sourceKind = SourceKind.UNKNOWN; |
| 2118 _sourceKindState = CacheState.ERROR; | 2080 _sourceKindState = CacheState.ERROR; |
| 2119 _parseErrors = AnalysisError.NO_ERRORS; | 2081 _parseErrors = AnalysisError.NO_ERRORS; |
| 2120 _parseErrorsState = CacheState.ERROR; | 2082 _parseErrorsState = CacheState.ERROR; |
| 2121 _parsedUnit = null; | 2083 _parsedUnit = null; |
| 2122 _parsedUnitAccessed = false; | 2084 _parsedUnitAccessed = false; |
| 2123 _parsedUnitState = CacheState.ERROR; | 2085 _parsedUnitState = CacheState.ERROR; |
| 2124 recordDependencyError(); | 2086 _exportedLibraries = Source.EMPTY_ARRAY; |
| 2087 _exportedLibrariesState = CacheState.ERROR; |
| 2088 _importedLibraries = Source.EMPTY_ARRAY; |
| 2089 _importedLibrariesState = CacheState.ERROR; |
| 2090 _includedParts = Source.EMPTY_ARRAY; |
| 2091 _includedPartsState = CacheState.ERROR; |
| 2125 recordResolutionError(); | 2092 recordResolutionError(); |
| 2126 } | 2093 } |
| 2127 | 2094 |
| 2128 /** | 2095 /** |
| 2129 * Record that the parse-related information for the associated source is abou
t to be computed by | 2096 * Record that the parse-related information for the associated source is abou
t to be computed by |
| 2130 * the current thread. | 2097 * the current thread. |
| 2131 */ | 2098 */ |
| 2132 void recordParseInProcess() { | 2099 void recordParseInProcess() { |
| 2133 if (_sourceKindState != CacheState.VALID) { | 2100 if (_sourceKindState != CacheState.VALID) { |
| 2134 _sourceKindState = CacheState.IN_PROCESS; | 2101 _sourceKindState = CacheState.IN_PROCESS; |
| 2135 } | 2102 } |
| 2136 if (_parseErrorsState != CacheState.VALID) { | 2103 if (_parseErrorsState != CacheState.VALID) { |
| 2137 _parseErrorsState = CacheState.IN_PROCESS; | 2104 _parseErrorsState = CacheState.IN_PROCESS; |
| 2138 } | 2105 } |
| 2139 if (_parsedUnitState != CacheState.VALID) { | 2106 if (_parsedUnitState != CacheState.VALID) { |
| 2140 _parsedUnitState = CacheState.IN_PROCESS; | 2107 _parsedUnitState = CacheState.IN_PROCESS; |
| 2141 } | 2108 } |
| 2109 if (_exportedLibrariesState != CacheState.VALID) { |
| 2110 _exportedLibrariesState = CacheState.IN_PROCESS; |
| 2111 } |
| 2112 if (_importedLibrariesState != CacheState.VALID) { |
| 2113 _importedLibrariesState = CacheState.IN_PROCESS; |
| 2114 } |
| 2115 if (_includedPartsState != CacheState.VALID) { |
| 2116 _includedPartsState = CacheState.IN_PROCESS; |
| 2117 } |
| 2142 } | 2118 } |
| 2143 | 2119 |
| 2144 /** | 2120 /** |
| 2145 * Record that an in-process parse has stopped without recording results becau
se the results were | 2121 * Record that an in-process parse has stopped without recording results becau
se the results were |
| 2146 * invalidated before they could be recorded. | 2122 * invalidated before they could be recorded. |
| 2147 */ | 2123 */ |
| 2148 void recordParseNotInProcess() { | 2124 void recordParseNotInProcess() { |
| 2149 if (identical(getState(SourceEntry.LINE_INFO), CacheState.IN_PROCESS)) { | 2125 if (identical(getState(SourceEntry.LINE_INFO), CacheState.IN_PROCESS)) { |
| 2150 setState(SourceEntry.LINE_INFO, CacheState.INVALID); | 2126 setState(SourceEntry.LINE_INFO, CacheState.INVALID); |
| 2151 } | 2127 } |
| 2152 if (identical(_sourceKindState, CacheState.IN_PROCESS)) { | 2128 if (identical(_sourceKindState, CacheState.IN_PROCESS)) { |
| 2153 _sourceKindState = CacheState.INVALID; | 2129 _sourceKindState = CacheState.INVALID; |
| 2154 } | 2130 } |
| 2155 if (identical(_parseErrorsState, CacheState.IN_PROCESS)) { | 2131 if (identical(_parseErrorsState, CacheState.IN_PROCESS)) { |
| 2156 _parseErrorsState = CacheState.INVALID; | 2132 _parseErrorsState = CacheState.INVALID; |
| 2157 } | 2133 } |
| 2158 if (identical(_parsedUnitState, CacheState.IN_PROCESS)) { | 2134 if (identical(_parsedUnitState, CacheState.IN_PROCESS)) { |
| 2159 _parsedUnitState = CacheState.INVALID; | 2135 _parsedUnitState = CacheState.INVALID; |
| 2160 } | 2136 } |
| 2137 if (identical(_exportedLibrariesState, CacheState.IN_PROCESS)) { |
| 2138 _exportedLibrariesState = CacheState.INVALID; |
| 2139 } |
| 2140 if (identical(_importedLibrariesState, CacheState.IN_PROCESS)) { |
| 2141 _importedLibrariesState = CacheState.INVALID; |
| 2142 } |
| 2143 if (identical(_includedPartsState, CacheState.IN_PROCESS)) { |
| 2144 _includedPartsState = CacheState.INVALID; |
| 2145 } |
| 2161 } | 2146 } |
| 2162 | 2147 |
| 2163 /** | 2148 /** |
| 2164 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this | 2149 * Record that an error occurred while attempting to scan or parse the entry r
epresented by this |
| 2165 * entry. This will set the state of all resolution-based information as being
in error, but will | 2150 * entry. This will set the state of all resolution-based information as being
in error, but will |
| 2166 * not change the state of any parse results. | 2151 * not change the state of any parse results. |
| 2167 */ | 2152 */ |
| 2168 void recordResolutionError() { | 2153 void recordResolutionError() { |
| 2169 _element = null; | 2154 _element = null; |
| 2170 _elementState = CacheState.ERROR; | 2155 _elementState = CacheState.ERROR; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2288 * | 2273 * |
| 2289 * @param librarySource the source of the single library that the list should
contain | 2274 * @param librarySource the source of the single library that the list should
contain |
| 2290 */ | 2275 */ |
| 2291 void set containingLibrary(Source librarySource) { | 2276 void set containingLibrary(Source librarySource) { |
| 2292 _containingLibraries.clear(); | 2277 _containingLibraries.clear(); |
| 2293 _containingLibraries.add(librarySource); | 2278 _containingLibraries.add(librarySource); |
| 2294 } | 2279 } |
| 2295 | 2280 |
| 2296 @override | 2281 @override |
| 2297 void setState(DataDescriptor descriptor, CacheState state) { | 2282 void setState(DataDescriptor descriptor, CacheState state) { |
| 2298 if (identical(descriptor, DartEntry.DIRECTIVE_ERRORS)) { | 2283 if (identical(descriptor, DartEntry.ELEMENT)) { |
| 2299 _directiveErrors = updatedValue(state, _directiveErrors, null); | |
| 2300 _directiveErrorsState = state; | |
| 2301 } else if (identical(descriptor, DartEntry.ELEMENT)) { | |
| 2302 _element = updatedValue(state, _element, null); | 2284 _element = updatedValue(state, _element, null); |
| 2303 _elementState = state; | 2285 _elementState = state; |
| 2304 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 2286 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 2305 _exportedLibraries = updatedValue(state, _exportedLibraries, Source.EMPTY_
ARRAY); | 2287 _exportedLibraries = updatedValue(state, _exportedLibraries, Source.EMPTY_
ARRAY); |
| 2306 _exportedLibrariesState = state; | 2288 _exportedLibrariesState = state; |
| 2307 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 2289 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 2308 _importedLibraries = updatedValue(state, _importedLibraries, Source.EMPTY_
ARRAY); | 2290 _importedLibraries = updatedValue(state, _importedLibraries, Source.EMPTY_
ARRAY); |
| 2309 _importedLibrariesState = state; | 2291 _importedLibrariesState = state; |
| 2310 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 2292 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| 2311 _includedParts = updatedValue(state, _includedParts, Source.EMPTY_ARRAY); | 2293 _includedParts = updatedValue(state, _includedParts, Source.EMPTY_ARRAY); |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2368 state._hintsState = cacheState; | 2350 state._hintsState = cacheState; |
| 2369 } else { | 2351 } else { |
| 2370 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); | 2352 throw new IllegalArgumentException("Invalid descriptor: ${descriptor}"); |
| 2371 } | 2353 } |
| 2372 } | 2354 } |
| 2373 | 2355 |
| 2374 @override | 2356 @override |
| 2375 void setValue(DataDescriptor descriptor, Object value) { | 2357 void setValue(DataDescriptor descriptor, Object value) { |
| 2376 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { | 2358 if (identical(descriptor, DartEntry.ANGULAR_ERRORS)) { |
| 2377 _angularErrors = value == null ? AnalysisError.NO_ERRORS : (value as List<
AnalysisError>); | 2359 _angularErrors = value == null ? AnalysisError.NO_ERRORS : (value as List<
AnalysisError>); |
| 2378 } else if (identical(descriptor, DartEntry.DIRECTIVE_ERRORS)) { | |
| 2379 _directiveErrors = value as List<AnalysisError>; | |
| 2380 _directiveErrorsState = CacheState.VALID; | |
| 2381 } else if (identical(descriptor, DartEntry.ELEMENT)) { | 2360 } else if (identical(descriptor, DartEntry.ELEMENT)) { |
| 2382 _element = value as LibraryElement; | 2361 _element = value as LibraryElement; |
| 2383 _elementState = CacheState.VALID; | 2362 _elementState = CacheState.VALID; |
| 2384 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { | 2363 } else if (identical(descriptor, DartEntry.EXPORTED_LIBRARIES)) { |
| 2385 _exportedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S
ource>); | 2364 _exportedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S
ource>); |
| 2386 _exportedLibrariesState = CacheState.VALID; | 2365 _exportedLibrariesState = CacheState.VALID; |
| 2387 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { | 2366 } else if (identical(descriptor, DartEntry.IMPORTED_LIBRARIES)) { |
| 2388 _importedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S
ource>); | 2367 _importedLibraries = value == null ? Source.EMPTY_ARRAY : (value as List<S
ource>); |
| 2389 _importedLibrariesState = CacheState.VALID; | 2368 _importedLibrariesState = CacheState.VALID; |
| 2390 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { | 2369 } else if (identical(descriptor, DartEntry.INCLUDED_PARTS)) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2460 _parsedUnit = other._parsedUnit; | 2439 _parsedUnit = other._parsedUnit; |
| 2461 _parsedUnitAccessed = other._parsedUnitAccessed; | 2440 _parsedUnitAccessed = other._parsedUnitAccessed; |
| 2462 _parseErrorsState = other._parseErrorsState; | 2441 _parseErrorsState = other._parseErrorsState; |
| 2463 _parseErrors = other._parseErrors; | 2442 _parseErrors = other._parseErrors; |
| 2464 _includedPartsState = other._includedPartsState; | 2443 _includedPartsState = other._includedPartsState; |
| 2465 _includedParts = other._includedParts; | 2444 _includedParts = other._includedParts; |
| 2466 _exportedLibrariesState = other._exportedLibrariesState; | 2445 _exportedLibrariesState = other._exportedLibrariesState; |
| 2467 _exportedLibraries = other._exportedLibraries; | 2446 _exportedLibraries = other._exportedLibraries; |
| 2468 _importedLibrariesState = other._importedLibrariesState; | 2447 _importedLibrariesState = other._importedLibrariesState; |
| 2469 _importedLibraries = other._importedLibraries; | 2448 _importedLibraries = other._importedLibraries; |
| 2470 _directiveErrorsState = other._directiveErrorsState; | |
| 2471 _directiveErrors = other._directiveErrors; | |
| 2472 _containingLibraries = new List<Source>.from(other._containingLibraries); | 2449 _containingLibraries = new List<Source>.from(other._containingLibraries); |
| 2473 _resolutionState.copyFrom(other._resolutionState); | 2450 _resolutionState.copyFrom(other._resolutionState); |
| 2474 _elementState = other._elementState; | 2451 _elementState = other._elementState; |
| 2475 _element = other._element; | 2452 _element = other._element; |
| 2476 _publicNamespaceState = other._publicNamespaceState; | 2453 _publicNamespaceState = other._publicNamespaceState; |
| 2477 _publicNamespace = other._publicNamespace; | 2454 _publicNamespace = other._publicNamespace; |
| 2478 _clientServerState = other._clientServerState; | 2455 _clientServerState = other._clientServerState; |
| 2479 _launchableState = other._launchableState; | 2456 _launchableState = other._launchableState; |
| 2480 _bitmask = other._bitmask; | 2457 _bitmask = other._bitmask; |
| 2481 _angularErrors = other._angularErrors; | 2458 _angularErrors = other._angularErrors; |
| 2482 } | 2459 } |
| 2483 | 2460 |
| 2484 @override | 2461 @override |
| 2485 bool get hasErrorState => super.hasErrorState || identical(_scanErrorsState, C
acheState.ERROR) || identical(_tokenStreamState, CacheState.ERROR) || identical(
_sourceKindState, CacheState.ERROR) || identical(_parsedUnitState, CacheState.ER
ROR) || identical(_parseErrorsState, CacheState.ERROR) || identical(_importedLib
rariesState, CacheState.ERROR) || identical(_exportedLibrariesState, CacheState.
ERROR) || identical(_includedPartsState, CacheState.ERROR) || identical(_directi
veErrorsState, CacheState.ERROR) || identical(_elementState, CacheState.ERROR) |
| identical(_publicNamespaceState, CacheState.ERROR) || identical(_clientServerS
tate, CacheState.ERROR) || identical(_launchableState, CacheState.ERROR) || _res
olutionState.hasErrorState; | 2462 bool get hasErrorState => super.hasErrorState || identical(_scanErrorsState, C
acheState.ERROR) || identical(_tokenStreamState, CacheState.ERROR) || identical(
_sourceKindState, CacheState.ERROR) || identical(_parsedUnitState, CacheState.ER
ROR) || identical(_parseErrorsState, CacheState.ERROR) || identical(_importedLib
rariesState, CacheState.ERROR) || identical(_exportedLibrariesState, CacheState.
ERROR) || identical(_includedPartsState, CacheState.ERROR) || identical(_element
State, CacheState.ERROR) || identical(_publicNamespaceState, CacheState.ERROR) |
| identical(_clientServerState, CacheState.ERROR) || identical(_launchableState,
CacheState.ERROR) || _resolutionState.hasErrorState; |
| 2486 | 2463 |
| 2487 @override | 2464 @override |
| 2488 void writeOn(JavaStringBuilder builder) { | 2465 void writeOn(JavaStringBuilder builder) { |
| 2489 builder.append("Dart: "); | 2466 builder.append("Dart: "); |
| 2490 super.writeOn(builder); | 2467 super.writeOn(builder); |
| 2491 builder.append("; tokenStream = "); | 2468 builder.append("; tokenStream = "); |
| 2492 builder.append(_tokenStreamState); | 2469 builder.append(_tokenStreamState); |
| 2493 builder.append("; scanErrors = "); | 2470 builder.append("; scanErrors = "); |
| 2494 builder.append(_scanErrorsState); | 2471 builder.append(_scanErrorsState); |
| 2495 builder.append("; sourceKind = "); | 2472 builder.append("; sourceKind = "); |
| 2496 builder.append(_sourceKindState); | 2473 builder.append(_sourceKindState); |
| 2497 builder.append("; parsedUnit = "); | 2474 builder.append("; parsedUnit = "); |
| 2498 builder.append(_parsedUnitState); | 2475 builder.append(_parsedUnitState); |
| 2499 builder.append(" ("); | 2476 builder.append(" ("); |
| 2500 builder.append(_parsedUnitAccessed ? "T" : "F"); | 2477 builder.append(_parsedUnitAccessed ? "T" : "F"); |
| 2501 builder.append("); parseErrors = "); | 2478 builder.append("); parseErrors = "); |
| 2502 builder.append(_parseErrorsState); | 2479 builder.append(_parseErrorsState); |
| 2503 builder.append("; exportedLibraries = "); | 2480 builder.append("; exportedLibraries = "); |
| 2504 builder.append(_exportedLibrariesState); | 2481 builder.append(_exportedLibrariesState); |
| 2505 builder.append("; importedLibraries = "); | 2482 builder.append("; importedLibraries = "); |
| 2506 builder.append(_importedLibrariesState); | 2483 builder.append(_importedLibrariesState); |
| 2507 builder.append("; includedParts = "); | 2484 builder.append("; includedParts = "); |
| 2508 builder.append(_includedPartsState); | 2485 builder.append(_includedPartsState); |
| 2509 builder.append("; directiveErrors = "); | |
| 2510 builder.append(_directiveErrorsState); | |
| 2511 builder.append("; element = "); | 2486 builder.append("; element = "); |
| 2512 builder.append(_elementState); | 2487 builder.append(_elementState); |
| 2513 builder.append("; publicNamespace = "); | 2488 builder.append("; publicNamespace = "); |
| 2514 builder.append(_publicNamespaceState); | 2489 builder.append(_publicNamespaceState); |
| 2515 builder.append("; clientServer = "); | 2490 builder.append("; clientServer = "); |
| 2516 builder.append(_clientServerState); | 2491 builder.append(_clientServerState); |
| 2517 builder.append("; launchable = "); | 2492 builder.append("; launchable = "); |
| 2518 builder.append(_launchableState); | 2493 builder.append(_launchableState); |
| 2519 // builder.append("; angularElements = "); | 2494 // builder.append("; angularElements = "); |
| 2520 _resolutionState.writeOn(builder); | 2495 _resolutionState.writeOn(builder); |
| 2521 } | 2496 } |
| 2522 | 2497 |
| 2523 /** | 2498 /** |
| 2524 * Invalidate all of the resolution information associated with the compilatio
n unit. | 2499 * Invalidate all of the resolution information associated with the compilatio
n unit. |
| 2525 */ | 2500 */ |
| 2526 void _discardCachedResolutionInformation() { | 2501 void _discardCachedResolutionInformation() { |
| 2527 _element = null; | 2502 _element = null; |
| 2528 _elementState = CacheState.INVALID; | 2503 _elementState = CacheState.INVALID; |
| 2529 _includedParts = Source.EMPTY_ARRAY; | |
| 2530 _includedPartsState = CacheState.INVALID; | |
| 2531 _exportedLibraries = Source.EMPTY_ARRAY; | |
| 2532 _exportedLibrariesState = CacheState.INVALID; | |
| 2533 _importedLibraries = Source.EMPTY_ARRAY; | |
| 2534 _importedLibrariesState = CacheState.INVALID; | |
| 2535 _directiveErrors = AnalysisError.NO_ERRORS; | |
| 2536 _directiveErrorsState = CacheState.INVALID; | |
| 2537 _bitmask = 0; | 2504 _bitmask = 0; |
| 2538 _clientServerState = CacheState.INVALID; | 2505 _clientServerState = CacheState.INVALID; |
| 2539 _launchableState = CacheState.INVALID; | 2506 _launchableState = CacheState.INVALID; |
| 2540 _publicNamespace = null; | 2507 _publicNamespace = null; |
| 2541 _publicNamespaceState = CacheState.INVALID; | 2508 _publicNamespaceState = CacheState.INVALID; |
| 2542 _resolutionState.invalidateAllResolutionInformation(); | 2509 _resolutionState.invalidateAllResolutionInformation(); |
| 2543 } | 2510 } |
| 2544 | 2511 |
| 2545 /** | 2512 /** |
| 2546 * Return a resolution state for the specified library, creating one as necess
ary. | 2513 * Return a resolution state for the specified library, creating one as necess
ary. |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3661 if (identical(state, CacheState.ERROR)) { | 3628 if (identical(state, CacheState.ERROR)) { |
| 3662 AnalysisException exception = dartEntry.exception; | 3629 AnalysisException exception = dartEntry.exception; |
| 3663 if (exception != null) { | 3630 if (exception != null) { |
| 3664 _exceptions.add(exception); | 3631 _exceptions.add(exception); |
| 3665 } | 3632 } |
| 3666 } | 3633 } |
| 3667 } | 3634 } |
| 3668 } | 3635 } |
| 3669 | 3636 |
| 3670 class AnalysisContentStatisticsImpl_CacheRowImpl implements AnalysisContentStati
stics_CacheRow { | 3637 class AnalysisContentStatisticsImpl_CacheRowImpl implements AnalysisContentStati
stics_CacheRow { |
| 3671 final String name; | 3638 String name; |
| 3672 | 3639 |
| 3673 int _errorCount = 0; | 3640 int _errorCount = 0; |
| 3674 | 3641 |
| 3675 int _flushedCount = 0; | 3642 int _flushedCount = 0; |
| 3676 | 3643 |
| 3677 int _inProcessCount = 0; | 3644 int _inProcessCount = 0; |
| 3678 | 3645 |
| 3679 int _invalidCount = 0; | 3646 int _invalidCount = 0; |
| 3680 | 3647 |
| 3681 int _validCount = 0; | 3648 int _validCount = 0; |
| 3682 | 3649 |
| 3683 AnalysisContentStatisticsImpl_CacheRowImpl(this.name); | 3650 AnalysisContentStatisticsImpl_CacheRowImpl(String name) { |
| 3651 this.name = name; |
| 3652 } |
| 3684 | 3653 |
| 3685 @override | 3654 @override |
| 3686 bool operator ==(Object obj) => obj is AnalysisContentStatisticsImpl_CacheRowI
mpl && obj.name == name; | 3655 bool operator ==(Object obj) => obj is AnalysisContentStatisticsImpl_CacheRowI
mpl && obj.name == name; |
| 3687 | 3656 |
| 3688 @override | 3657 @override |
| 3689 int get errorCount => _errorCount; | 3658 int get errorCount => _errorCount; |
| 3690 | 3659 |
| 3691 @override | 3660 @override |
| 3692 int get flushedCount => _flushedCount; | 3661 int get flushedCount => _flushedCount; |
| 3693 | 3662 |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3958 try { | 3927 try { |
| 3959 return _getHtmlResolutionData2(source, htmlEntry, HtmlEntry.RESOLUTION_E
RRORS); | 3928 return _getHtmlResolutionData2(source, htmlEntry, HtmlEntry.RESOLUTION_E
RRORS); |
| 3960 } on ObsoleteSourceAnalysisException catch (exception) { | 3929 } on ObsoleteSourceAnalysisException catch (exception) { |
| 3961 AnalysisEngine.instance.logger.logInformation2("Could not compute errors
", exception); | 3930 AnalysisEngine.instance.logger.logInformation2("Could not compute errors
", exception); |
| 3962 } | 3931 } |
| 3963 } | 3932 } |
| 3964 return AnalysisError.NO_ERRORS; | 3933 return AnalysisError.NO_ERRORS; |
| 3965 } | 3934 } |
| 3966 | 3935 |
| 3967 @override | 3936 @override |
| 3968 List<Source> computeExportedLibraries(Source source) => _getDartDependencyData
2(source, DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY); | 3937 List<Source> computeExportedLibraries(Source source) => _getDartParseData2(sou
rce, DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY); |
| 3969 | 3938 |
| 3970 @override | 3939 @override |
| 3971 HtmlElement computeHtmlElement(Source source) => _getHtmlResolutionData(source
, HtmlEntry.ELEMENT, null); | 3940 HtmlElement computeHtmlElement(Source source) => _getHtmlResolutionData(source
, HtmlEntry.ELEMENT, null); |
| 3972 | 3941 |
| 3973 @override | 3942 @override |
| 3974 List<Source> computeImportedLibraries(Source source) => _getDartDependencyData
2(source, DartEntry.IMPORTED_LIBRARIES, Source.EMPTY_ARRAY); | 3943 List<Source> computeImportedLibraries(Source source) => _getDartParseData2(sou
rce, DartEntry.IMPORTED_LIBRARIES, Source.EMPTY_ARRAY); |
| 3975 | 3944 |
| 3976 @override | 3945 @override |
| 3977 SourceKind computeKindOf(Source source) { | 3946 SourceKind computeKindOf(Source source) { |
| 3978 SourceEntry sourceEntry = _getReadableSourceEntry(source); | 3947 SourceEntry sourceEntry = _getReadableSourceEntry(source); |
| 3979 if (sourceEntry == null) { | 3948 if (sourceEntry == null) { |
| 3980 return SourceKind.UNKNOWN; | 3949 return SourceKind.UNKNOWN; |
| 3981 } else if (sourceEntry is DartEntry) { | 3950 } else if (sourceEntry is DartEntry) { |
| 3982 try { | 3951 try { |
| 3983 return _getDartParseData(source, sourceEntry, DartEntry.SOURCE_KIND); | 3952 return _getDartParseData(source, sourceEntry, DartEntry.SOURCE_KIND); |
| 3984 } on AnalysisException catch (exception) { | 3953 } on AnalysisException catch (exception) { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 4012 if (dartEntry == null) { | 3981 if (dartEntry == null) { |
| 4013 throw new AnalysisException.con1("computeResolvableCompilationUnit for non
-Dart: ${source.fullName}"); | 3982 throw new AnalysisException.con1("computeResolvableCompilationUnit for non
-Dart: ${source.fullName}"); |
| 4014 } | 3983 } |
| 4015 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); | 3984 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); |
| 4016 DartEntryImpl dartCopy = dartEntry.writableCopy; | 3985 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 4017 CompilationUnit unit = dartCopy.resolvableCompilationUnit; | 3986 CompilationUnit unit = dartCopy.resolvableCompilationUnit; |
| 4018 if (unit == null) { | 3987 if (unit == null) { |
| 4019 throw new AnalysisException.con2("Internal error: computeResolvableCompila
tionUnit could not parse ${source.fullName}", dartEntry.exception); | 3988 throw new AnalysisException.con2("Internal error: computeResolvableCompila
tionUnit could not parse ${source.fullName}", dartEntry.exception); |
| 4020 } | 3989 } |
| 4021 _cache.put(source, dartCopy); | 3990 _cache.put(source, dartCopy); |
| 4022 return new ResolvableCompilationUnit(dartCopy.modificationTime, unit); | 3991 return new ResolvableCompilationUnit.con1(dartCopy.modificationTime, unit); |
| 4023 } | 3992 } |
| 4024 | 3993 |
| 4025 @override | 3994 @override |
| 4026 void dispose() { | 3995 void dispose() { |
| 4027 _disposed = true; | 3996 _disposed = true; |
| 4028 } | 3997 } |
| 4029 | 3998 |
| 4030 @override | 3999 @override |
| 4031 bool exists(Source source) { | 4000 bool exists(Source source) { |
| 4032 if (source == null) { | 4001 if (source == null) { |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4285 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { | 4254 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { |
| 4286 DartEntryImpl dartCopy = _getReadableDartEntry(source).writableCopy; | 4255 DartEntryImpl dartCopy = _getReadableDartEntry(source).writableCopy; |
| 4287 dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace); | 4256 dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace); |
| 4288 _cache.put(source, dartCopy); | 4257 _cache.put(source, dartCopy); |
| 4289 } | 4258 } |
| 4290 } | 4259 } |
| 4291 return namespace; | 4260 return namespace; |
| 4292 } | 4261 } |
| 4293 | 4262 |
| 4294 @override | 4263 @override |
| 4295 Namespace getPublicNamespace2(Source source) { | |
| 4296 // TODO(brianwilkerson) Rename this to not start with 'get'. Note that this
is not part of the | |
| 4297 // API of the interface. | |
| 4298 DartEntry dartEntry = _getReadableDartEntry(source); | |
| 4299 if (dartEntry == null) { | |
| 4300 return null; | |
| 4301 } | |
| 4302 Namespace namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE); | |
| 4303 if (namespace == null) { | |
| 4304 LibraryElement library = computeLibraryElement(source); | |
| 4305 if (library == null) { | |
| 4306 return null; | |
| 4307 } | |
| 4308 NamespaceBuilder builder = new NamespaceBuilder(); | |
| 4309 namespace = builder.createPublicNamespaceForLibrary(library); | |
| 4310 dartEntry = _getReadableDartEntry(source); | |
| 4311 if (dartEntry == null) { | |
| 4312 throw new AnalysisException.con1("A Dart file became a non-Dart file: ${
source.fullName}"); | |
| 4313 } | |
| 4314 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { | |
| 4315 DartEntryImpl dartCopy = _getReadableDartEntry(source).writableCopy; | |
| 4316 dartCopy.setValue(DartEntry.PUBLIC_NAMESPACE, namespace); | |
| 4317 _cache.put(source, dartCopy); | |
| 4318 } | |
| 4319 } | |
| 4320 return namespace; | |
| 4321 } | |
| 4322 | |
| 4323 @override | |
| 4324 List<Source> get refactoringUnsafeSources { | 4264 List<Source> get refactoringUnsafeSources { |
| 4325 List<Source> sources = new List<Source>(); | 4265 List<Source> sources = new List<Source>(); |
| 4326 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { | 4266 for (MapEntry<Source, SourceEntry> entry in _cache.entrySet()) { |
| 4327 SourceEntry sourceEntry = entry.getValue(); | 4267 SourceEntry sourceEntry = entry.getValue(); |
| 4328 if (sourceEntry is DartEntry) { | 4268 if (sourceEntry is DartEntry) { |
| 4329 if (!sourceEntry.isRefactoringSafe) { | 4269 if (!sourceEntry.isRefactoringSafe) { |
| 4330 sources.add(entry.getKey()); | 4270 sources.add(entry.getKey()); |
| 4331 } | 4271 } |
| 4332 } | 4272 } |
| 4333 } | 4273 } |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4862 // The source has changed without the context being notified. Simulate
notification. | 4802 // The source has changed without the context being notified. Simulate
notification. |
| 4863 _sourceChanged(source); | 4803 _sourceChanged(source); |
| 4864 allTimesMatch = false; | 4804 allTimesMatch = false; |
| 4865 } | 4805 } |
| 4866 } | 4806 } |
| 4867 } | 4807 } |
| 4868 return allTimesMatch; | 4808 return allTimesMatch; |
| 4869 } | 4809 } |
| 4870 | 4810 |
| 4871 /** | 4811 /** |
| 4872 * Given a source for a Dart file, return a cache entry in which the state of
the data represented | |
| 4873 * by the given descriptor is either [CacheState#VALID] or [CacheState#ERROR].
This | |
| 4874 * method assumes that the data can be produced by resolving the directives in
the source if they | |
| 4875 * are not already cached. | |
| 4876 * | |
| 4877 * <b>Note:</b> This method cannot be used in an async environment | |
| 4878 * | |
| 4879 * @param source the source representing the Dart file | |
| 4880 * @param dartEntry the cache entry associated with the Dart file | |
| 4881 * @param descriptor the descriptor representing the data to be returned | |
| 4882 * @return a cache entry containing the required data | |
| 4883 * @throws AnalysisException if data could not be returned because the source
could not be | |
| 4884 * resolved | |
| 4885 */ | |
| 4886 DartEntry _cacheDartDependencyData(Source source, DartEntry dartEntry, DataDes
criptor descriptor) { | |
| 4887 // | |
| 4888 // Check to see whether we already have the information being requested. | |
| 4889 // | |
| 4890 CacheState state = dartEntry.getState(descriptor); | |
| 4891 while (state != CacheState.ERROR && state != CacheState.VALID) { | |
| 4892 // | |
| 4893 // If not, compute the information. Unless the modification date of the so
urce continues to | |
| 4894 // change, this loop will eventually terminate. | |
| 4895 // | |
| 4896 dartEntry = _cacheDartParseData(source, dartEntry, DartEntry.PARSED_UNIT); | |
| 4897 CompilationUnit unit = dartEntry.anyParsedCompilationUnit; | |
| 4898 if (unit == null) { | |
| 4899 throw new AnalysisException.con2("Could not cache Dart dependency data:
no parse unit", dartEntry.exception); | |
| 4900 } | |
| 4901 dartEntry = new ResolveDartDependenciesTask(this, source, dartEntry.modifi
cationTime, unit).perform(_resultRecorder) as DartEntry; | |
| 4902 state = dartEntry.getState(descriptor); | |
| 4903 } | |
| 4904 return dartEntry; | |
| 4905 } | |
| 4906 | |
| 4907 /** | |
| 4908 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which | 4812 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which |
| 4909 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or | 4813 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or |
| 4910 * [CacheState#ERROR]. This method assumes that the data can be produced by ge
nerating hints | 4814 * [CacheState#ERROR]. This method assumes that the data can be produced by ge
nerating hints |
| 4911 * for the library if the data is not already cached. | 4815 * for the library if the data is not already cached. |
| 4912 * | 4816 * |
| 4913 * @param unitSource the source representing the Dart file | 4817 * @param unitSource the source representing the Dart file |
| 4914 * @param librarySource the source representing the library containing the Dar
t file | 4818 * @param librarySource the source representing the library containing the Dar
t file |
| 4915 * @param dartEntry the cache entry associated with the Dart file | 4819 * @param dartEntry the cache entry associated with the Dart file |
| 4916 * @param descriptor the descriptor representing the data to be returned | 4820 * @param descriptor the descriptor representing the data to be returned |
| 4917 * @return a cache entry containing the required data | 4821 * @return a cache entry containing the required data |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4956 // | 4860 // |
| 4957 // Check to see whether we already have the information being requested. | 4861 // Check to see whether we already have the information being requested. |
| 4958 // | 4862 // |
| 4959 CacheState state = dartEntry.getState(descriptor); | 4863 CacheState state = dartEntry.getState(descriptor); |
| 4960 while (state != CacheState.ERROR && state != CacheState.VALID) { | 4864 while (state != CacheState.ERROR && state != CacheState.VALID) { |
| 4961 // | 4865 // |
| 4962 // If not, compute the information. Unless the modification date of the so
urce continues to | 4866 // If not, compute the information. Unless the modification date of the so
urce continues to |
| 4963 // change, this loop will eventually terminate. | 4867 // change, this loop will eventually terminate. |
| 4964 // | 4868 // |
| 4965 dartEntry = _cacheDartScanData(source, dartEntry, DartEntry.TOKEN_STREAM); | 4869 dartEntry = _cacheDartScanData(source, dartEntry, DartEntry.TOKEN_STREAM); |
| 4966 dartEntry = new ParseDartTask(this, source, dartEntry.modificationTime, da
rtEntry.getValue(DartEntry.TOKEN_STREAM)).perform(_resultRecorder) as DartEntry; | 4870 dartEntry = new ParseDartTask(this, source, dartEntry.modificationTime, da
rtEntry.getValue(DartEntry.TOKEN_STREAM), dartEntry.getValue(SourceEntry.LINE_IN
FO)).perform(_resultRecorder) as DartEntry; |
| 4967 state = dartEntry.getState(descriptor); | 4871 state = dartEntry.getState(descriptor); |
| 4968 } | 4872 } |
| 4969 return dartEntry; | 4873 return dartEntry; |
| 4970 } | 4874 } |
| 4971 | 4875 |
| 4972 /** | 4876 /** |
| 4973 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which | 4877 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which |
| 4974 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or | 4878 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or |
| 4975 * [CacheState#ERROR]. This method assumes that the data can be produced by re
solving the | 4879 * [CacheState#ERROR]. This method assumes that the data can be produced by re
solving the |
| 4976 * source in the context of the library if it is not already cached. | 4880 * source in the context of the library if it is not already cached. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5038 } | 4942 } |
| 5039 return dartEntry; | 4943 return dartEntry; |
| 5040 } | 4944 } |
| 5041 | 4945 |
| 5042 /** | 4946 /** |
| 5043 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which | 4947 * Given a source for a Dart file and the library that contains it, return a c
ache entry in which |
| 5044 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or | 4948 * the state of the data represented by the given descriptor is either [CacheS
tate#VALID] or |
| 5045 * [CacheState#ERROR]. This method assumes that the data can be produced by ve
rifying the | 4949 * [CacheState#ERROR]. This method assumes that the data can be produced by ve
rifying the |
| 5046 * source in the given library if the data is not already cached. | 4950 * source in the given library if the data is not already cached. |
| 5047 * | 4951 * |
| 4952 * <b>Note:</b> This method cannot be used in an async environment. |
| 4953 * |
| 5048 * @param unitSource the source representing the Dart file | 4954 * @param unitSource the source representing the Dart file |
| 5049 * @param librarySource the source representing the library containing the Dar
t file | 4955 * @param librarySource the source representing the library containing the Dar
t file |
| 5050 * @param dartEntry the cache entry associated with the Dart file | 4956 * @param dartEntry the cache entry associated with the Dart file |
| 5051 * @param descriptor the descriptor representing the data to be returned | 4957 * @param descriptor the descriptor representing the data to be returned |
| 5052 * @return a cache entry containing the required data | 4958 * @return a cache entry containing the required data |
| 5053 * @throws AnalysisException if data could not be returned because the source
could not be parsed | 4959 * @throws AnalysisException if data could not be returned because the source
could not be parsed |
| 5054 */ | 4960 */ |
| 5055 DartEntry _cacheDartVerificationData(Source unitSource, Source librarySource,
DartEntry dartEntry, DataDescriptor descriptor) { | 4961 DartEntry _cacheDartVerificationData(Source unitSource, Source librarySource,
DartEntry dartEntry, DataDescriptor descriptor) { |
| 5056 // | 4962 // |
| 5057 // Check to see whether we already have the information being requested. | 4963 // Check to see whether we already have the information being requested. |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5190 * Create a [GetContentTask] for the given source, marking the content as bein
g in-process. | 5096 * Create a [GetContentTask] for the given source, marking the content as bein
g in-process. |
| 5191 * | 5097 * |
| 5192 * @param source the source whose content is to be accessed | 5098 * @param source the source whose content is to be accessed |
| 5193 * @param sourceEntry the entry for the source | 5099 * @param sourceEntry the entry for the source |
| 5194 * @return task data representing the created task | 5100 * @return task data representing the created task |
| 5195 */ | 5101 */ |
| 5196 AnalysisContextImpl_TaskData _createGetContentTask(Source source, SourceEntry
sourceEntry) { | 5102 AnalysisContextImpl_TaskData _createGetContentTask(Source source, SourceEntry
sourceEntry) { |
| 5197 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; | 5103 SourceEntryImpl sourceCopy = sourceEntry.writableCopy; |
| 5198 sourceCopy.setState(SourceEntry.CONTENT, CacheState.IN_PROCESS); | 5104 sourceCopy.setState(SourceEntry.CONTENT, CacheState.IN_PROCESS); |
| 5199 _cache.put(source, sourceCopy); | 5105 _cache.put(source, sourceCopy); |
| 5200 return new AnalysisContextImpl_TaskData(new GetContentTask(this, source), fa
lse, null); | 5106 return new AnalysisContextImpl_TaskData(new GetContentTask(this, source), fa
lse); |
| 5201 } | 5107 } |
| 5202 | 5108 |
| 5203 /** | 5109 /** |
| 5204 * Create a [ParseDartTask] for the given source, marking the parse errors as
being | 5110 * Create a [ParseDartTask] for the given source, marking the parse errors as
being |
| 5205 * in-process. | 5111 * in-process. |
| 5206 * | 5112 * |
| 5207 * @param source the source whose content is to be parsed | 5113 * @param source the source whose content is to be parsed |
| 5208 * @param dartEntry the entry for the source | 5114 * @param dartEntry the entry for the source |
| 5209 * @return task data representing the created task | 5115 * @return task data representing the created task |
| 5210 */ | 5116 */ |
| 5211 AnalysisContextImpl_TaskData _createParseDartTask(Source source, DartEntry dar
tEntry) { | 5117 AnalysisContextImpl_TaskData _createParseDartTask(Source source, DartEntry dar
tEntry) { |
| 5212 if (dartEntry.getState(DartEntry.TOKEN_STREAM) != CacheState.VALID) { | 5118 if (dartEntry.getState(DartEntry.TOKEN_STREAM) != CacheState.VALID || dartEn
try.getState(SourceEntry.LINE_INFO) != CacheState.VALID) { |
| 5213 return _createScanDartTask(source, dartEntry); | 5119 return _createScanDartTask(source, dartEntry); |
| 5214 } | 5120 } |
| 5215 Token tokenStream = dartEntry.getValue(DartEntry.TOKEN_STREAM); | 5121 Token tokenStream = dartEntry.getValue(DartEntry.TOKEN_STREAM); |
| 5216 DartEntryImpl dartCopy = dartEntry.writableCopy; | 5122 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 5217 dartCopy.setState(DartEntry.TOKEN_STREAM, CacheState.FLUSHED); | 5123 dartCopy.setState(DartEntry.TOKEN_STREAM, CacheState.FLUSHED); |
| 5218 dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS); | 5124 dartCopy.setState(DartEntry.PARSE_ERRORS, CacheState.IN_PROCESS); |
| 5219 _cache.put(source, dartCopy); | 5125 _cache.put(source, dartCopy); |
| 5220 return new AnalysisContextImpl_TaskData(new ParseDartTask(this, source, dart
Copy.modificationTime, tokenStream), false, null); | 5126 return new AnalysisContextImpl_TaskData(new ParseDartTask(this, source, dart
Copy.modificationTime, tokenStream, dartEntry.getValue(SourceEntry.LINE_INFO)),
false); |
| 5221 } | 5127 } |
| 5222 | 5128 |
| 5223 /** | 5129 /** |
| 5224 * Create a [ParseHtmlTask] for the given source, marking the parse errors as
being | 5130 * Create a [ParseHtmlTask] for the given source, marking the parse errors as
being |
| 5225 * in-process. | 5131 * in-process. |
| 5226 * | 5132 * |
| 5227 * @param source the source whose content is to be parsed | 5133 * @param source the source whose content is to be parsed |
| 5228 * @param htmlEntry the entry for the source | 5134 * @param htmlEntry the entry for the source |
| 5229 * @return task data representing the created task | 5135 * @return task data representing the created task |
| 5230 */ | 5136 */ |
| 5231 AnalysisContextImpl_TaskData _createParseHtmlTask(Source source, HtmlEntry htm
lEntry) { | 5137 AnalysisContextImpl_TaskData _createParseHtmlTask(Source source, HtmlEntry htm
lEntry) { |
| 5232 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { | 5138 if (htmlEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { |
| 5233 return _createGetContentTask(source, htmlEntry); | 5139 return _createGetContentTask(source, htmlEntry); |
| 5234 } | 5140 } |
| 5235 String content = htmlEntry.getValue(SourceEntry.CONTENT); | 5141 String content = htmlEntry.getValue(SourceEntry.CONTENT); |
| 5236 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 5142 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 5237 htmlCopy.setState(SourceEntry.CONTENT, CacheState.FLUSHED); | 5143 htmlCopy.setState(SourceEntry.CONTENT, CacheState.FLUSHED); |
| 5238 htmlCopy.setState(HtmlEntry.PARSE_ERRORS, CacheState.IN_PROCESS); | 5144 htmlCopy.setState(HtmlEntry.PARSE_ERRORS, CacheState.IN_PROCESS); |
| 5239 _cache.put(source, htmlCopy); | 5145 _cache.put(source, htmlCopy); |
| 5240 return new AnalysisContextImpl_TaskData(new ParseHtmlTask(this, source, html
Copy.modificationTime, content), false, null); | 5146 return new AnalysisContextImpl_TaskData(new ParseHtmlTask(this, source, html
Copy.modificationTime, content), false); |
| 5241 } | 5147 } |
| 5242 | 5148 |
| 5243 /** | 5149 /** |
| 5244 * Create a [ResolveDartDependenciesTask] for the given source, marking the ex
ported | 5150 * Create a [ResolveAngularComponentTemplateTask] for the given source, markin
g the angular |
| 5245 * libraries as being in-process. | 5151 * errors as being in-process. |
| 5246 * | 5152 * |
| 5247 * @param source the source whose content is to be used to resolve dependencie
s | 5153 * @param source the source whose content is to be resolved |
| 5248 * @param dartEntry the entry for the source | 5154 * @param htmlEntry the entry for the source |
| 5249 * @return task data representing the created task | 5155 * @return task data representing the created task |
| 5250 */ | 5156 */ |
| 5251 AnalysisContextImpl_TaskData _createResolveDartDependenciesTask(Source source,
DartEntry dartEntry) { | 5157 AnalysisContextImpl_TaskData _createResolveAngularComponentTemplateTask(Source
source, HtmlEntry htmlEntry) { |
| 5252 CompilationUnit unit = dartEntry.anyParsedCompilationUnit; | 5158 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { |
| 5253 if (unit == null) { | 5159 return _createResolveHtmlTask(source, htmlEntry); |
| 5254 return _createParseDartTask(source, dartEntry); | |
| 5255 } | 5160 } |
| 5256 DartEntryImpl dartCopy = dartEntry.writableCopy; | 5161 AngularApplication application = htmlEntry.getValue(HtmlEntry.ANGULAR_APPLIC
ATION); |
| 5257 dartCopy.setState(DartEntry.EXPORTED_LIBRARIES, CacheState.IN_PROCESS); | 5162 AngularComponentElement component = htmlEntry.getValue(HtmlEntry.ANGULAR_COM
PONENT); |
| 5258 _cache.put(source, dartCopy); | 5163 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 5259 return new AnalysisContextImpl_TaskData(new ResolveDartDependenciesTask(this
, source, dartCopy.modificationTime, unit), false, null); | 5164 htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.IN_PROCESS); |
| 5165 _cache.put(source, htmlCopy); |
| 5166 return new AnalysisContextImpl_TaskData(new ResolveAngularComponentTemplateT
ask(this, source, htmlCopy.modificationTime, htmlCopy.getValue(HtmlEntry.RESOLVE
D_UNIT), component, application), false); |
| 5260 } | 5167 } |
| 5261 | 5168 |
| 5262 /** | 5169 /** |
| 5170 * Create a [ResolveAngularEntryHtmlTask] for the given source, marking the an
gular entry as |
| 5171 * being in-process. |
| 5172 * |
| 5173 * @param source the source whose content is to be resolved |
| 5174 * @param htmlEntry the entry for the source |
| 5175 * @return task data representing the created task |
| 5176 */ |
| 5177 AnalysisContextImpl_TaskData _createResolveAngularEntryHtmlTask(Source source,
HtmlEntry htmlEntry) { |
| 5178 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { |
| 5179 return _createResolveHtmlTask(source, htmlEntry); |
| 5180 } |
| 5181 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 5182 htmlCopy.setState(HtmlEntry.ANGULAR_ENTRY, CacheState.IN_PROCESS); |
| 5183 _cache.put(source, htmlCopy); |
| 5184 return new AnalysisContextImpl_TaskData(new ResolveAngularEntryHtmlTask(this
, source, htmlCopy.modificationTime, htmlCopy.getValue(HtmlEntry.RESOLVED_UNIT))
, false); |
| 5185 } |
| 5186 |
| 5187 /** |
| 5263 * Create a [ResolveHtmlTask] for the given source, marking the resolved unit
as being | 5188 * Create a [ResolveHtmlTask] for the given source, marking the resolved unit
as being |
| 5264 * in-process. | 5189 * in-process. |
| 5265 * | 5190 * |
| 5266 * @param source the source whose content is to be resolved | 5191 * @param source the source whose content is to be resolved |
| 5267 * @param htmlEntry the entry for the source | 5192 * @param htmlEntry the entry for the source |
| 5268 * @return task data representing the created task | 5193 * @return task data representing the created task |
| 5269 */ | 5194 */ |
| 5270 AnalysisContextImpl_TaskData _createResolveHtmlTask(Source source, HtmlEntry h
tmlEntry) { | 5195 AnalysisContextImpl_TaskData _createResolveHtmlTask(Source source, HtmlEntry h
tmlEntry) { |
| 5271 if (htmlEntry.getState(HtmlEntry.PARSED_UNIT) != CacheState.VALID) { | 5196 if (htmlEntry.getState(HtmlEntry.PARSED_UNIT) != CacheState.VALID) { |
| 5272 return _createParseHtmlTask(source, htmlEntry); | 5197 return _createParseHtmlTask(source, htmlEntry); |
| 5273 } | 5198 } |
| 5274 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | 5199 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; |
| 5275 htmlCopy.setState(HtmlEntry.RESOLVED_UNIT, CacheState.IN_PROCESS); | 5200 htmlCopy.setState(HtmlEntry.RESOLVED_UNIT, CacheState.IN_PROCESS); |
| 5276 _cache.put(source, htmlCopy); | 5201 _cache.put(source, htmlCopy); |
| 5277 return new AnalysisContextImpl_TaskData(new ResolveHtmlTask(this, source, ht
mlCopy.modificationTime, htmlCopy.getValue(HtmlEntry.PARSED_UNIT)), false, null)
; | 5202 return new AnalysisContextImpl_TaskData(new ResolveHtmlTask(this, source, ht
mlCopy.modificationTime, htmlCopy.getValue(HtmlEntry.PARSED_UNIT)), false); |
| 5278 } | 5203 } |
| 5279 | 5204 |
| 5280 /** | 5205 /** |
| 5281 * Create a [ScanDartTask] for the given source, marking the scan errors as be
ing | 5206 * Create a [ScanDartTask] for the given source, marking the scan errors as be
ing |
| 5282 * in-process. | 5207 * in-process. |
| 5283 * | 5208 * |
| 5284 * @param source the source whose content is to be scanned | 5209 * @param source the source whose content is to be scanned |
| 5285 * @param dartEntry the entry for the source | 5210 * @param dartEntry the entry for the source |
| 5286 * @return task data representing the created task | 5211 * @return task data representing the created task |
| 5287 */ | 5212 */ |
| 5288 AnalysisContextImpl_TaskData _createScanDartTask(Source source, DartEntry dart
Entry) { | 5213 AnalysisContextImpl_TaskData _createScanDartTask(Source source, DartEntry dart
Entry) { |
| 5289 if (dartEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { | 5214 if (dartEntry.getState(SourceEntry.CONTENT) != CacheState.VALID) { |
| 5290 return _createGetContentTask(source, dartEntry); | 5215 return _createGetContentTask(source, dartEntry); |
| 5291 } | 5216 } |
| 5292 String content = dartEntry.getValue(SourceEntry.CONTENT); | 5217 String content = dartEntry.getValue(SourceEntry.CONTENT); |
| 5293 DartEntryImpl dartCopy = dartEntry.writableCopy; | 5218 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 5294 dartCopy.setState(SourceEntry.CONTENT, CacheState.FLUSHED); | 5219 dartCopy.setState(SourceEntry.CONTENT, CacheState.FLUSHED); |
| 5295 dartCopy.setState(DartEntry.SCAN_ERRORS, CacheState.IN_PROCESS); | 5220 dartCopy.setState(DartEntry.SCAN_ERRORS, CacheState.IN_PROCESS); |
| 5296 _cache.put(source, dartCopy); | 5221 _cache.put(source, dartCopy); |
| 5297 return new AnalysisContextImpl_TaskData(new ScanDartTask(this, source, dartC
opy.modificationTime, content), false, null); | 5222 return new AnalysisContextImpl_TaskData(new ScanDartTask(this, source, dartC
opy.modificationTime, content), false); |
| 5298 } | 5223 } |
| 5299 | 5224 |
| 5300 /** | 5225 /** |
| 5301 * Create a source information object suitable for the given source. Return th
e source information | 5226 * Create a source information object suitable for the given source. Return th
e source information |
| 5302 * object that was created, or `null` if the source should not be tracked by t
his context. | 5227 * object that was created, or `null` if the source should not be tracked by t
his context. |
| 5303 * | 5228 * |
| 5304 * @param source the source for which an information object is being created | 5229 * @param source the source for which an information object is being created |
| 5305 * @return the source information object that was created | 5230 * @return the source information object that was created |
| 5306 */ | 5231 */ |
| 5307 SourceEntry _createSourceEntry(Source source) { | 5232 SourceEntry _createSourceEntry(Source source) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5342 return null; | 5267 return null; |
| 5343 } | 5268 } |
| 5344 return ChangeNoticeImpl.EMPTY_ARRAY; | 5269 return ChangeNoticeImpl.EMPTY_ARRAY; |
| 5345 } | 5270 } |
| 5346 List<ChangeNotice> notices = new List.from(_pendingNotices.values); | 5271 List<ChangeNotice> notices = new List.from(_pendingNotices.values); |
| 5347 _pendingNotices.clear(); | 5272 _pendingNotices.clear(); |
| 5348 return notices; | 5273 return notices; |
| 5349 } | 5274 } |
| 5350 | 5275 |
| 5351 /** | 5276 /** |
| 5352 * Given a source for a Dart file, return the data represented by the given de
scriptor that is | |
| 5353 * associated with that source. This method assumes that the data can be produ
ced by resolving the | |
| 5354 * directives in the source if they are not already cached. | |
| 5355 * | |
| 5356 * @param source the source representing the Dart file | |
| 5357 * @param dartEntry the cache entry associated with the Dart file | |
| 5358 * @param descriptor the descriptor representing the data to be returned | |
| 5359 * @return the requested data about the given source | |
| 5360 * @throws AnalysisException if data could not be returned because the source
could not be parsed | |
| 5361 */ | |
| 5362 Object _getDartDependencyData(Source source, DartEntry dartEntry, DataDescript
or descriptor) { | |
| 5363 dartEntry = _cacheDartDependencyData(source, dartEntry, descriptor); | |
| 5364 return dartEntry.getValue(descriptor); | |
| 5365 } | |
| 5366 | |
| 5367 /** | |
| 5368 * Given a source for a Dart file, return the data represented by the given de
scriptor that is | |
| 5369 * associated with that source, or the given default value if the source is no
t a Dart file. This | |
| 5370 * method assumes that the data can be produced by resolving the directives in
the source if they | |
| 5371 * are not already cached. | |
| 5372 * | |
| 5373 * @param source the source representing the Dart file | |
| 5374 * @param descriptor the descriptor representing the data to be returned | |
| 5375 * @param defaultValue the value to be returned if the source is not a Dart fi
le | |
| 5376 * @return the requested data about the given source | |
| 5377 * @throws AnalysisException if data could not be returned because the source
could not be parsed | |
| 5378 */ | |
| 5379 Object _getDartDependencyData2(Source source, DataDescriptor descriptor, Objec
t defaultValue) { | |
| 5380 DartEntry dartEntry = _getReadableDartEntry(source); | |
| 5381 if (dartEntry == null) { | |
| 5382 return defaultValue; | |
| 5383 } | |
| 5384 try { | |
| 5385 return _getDartDependencyData(source, dartEntry, descriptor); | |
| 5386 } on ObsoleteSourceAnalysisException catch (exception) { | |
| 5387 AnalysisEngine.instance.logger.logInformation2("Could not compute ${descri
ptor.toString()}", exception); | |
| 5388 return defaultValue; | |
| 5389 } | |
| 5390 } | |
| 5391 | |
| 5392 /** | |
| 5393 * Given a source for a Dart file and the library that contains it, return the
data represented by | 5277 * Given a source for a Dart file and the library that contains it, return the
data represented by |
| 5394 * the given descriptor that is associated with that source. This method assum
es that the data can | 5278 * the given descriptor that is associated with that source. This method assum
es that the data can |
| 5395 * be produced by generating hints for the library if it is not already cached
. | 5279 * be produced by generating hints for the library if it is not already cached
. |
| 5396 * | 5280 * |
| 5397 * @param unitSource the source representing the Dart file | 5281 * @param unitSource the source representing the Dart file |
| 5398 * @param librarySource the source representing the library containing the Dar
t file | 5282 * @param librarySource the source representing the library containing the Dar
t file |
| 5399 * @param dartEntry the entry representing the Dart file | 5283 * @param dartEntry the entry representing the Dart file |
| 5400 * @param descriptor the descriptor representing the data to be returned | 5284 * @param descriptor the descriptor representing the data to be returned |
| 5401 * @return the requested data about the given source | 5285 * @return the requested data about the given source |
| 5402 * @throws AnalysisException if data could not be returned because the source
could not be | 5286 * @throws AnalysisException if data could not be returned because the source
could not be |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5551 AnalysisEngine.instance.logger.logInformation2("Could not compute ${descri
ptor.toString()}", exception); | 5435 AnalysisEngine.instance.logger.logInformation2("Could not compute ${descri
ptor.toString()}", exception); |
| 5552 return defaultValue; | 5436 return defaultValue; |
| 5553 } | 5437 } |
| 5554 } | 5438 } |
| 5555 | 5439 |
| 5556 /** | 5440 /** |
| 5557 * Given a source for a Dart file and the library that contains it, return the
data represented by | 5441 * Given a source for a Dart file and the library that contains it, return the
data represented by |
| 5558 * the given descriptor that is associated with that source. This method assum
es that the data can | 5442 * the given descriptor that is associated with that source. This method assum
es that the data can |
| 5559 * be produced by verifying the source within the given library if it is not a
lready cached. | 5443 * be produced by verifying the source within the given library if it is not a
lready cached. |
| 5560 * | 5444 * |
| 5445 * <b>Note:</b> This method cannot be used in an async environment. |
| 5446 * |
| 5561 * @param unitSource the source representing the Dart file | 5447 * @param unitSource the source representing the Dart file |
| 5562 * @param librarySource the source representing the library containing the Dar
t file | 5448 * @param librarySource the source representing the library containing the Dar
t file |
| 5563 * @param dartEntry the entry representing the Dart file | 5449 * @param dartEntry the entry representing the Dart file |
| 5564 * @param descriptor the descriptor representing the data to be returned | 5450 * @param descriptor the descriptor representing the data to be returned |
| 5565 * @return the requested data about the given source | 5451 * @return the requested data about the given source |
| 5566 * @throws AnalysisException if data could not be returned because the source
could not be | 5452 * @throws AnalysisException if data could not be returned because the source
could not be |
| 5567 * resolved | 5453 * resolved |
| 5568 */ | 5454 */ |
| 5569 Object _getDartVerificationData(Source unitSource, Source librarySource, DartE
ntry dartEntry, DataDescriptor descriptor) { | 5455 Object _getDartVerificationData(Source unitSource, Source librarySource, DartE
ntry dartEntry, DataDescriptor descriptor) { |
| 5570 dartEntry = _cacheDartVerificationData(unitSource, librarySource, dartEntry,
descriptor); | 5456 dartEntry = _cacheDartVerificationData(unitSource, librarySource, dartEntry,
descriptor); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5662 // | 5548 // |
| 5663 if (_incrementalAnalysisCache != null && _incrementalAnalysisCache.hasWork)
{ | 5549 if (_incrementalAnalysisCache != null && _incrementalAnalysisCache.hasWork)
{ |
| 5664 AnalysisTask task = new IncrementalAnalysisTask(this, _incrementalAnalysis
Cache); | 5550 AnalysisTask task = new IncrementalAnalysisTask(this, _incrementalAnalysis
Cache); |
| 5665 _incrementalAnalysisCache = null; | 5551 _incrementalAnalysisCache = null; |
| 5666 return task; | 5552 return task; |
| 5667 } | 5553 } |
| 5668 // | 5554 // |
| 5669 // Look for a priority source that needs to be analyzed. | 5555 // Look for a priority source that needs to be analyzed. |
| 5670 // | 5556 // |
| 5671 for (Source source in _priorityOrder) { | 5557 for (Source source in _priorityOrder) { |
| 5672 AnalysisContextImpl_TaskData taskData = _getNextNondependentAnalysisTask(s
ource, true, hintsEnabled, sdkErrorsEnabled); | 5558 AnalysisContextImpl_TaskData taskData = _getNextAnalysisTaskForSource(sour
ce, _cache.get(source), true, hintsEnabled, sdkErrorsEnabled); |
| 5673 AnalysisTask task = taskData.task; | 5559 AnalysisTask task = taskData.task; |
| 5674 if (task != null) { | 5560 if (task != null) { |
| 5675 return task; | 5561 return task; |
| 5676 } else if (taskData.isBlocked) { | 5562 } else if (taskData.isBlocked) { |
| 5677 hasBlockedTask = true; | 5563 hasBlockedTask = true; |
| 5678 } | 5564 } |
| 5679 } | 5565 } |
| 5680 // | 5566 // |
| 5681 // Look for a non-priority source that needs to be analyzed. | 5567 // Look for a non-priority source that needs to be analyzed. |
| 5682 // | 5568 // |
| 5683 Source source = _workManager.nextSource; | 5569 List<Source> sourcesToRemove = new List<Source>(); |
| 5684 while (source != null) { | 5570 WorkManager_WorkIterator sources = _workManager.iterator(); |
| 5685 AnalysisContextImpl_TaskData taskData = _getNextNondependentAnalysisTask(s
ource, false, hintsEnabled, sdkErrorsEnabled); | 5571 while (sources.hasNext) { |
| 5572 Source source = sources.next(); |
| 5573 AnalysisContextImpl_TaskData taskData = _getNextAnalysisTaskForSource(sour
ce, _cache.get(source), false, hintsEnabled, sdkErrorsEnabled); |
| 5686 AnalysisTask task = taskData.task; | 5574 AnalysisTask task = taskData.task; |
| 5687 if (task != null) { | 5575 if (task != null) { |
| 5688 return task; | 5576 return task; |
| 5689 } else if (taskData.isBlocked) { | 5577 } else if (taskData.isBlocked) { |
| 5690 hasBlockedTask = true; | 5578 hasBlockedTask = true; |
| 5691 } else { | 5579 } else { |
| 5692 _workManager.remove(source); | 5580 sourcesToRemove.add(source); |
| 5693 } | 5581 } |
| 5694 source = _workManager.nextSource; | 5582 } |
| 5583 int count = sourcesToRemove.length; |
| 5584 for (int i = 0; i < count; i++) { |
| 5585 _workManager.remove(sourcesToRemove[i]); |
| 5695 } | 5586 } |
| 5696 // // | 5587 // // |
| 5697 // // Look for a non-priority source that needs to be analyzed and was
missed by the loop above. | 5588 // // Look for a non-priority source that needs to be analyzed and was
missed by the loop above. |
| 5698 // // | 5589 // // |
| 5699 // for (Map.Entry<Source, SourceEntry> entry : cache.entrySet()) { | 5590 // for (Map.Entry<Source, SourceEntry> entry : cache.entrySet()) { |
| 5700 // source = entry.getKey(); | 5591 // source = entry.getKey(); |
| 5701 // TaskData taskData = getNextAnalysisTaskForSource(source, entry.get
Value(), false, hintsEnabled); | 5592 // TaskData taskData = getNextAnalysisTaskForSource(source, entry.get
Value(), false, hintsEnabled); |
| 5702 // AnalysisTask task = taskData.getTask(); | 5593 // AnalysisTask task = taskData.getTask(); |
| 5703 // if (task != null) { | 5594 // if (task != null) { |
| 5704 // System.out.println("Failed to analyze " + source.getFullName()); | 5595 // System.out.println("Failed to analyze " + source.getFullName()); |
| 5705 // return task; | 5596 // return task; |
| 5706 // } | 5597 // } |
| 5707 // } | 5598 // } |
| 5708 if (hasBlockedTask) { | 5599 if (hasBlockedTask) { |
| 5600 // All of the analysis work is blocked waiting for an asynchronous task to
complete. |
| 5709 return WaitForAsyncTask.instance; | 5601 return WaitForAsyncTask.instance; |
| 5710 } | 5602 } |
| 5711 return null; | 5603 return null; |
| 5712 } | 5604 } |
| 5713 | 5605 |
| 5714 /** | 5606 /** |
| 5715 * Look at the given source to see whether a task needs to be performed relate
d to it. Return the | 5607 * Look at the given source to see whether a task needs to be performed relate
d to it. Return the |
| 5716 * task that should be performed, or `null` if there is no more work to be don
e for the | 5608 * task that should be performed, or `null` if there is no more work to be don
e for the |
| 5717 * source. | 5609 * source. |
| 5718 * | 5610 * |
| 5719 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. | 5611 * <b>Note:</b> This method must only be invoked while we are synchronized on
[cacheLock]. |
| 5720 * | 5612 * |
| 5721 * @param source the source to be checked | 5613 * @param source the source to be checked |
| 5722 * @param sourceEntry the cache entry associated with the source | 5614 * @param sourceEntry the cache entry associated with the source |
| 5723 * @param isPriority `true` if the source is a priority source | 5615 * @param isPriority `true` if the source is a priority source |
| 5724 * @param hintsEnabled `true` if hints are currently enabled | 5616 * @param hintsEnabled `true` if hints are currently enabled |
| 5725 * @param sdkErrorsEnabled `true` if errors, warnings and hints should be gene
rated for | 5617 * @param sdkErrorsEnabled `true` if errors, warnings and hints should be gene
rated for |
| 5726 * sources in the SDK | 5618 * sources in the SDK |
| 5727 * @return the next task that needs to be performed for the given source | 5619 * @return the next task that needs to be performed for the given source |
| 5728 */ | 5620 */ |
| 5729 AnalysisContextImpl_TaskData _getNextAnalysisTaskForSource(Source source, Sour
ceEntry sourceEntry, bool isPriority, bool hintsEnabled, bool sdkErrorsEnabled)
{ | 5621 AnalysisContextImpl_TaskData _getNextAnalysisTaskForSource(Source source, Sour
ceEntry sourceEntry, bool isPriority, bool hintsEnabled, bool sdkErrorsEnabled)
{ |
| 5730 if (sourceEntry == null) { | 5622 if (sourceEntry == null) { |
| 5731 return new AnalysisContextImpl_TaskData(null, false, null); | 5623 return new AnalysisContextImpl_TaskData(null, false); |
| 5732 } | 5624 } |
| 5733 CacheState contentState = sourceEntry.getState(SourceEntry.CONTENT); | 5625 CacheState contentState = sourceEntry.getState(SourceEntry.CONTENT); |
| 5734 if (identical(contentState, CacheState.INVALID)) { | 5626 if (identical(contentState, CacheState.INVALID)) { |
| 5735 return _createGetContentTask(source, sourceEntry); | 5627 return _createGetContentTask(source, sourceEntry); |
| 5736 } else if (identical(contentState, CacheState.IN_PROCESS)) { | 5628 } else if (identical(contentState, CacheState.IN_PROCESS)) { |
| 5737 // We are already in the process of getting the content. There's nothing e
lse we can do with | 5629 // We are already in the process of getting the content. There's nothing e
lse we can do with |
| 5738 // this source until that's complete. | 5630 // this source until that's complete. |
| 5739 return new AnalysisContextImpl_TaskData(null, true, null); | 5631 return new AnalysisContextImpl_TaskData(null, true); |
| 5632 } else if (identical(contentState, CacheState.ERROR)) { |
| 5633 // We have done all of the analysis we can for this source because we cann
ot get its content. |
| 5634 return new AnalysisContextImpl_TaskData(null, false); |
| 5740 } | 5635 } |
| 5741 if (sourceEntry is DartEntry) { | 5636 if (sourceEntry is DartEntry) { |
| 5742 DartEntry dartEntry = sourceEntry; | 5637 DartEntry dartEntry = sourceEntry; |
| 5743 CacheState scanErrorsState = dartEntry.getState(DartEntry.SCAN_ERRORS); | 5638 CacheState scanErrorsState = dartEntry.getState(DartEntry.SCAN_ERRORS); |
| 5744 if (identical(scanErrorsState, CacheState.INVALID) || (isPriority && ident
ical(scanErrorsState, CacheState.FLUSHED))) { | 5639 if (identical(scanErrorsState, CacheState.INVALID) || (isPriority && ident
ical(scanErrorsState, CacheState.FLUSHED))) { |
| 5745 return _createScanDartTask(source, dartEntry); | 5640 return _createScanDartTask(source, dartEntry); |
| 5746 } | 5641 } |
| 5747 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS); | 5642 CacheState parseErrorsState = dartEntry.getState(DartEntry.PARSE_ERRORS); |
| 5748 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { | 5643 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { |
| 5749 return _createParseDartTask(source, dartEntry); | 5644 return _createParseDartTask(source, dartEntry); |
| 5750 } | 5645 } |
| 5751 if (isPriority && parseErrorsState != CacheState.ERROR) { | 5646 if (isPriority && parseErrorsState != CacheState.ERROR) { |
| 5752 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit; | 5647 CompilationUnit parseUnit = dartEntry.anyParsedCompilationUnit; |
| 5753 if (parseUnit == null) { | 5648 if (parseUnit == null) { |
| 5754 return _createParseDartTask(source, dartEntry); | 5649 return _createParseDartTask(source, dartEntry); |
| 5755 } | 5650 } |
| 5756 } | 5651 } |
| 5757 CacheState exportState = dartEntry.getState(DartEntry.EXPORTED_LIBRARIES); | |
| 5758 if (identical(exportState, CacheState.INVALID) || (isPriority && identical
(exportState, CacheState.FLUSHED))) { | |
| 5759 return _createResolveDartDependenciesTask(source, dartEntry); | |
| 5760 } | |
| 5761 List<Source> librariesContaining = dartEntry.getValue(DartEntry.CONTAINING
_LIBRARIES); | 5652 List<Source> librariesContaining = dartEntry.getValue(DartEntry.CONTAINING
_LIBRARIES); |
| 5762 for (Source librarySource in librariesContaining) { | 5653 for (Source librarySource in librariesContaining) { |
| 5763 SourceEntry libraryEntry = _cache.get(librarySource); | 5654 SourceEntry libraryEntry = _cache.get(librarySource); |
| 5764 if (libraryEntry is DartEntry) { | 5655 if (libraryEntry is DartEntry) { |
| 5765 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT); | 5656 CacheState elementState = libraryEntry.getState(DartEntry.ELEMENT); |
| 5766 if (identical(elementState, CacheState.INVALID) || (isPriority && iden
tical(elementState, CacheState.FLUSHED))) { | 5657 if (identical(elementState, CacheState.INVALID) || (isPriority && iden
tical(elementState, CacheState.FLUSHED))) { |
| 5767 DartEntryImpl libraryCopy = libraryEntry.writableCopy; | 5658 DartEntryImpl libraryCopy = libraryEntry.writableCopy; |
| 5768 libraryCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS); | 5659 libraryCopy.setState(DartEntry.ELEMENT, CacheState.IN_PROCESS); |
| 5769 _cache.put(librarySource, libraryCopy); | 5660 _cache.put(librarySource, libraryCopy); |
| 5770 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryTask(t
his, source, librarySource), false, null); | 5661 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryTask(t
his, source, librarySource), false); |
| 5771 } | 5662 } |
| 5772 CacheState resolvedUnitState = dartEntry.getStateInLibrary(DartEntry.R
ESOLVED_UNIT, librarySource); | 5663 CacheState resolvedUnitState = dartEntry.getStateInLibrary(DartEntry.R
ESOLVED_UNIT, librarySource); |
| 5773 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority &&
identical(resolvedUnitState, CacheState.FLUSHED))) { | 5664 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority &&
identical(resolvedUnitState, CacheState.FLUSHED))) { |
| 5774 // | 5665 // |
| 5775 // The commented out lines below are an optimization that doesn't qu
ite work yet. The | 5666 // The commented out lines below are an optimization that doesn't qu
ite work yet. The |
| 5776 // problem is that if the source was not resolved because it wasn't
part of any library, | 5667 // problem is that if the source was not resolved because it wasn't
part of any library, |
| 5777 // then there won't be any elements in the element model that we can
use to resolve it. | 5668 // then there won't be any elements in the element model that we can
use to resolve it. |
| 5778 // | 5669 // |
| 5779 //LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL
EMENT); | 5670 //LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL
EMENT); |
| 5780 //if (libraryElement != null) { | 5671 //if (libraryElement != null) { |
| 5781 DartEntryImpl dartCopy = dartEntry.writableCopy; | 5672 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 5782 dartCopy.setStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource, C
acheState.IN_PROCESS); | 5673 dartCopy.setStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource, C
acheState.IN_PROCESS); |
| 5783 _cache.put(source, dartCopy); | 5674 _cache.put(source, dartCopy); |
| 5784 //return new ResolveDartUnitTask(this, source, libraryElement); | 5675 //return new ResolveDartUnitTask(this, source, libraryElement); |
| 5785 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryTask(t
his, source, librarySource), false, null); | 5676 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryTask(t
his, source, librarySource), false); |
| 5786 } | 5677 } |
| 5787 if (sdkErrorsEnabled || !source.isInSystemLibrary) { | 5678 if (sdkErrorsEnabled || !source.isInSystemLibrary) { |
| 5788 CacheState verificationErrorsState = dartEntry.getStateInLibrary(Dar
tEntry.VERIFICATION_ERRORS, librarySource); | 5679 CacheState verificationErrorsState = dartEntry.getStateInLibrary(Dar
tEntry.VERIFICATION_ERRORS, librarySource); |
| 5789 if (identical(verificationErrorsState, CacheState.INVALID) || (isPri
ority && identical(verificationErrorsState, CacheState.FLUSHED))) { | 5680 if (identical(verificationErrorsState, CacheState.INVALID) || (isPri
ority && identical(verificationErrorsState, CacheState.FLUSHED))) { |
| 5790 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL
EMENT); | 5681 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL
EMENT); |
| 5791 if (libraryElement != null) { | 5682 if (libraryElement != null) { |
| 5792 DartEntryImpl dartCopy = dartEntry.writableCopy; | 5683 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 5793 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librar
ySource, CacheState.IN_PROCESS); | 5684 dartCopy.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librar
ySource, CacheState.IN_PROCESS); |
| 5794 _cache.put(source, dartCopy); | 5685 _cache.put(source, dartCopy); |
| 5795 return new AnalysisContextImpl_TaskData(new GenerateDartErrorsTa
sk(this, source, libraryElement), false, null); | 5686 return new AnalysisContextImpl_TaskData(new GenerateDartErrorsTa
sk(this, source, libraryElement), false); |
| 5796 } | 5687 } |
| 5797 } | 5688 } |
| 5798 if (hintsEnabled) { | 5689 if (hintsEnabled) { |
| 5799 CacheState hintsState = dartEntry.getStateInLibrary(DartEntry.HINT
S, librarySource); | 5690 CacheState hintsState = dartEntry.getStateInLibrary(DartEntry.HINT
S, librarySource); |
| 5800 if (identical(hintsState, CacheState.INVALID) || (isPriority && id
entical(hintsState, CacheState.FLUSHED))) { | 5691 if (identical(hintsState, CacheState.INVALID) || (isPriority && id
entical(hintsState, CacheState.FLUSHED))) { |
| 5801 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.
ELEMENT); | 5692 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.
ELEMENT); |
| 5802 if (libraryElement != null) { | 5693 if (libraryElement != null) { |
| 5803 DartEntryImpl dartCopy = dartEntry.writableCopy; | 5694 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 5804 dartCopy.setStateInLibrary(DartEntry.HINTS, librarySource, Cac
heState.IN_PROCESS); | 5695 dartCopy.setStateInLibrary(DartEntry.HINTS, librarySource, Cac
heState.IN_PROCESS); |
| 5805 _cache.put(source, dartCopy); | 5696 _cache.put(source, dartCopy); |
| 5806 return new AnalysisContextImpl_TaskData(new GenerateDartHintsT
ask(this, libraryElement), false, null); | 5697 return new AnalysisContextImpl_TaskData(new GenerateDartHintsT
ask(this, libraryElement), false); |
| 5807 } | 5698 } |
| 5808 } | 5699 } |
| 5809 } | 5700 } |
| 5810 } | 5701 } |
| 5811 } | 5702 } |
| 5812 } | 5703 } |
| 5813 } else if (sourceEntry is HtmlEntry) { | 5704 } else if (sourceEntry is HtmlEntry) { |
| 5814 HtmlEntry htmlEntry = sourceEntry; | 5705 HtmlEntry htmlEntry = sourceEntry; |
| 5815 CacheState parseErrorsState = htmlEntry.getState(HtmlEntry.PARSE_ERRORS); | 5706 CacheState parseErrorsState = htmlEntry.getState(HtmlEntry.PARSE_ERRORS); |
| 5816 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { | 5707 if (identical(parseErrorsState, CacheState.INVALID) || (isPriority && iden
tical(parseErrorsState, CacheState.FLUSHED))) { |
| 5817 return _createParseHtmlTask(source, htmlEntry); | 5708 return _createParseHtmlTask(source, htmlEntry); |
| 5818 } | 5709 } |
| 5819 if (isPriority && parseErrorsState != CacheState.ERROR) { | 5710 if (isPriority && parseErrorsState != CacheState.ERROR) { |
| 5820 ht.HtmlUnit parsedUnit = htmlEntry.anyParsedUnit; | 5711 ht.HtmlUnit parsedUnit = htmlEntry.anyParsedUnit; |
| 5821 if (parsedUnit == null) { | 5712 if (parsedUnit == null) { |
| 5822 return _createParseHtmlTask(source, htmlEntry); | 5713 return _createParseHtmlTask(source, htmlEntry); |
| 5823 } | 5714 } |
| 5824 } | 5715 } |
| 5825 CacheState resolvedUnitState = htmlEntry.getState(HtmlEntry.RESOLVED_UNIT)
; | 5716 CacheState resolvedUnitState = htmlEntry.getState(HtmlEntry.RESOLVED_UNIT)
; |
| 5826 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && ide
ntical(resolvedUnitState, CacheState.FLUSHED))) { | 5717 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && ide
ntical(resolvedUnitState, CacheState.FLUSHED))) { |
| 5827 return _createResolveHtmlTask(source, htmlEntry); | 5718 return _createResolveHtmlTask(source, htmlEntry); |
| 5828 } | 5719 } |
| 5720 // |
| 5829 // Angular support | 5721 // Angular support |
| 5722 // |
| 5830 if (_options.analyzeAngular) { | 5723 if (_options.analyzeAngular) { |
| 5831 // try to resolve as an Angular entry point | 5724 // Try to resolve the HTML as an Angular entry point. |
| 5832 CacheState angularEntryState = htmlEntry.getState(HtmlEntry.ANGULAR_ENTR
Y); | 5725 CacheState angularEntryState = htmlEntry.getState(HtmlEntry.ANGULAR_ENTR
Y); |
| 5833 if (identical(angularEntryState, CacheState.INVALID)) { | 5726 if (identical(angularEntryState, CacheState.INVALID)) { |
| 5834 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { | 5727 return _createResolveAngularEntryHtmlTask(source, htmlEntry); |
| 5835 return _createResolveHtmlTask(source, htmlEntry); | |
| 5836 } | |
| 5837 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | |
| 5838 htmlCopy.setState(HtmlEntry.ANGULAR_ENTRY, CacheState.IN_PROCESS); | |
| 5839 _cache.put(source, htmlCopy); | |
| 5840 return new AnalysisContextImpl_TaskData(new ResolveAngularEntryHtmlTas
k(this, source, htmlCopy.modificationTime, htmlCopy.getValue(HtmlEntry.RESOLVED_
UNIT)), false, null); | |
| 5841 } | 5728 } |
| 5842 // try to resolve as an Angular application part | 5729 // Try to resolve the HTML as an Angular application part. |
| 5843 CacheState angularErrorsState = htmlEntry.getState(HtmlEntry.ANGULAR_ERR
ORS); | 5730 CacheState angularErrorsState = htmlEntry.getState(HtmlEntry.ANGULAR_ERR
ORS); |
| 5844 if (identical(angularErrorsState, CacheState.INVALID)) { | 5731 if (identical(angularErrorsState, CacheState.INVALID)) { |
| 5845 if (htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) != CacheState.VALID) { | 5732 return _createResolveAngularComponentTemplateTask(source, htmlEntry); |
| 5846 return _createResolveHtmlTask(source, htmlEntry); | |
| 5847 } | |
| 5848 AngularApplication application = htmlEntry.getValue(HtmlEntry.ANGULAR_
APPLICATION); | |
| 5849 // try to resolve as an Angular template | |
| 5850 AngularComponentElement component = htmlEntry.getValue(HtmlEntry.ANGUL
AR_COMPONENT); | |
| 5851 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; | |
| 5852 htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.IN_PROCESS); | |
| 5853 _cache.put(source, htmlCopy); | |
| 5854 return new AnalysisContextImpl_TaskData(new ResolveAngularComponentTem
plateTask(this, source, htmlCopy.modificationTime, htmlCopy.getValue(HtmlEntry.R
ESOLVED_UNIT), component, application), false, null); | |
| 5855 } | 5733 } |
| 5856 } | 5734 } |
| 5857 } | 5735 } |
| 5858 return new AnalysisContextImpl_TaskData(null, false, null); | 5736 return new AnalysisContextImpl_TaskData(null, false); |
| 5859 } | |
| 5860 | |
| 5861 AnalysisContextImpl_TaskData _getNextNondependentAnalysisTask(Source source, b
ool isPriority, bool hintsEnabled, bool sdkErrorsEnabled) { | |
| 5862 AnalysisContextImpl_TaskData taskData = _getNextAnalysisTaskForSource(source
, _cache.get(source), isPriority, hintsEnabled, sdkErrorsEnabled); | |
| 5863 if (taskData.task != null || taskData.isBlocked) { | |
| 5864 return taskData; | |
| 5865 } | |
| 5866 while (taskData.dependentSource != null) { | |
| 5867 taskData = _getNextAnalysisTaskForSource(source, _cache.get(source), isPri
ority, hintsEnabled, sdkErrorsEnabled); | |
| 5868 if (taskData.task != null || taskData.isBlocked) { | |
| 5869 return taskData; | |
| 5870 } | |
| 5871 } | |
| 5872 return new AnalysisContextImpl_TaskData(null, false, null); | |
| 5873 } | 5737 } |
| 5874 | 5738 |
| 5875 /** | 5739 /** |
| 5876 * Return a change notice for the given source, creating one if one does not a
lready exist. | 5740 * Return a change notice for the given source, creating one if one does not a
lready exist. |
| 5877 * | 5741 * |
| 5878 * @param source the source for which changes are being reported | 5742 * @param source the source for which changes are being reported |
| 5879 * @return a change notice for the given source | 5743 * @return a change notice for the given source |
| 5880 */ | 5744 */ |
| 5881 ChangeNoticeImpl _getNotice(Source source) { | 5745 ChangeNoticeImpl _getNotice(Source source) { |
| 5882 ChangeNoticeImpl notice = _pendingNotices[source]; | 5746 ChangeNoticeImpl notice = _pendingNotices[source]; |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6587 int resultTime = task.modificationTime; | 6451 int resultTime = task.modificationTime; |
| 6588 if (sourceTime == resultTime) { | 6452 if (sourceTime == resultTime) { |
| 6589 if (dartEntry.modificationTime != sourceTime) { | 6453 if (dartEntry.modificationTime != sourceTime) { |
| 6590 // The source has changed without the context being notified. Simulate n
otification. | 6454 // The source has changed without the context being notified. Simulate n
otification. |
| 6591 _sourceChanged(source); | 6455 _sourceChanged(source); |
| 6592 dartEntry = _getReadableDartEntry(source); | 6456 dartEntry = _getReadableDartEntry(source); |
| 6593 if (dartEntry == null) { | 6457 if (dartEntry == null) { |
| 6594 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${source.fullName}"); | 6458 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${source.fullName}"); |
| 6595 } | 6459 } |
| 6596 } | 6460 } |
| 6461 _removeFromParts(source, dartEntry); |
| 6597 DartEntryImpl dartCopy = dartEntry.writableCopy; | 6462 DartEntryImpl dartCopy = dartEntry.writableCopy; |
| 6598 if (thrownException == null) { | 6463 if (thrownException == null) { |
| 6599 if (task.hasPartOfDirective && !task.hasLibraryDirective) { | 6464 if (task.hasPartOfDirective && !task.hasLibraryDirective) { |
| 6600 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.PART); | 6465 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.PART); |
| 6601 dartCopy.removeContainingLibrary(source); | 6466 dartCopy.removeContainingLibrary(source); |
| 6602 _workManager.add(source, SourcePriority.NORMAL_PART); | 6467 _workManager.add(source, SourcePriority.NORMAL_PART); |
| 6603 } else { | 6468 } else { |
| 6604 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); | 6469 dartCopy.setValue(DartEntry.SOURCE_KIND, SourceKind.LIBRARY); |
| 6605 dartCopy.containingLibrary = source; | 6470 dartCopy.containingLibrary = source; |
| 6606 _workManager.add(source, SourcePriority.LIBRARY); | 6471 _workManager.add(source, SourcePriority.LIBRARY); |
| 6607 } | 6472 } |
| 6473 List<Source> newParts = task.includedSources; |
| 6474 for (int i = 0; i < newParts.length; i++) { |
| 6475 Source partSource = newParts[i]; |
| 6476 DartEntry partEntry = _getReadableDartEntry(partSource); |
| 6477 if (partEntry != null && partEntry != dartEntry) { |
| 6478 DartEntryImpl partCopy = partEntry.writableCopy; |
| 6479 partCopy.addContainingLibrary(source); |
| 6480 _cache.put(partSource, partCopy); |
| 6481 } |
| 6482 } |
| 6608 dartCopy.setValue(DartEntry.PARSED_UNIT, task.compilationUnit); | 6483 dartCopy.setValue(DartEntry.PARSED_UNIT, task.compilationUnit); |
| 6609 dartCopy.setValue(DartEntry.PARSE_ERRORS, task.errors); | 6484 dartCopy.setValue(DartEntry.PARSE_ERRORS, task.errors); |
| 6485 dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, task.exportedSources); |
| 6486 dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources); |
| 6487 dartCopy.setValue(DartEntry.INCLUDED_PARTS, newParts); |
| 6610 _cache.storedAst(source); | 6488 _cache.storedAst(source); |
| 6611 ChangeNoticeImpl notice = _getNotice(source); | 6489 ChangeNoticeImpl notice = _getNotice(source); |
| 6612 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LINE_
INFO)); | 6490 notice.setErrors(dartCopy.allErrors, dartCopy.getValue(SourceEntry.LINE_
INFO)); |
| 6613 // Verify that the incrementally parsed and resolved unit in the increme
ntal cache | 6491 // Verify that the incrementally parsed and resolved unit in the increme
ntal cache |
| 6614 // is structurally equivalent to the fully parsed unit | 6492 // is structurally equivalent to the fully parsed unit |
| 6615 _incrementalAnalysisCache = IncrementalAnalysisCache.verifyStructure(_in
crementalAnalysisCache, source, task.compilationUnit); | 6493 _incrementalAnalysisCache = IncrementalAnalysisCache.verifyStructure(_in
crementalAnalysisCache, source, task.compilationUnit); |
| 6616 } else { | 6494 } else { |
| 6617 _removeFromParts(source, dartEntry); | 6495 _removeFromParts(source, dartEntry); |
| 6618 dartCopy.recordParseError(); | 6496 dartCopy.recordParseError(); |
| 6619 _cache.removedAst(source); | 6497 _cache.removedAst(source); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6901 _cache.put(source, htmlCopy); | 6779 _cache.put(source, htmlCopy); |
| 6902 htmlEntry = htmlCopy; | 6780 htmlEntry = htmlCopy; |
| 6903 } | 6781 } |
| 6904 if (thrownException != null) { | 6782 if (thrownException != null) { |
| 6905 throw thrownException; | 6783 throw thrownException; |
| 6906 } | 6784 } |
| 6907 return htmlEntry; | 6785 return htmlEntry; |
| 6908 } | 6786 } |
| 6909 | 6787 |
| 6910 /** | 6788 /** |
| 6911 * Record the results produced by performing a [ResolveDartDependenciesTask].
If the results | |
| 6912 * were computed from data that is now out-of-date, then the results will not
be recorded. | |
| 6913 * | |
| 6914 * @param task the task that was performed | |
| 6915 * @return an entry containing the computed results | |
| 6916 * @throws AnalysisException if the results could not be recorded | |
| 6917 */ | |
| 6918 DartEntry _recordResolveDartDependenciesTaskResults(ResolveDartDependenciesTas
k task) { | |
| 6919 Source source = task.source; | |
| 6920 AnalysisException thrownException = task.exception; | |
| 6921 DartEntry dartEntry = null; | |
| 6922 SourceEntry sourceEntry = _cache.get(source); | |
| 6923 if (sourceEntry == null) { | |
| 6924 throw new ObsoleteSourceAnalysisException(source); | |
| 6925 } else if (sourceEntry is! DartEntry) { | |
| 6926 // This shouldn't be possible because we should never have performed the t
ask if the source | |
| 6927 // didn't represent a Dart file, but check to be safe. | |
| 6928 throw new AnalysisException.con1("Internal error: attempting to resolve Da
rt dependencies in a non-Dart file: ${source.fullName}"); | |
| 6929 } | |
| 6930 dartEntry = sourceEntry as DartEntry; | |
| 6931 int sourceTime = getModificationStamp(source); | |
| 6932 int resultTime = task.modificationTime; | |
| 6933 if (sourceTime == resultTime) { | |
| 6934 if (dartEntry.modificationTime != sourceTime) { | |
| 6935 // The source has changed without the context being notified. Simulate n
otification. | |
| 6936 _sourceChanged(source); | |
| 6937 dartEntry = _getReadableDartEntry(source); | |
| 6938 if (dartEntry == null) { | |
| 6939 throw new AnalysisException.con1("A Dart file became a non-Dart file:
${source.fullName}"); | |
| 6940 } | |
| 6941 } | |
| 6942 _removeFromParts(source, dartEntry); | |
| 6943 DartEntryImpl dartCopy = dartEntry.writableCopy; | |
| 6944 if (thrownException == null) { | |
| 6945 List<Source> newParts = task.includedSources; | |
| 6946 for (int i = 0; i < newParts.length; i++) { | |
| 6947 Source partSource = newParts[i]; | |
| 6948 DartEntry partEntry = _getReadableDartEntry(partSource); | |
| 6949 if (partEntry != null && partEntry != dartEntry) { | |
| 6950 DartEntryImpl partCopy = partEntry.writableCopy; | |
| 6951 partCopy.addContainingLibrary(source); | |
| 6952 _cache.put(partSource, partCopy); | |
| 6953 } | |
| 6954 } | |
| 6955 dartCopy.setValue(DartEntry.EXPORTED_LIBRARIES, task.exportedSources); | |
| 6956 dartCopy.setValue(DartEntry.IMPORTED_LIBRARIES, task.importedSources); | |
| 6957 dartCopy.setValue(DartEntry.INCLUDED_PARTS, newParts); | |
| 6958 dartCopy.setValue(DartEntry.DIRECTIVE_ERRORS, task.errors); | |
| 6959 } else { | |
| 6960 dartCopy.recordDependencyError(); | |
| 6961 } | |
| 6962 dartCopy.exception = thrownException; | |
| 6963 _cache.put(source, dartCopy); | |
| 6964 dartEntry = dartCopy; | |
| 6965 } else { | |
| 6966 _logInformation2("Dependency resolution results discarded for ${_debugging
String(source)}; sourceTime = ${sourceTime}, resultTime = ${resultTime}, cacheTi
me = ${dartEntry.modificationTime}", thrownException); | |
| 6967 DartEntryImpl dartCopy = dartEntry.writableCopy; | |
| 6968 if (thrownException == null || resultTime >= 0) { | |
| 6969 // | |
| 6970 // The analysis was performed on out-of-date sources. Mark the cache so
that the sources | |
| 6971 // will be re-analyzed using the up-to-date sources. | |
| 6972 // | |
| 6973 // dartCopy.recordDependencyNotInProcess(); | |
| 6974 _removeFromParts(source, dartEntry); | |
| 6975 dartCopy.invalidateAllInformation(); | |
| 6976 dartCopy.modificationTime = sourceTime; | |
| 6977 _cache.removedAst(source); | |
| 6978 _workManager.add(source, SourcePriority.UNKNOWN); | |
| 6979 } else { | |
| 6980 // | |
| 6981 // We could not determine whether the sources were up-to-date or out-of-
date. Mark the | |
| 6982 // cache so that we won't attempt to re-analyze the sources until there'
s a good chance | |
| 6983 // that we'll be able to do so without error. | |
| 6984 // | |
| 6985 dartCopy.setState(DartEntry.EXPORTED_LIBRARIES, CacheState.ERROR); | |
| 6986 dartCopy.setState(DartEntry.IMPORTED_LIBRARIES, CacheState.ERROR); | |
| 6987 dartCopy.setState(DartEntry.INCLUDED_PARTS, CacheState.ERROR); | |
| 6988 } | |
| 6989 dartCopy.exception = thrownException; | |
| 6990 _cache.put(source, dartCopy); | |
| 6991 dartEntry = dartCopy; | |
| 6992 } | |
| 6993 if (thrownException != null) { | |
| 6994 throw thrownException; | |
| 6995 } | |
| 6996 return dartEntry; | |
| 6997 } | |
| 6998 | |
| 6999 /** | |
| 7000 * Record the results produced by performing a [ResolveDartUnitTask]. If the r
esults were | 6789 * Record the results produced by performing a [ResolveDartUnitTask]. If the r
esults were |
| 7001 * computed from data that is now out-of-date, then the results will not be re
corded. | 6790 * computed from data that is now out-of-date, then the results will not be re
corded. |
| 7002 * | 6791 * |
| 7003 * @param task the task that was performed | 6792 * @param task the task that was performed |
| 7004 * @return an entry containing the computed results | 6793 * @return an entry containing the computed results |
| 7005 * @throws AnalysisException if the results could not be recorded | 6794 * @throws AnalysisException if the results could not be recorded |
| 7006 */ | 6795 */ |
| 7007 DartEntry _recordResolveDartUnitTaskResults(ResolveDartUnitTask task) { | 6796 DartEntry _recordResolveDartUnitTaskResults(ResolveDartUnitTask task) { |
| 7008 Source unitSource = task.source; | 6797 Source unitSource = task.source; |
| 7009 Source librarySource = task.librarySource; | 6798 Source librarySource = task.librarySource; |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7472 @override | 7261 @override |
| 7473 HtmlEntry visitParseHtmlTask(ParseHtmlTask task) => AnalysisContextImpl_this._
recordParseHtmlTaskResults(task); | 7262 HtmlEntry visitParseHtmlTask(ParseHtmlTask task) => AnalysisContextImpl_this._
recordParseHtmlTaskResults(task); |
| 7474 | 7263 |
| 7475 @override | 7264 @override |
| 7476 HtmlEntry visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemp
lateTask task) => AnalysisContextImpl_this._recordResolveAngularComponentTemplat
eTaskResults(task); | 7265 HtmlEntry visitResolveAngularComponentTemplateTask(ResolveAngularComponentTemp
lateTask task) => AnalysisContextImpl_this._recordResolveAngularComponentTemplat
eTaskResults(task); |
| 7477 | 7266 |
| 7478 @override | 7267 @override |
| 7479 HtmlEntry visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task) =
> AnalysisContextImpl_this._recordResolveAngularEntryHtmlTaskResults(task); | 7268 HtmlEntry visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task) =
> AnalysisContextImpl_this._recordResolveAngularEntryHtmlTaskResults(task); |
| 7480 | 7269 |
| 7481 @override | 7270 @override |
| 7482 DartEntry visitResolveDartDependenciesTask(ResolveDartDependenciesTask task) =
> AnalysisContextImpl_this._recordResolveDartDependenciesTaskResults(task); | |
| 7483 | |
| 7484 @override | |
| 7485 DartEntry visitResolveDartLibraryTask(ResolveDartLibraryTask task) => Analysis
ContextImpl_this.recordResolveDartLibraryTaskResults(task); | 7271 DartEntry visitResolveDartLibraryTask(ResolveDartLibraryTask task) => Analysis
ContextImpl_this.recordResolveDartLibraryTaskResults(task); |
| 7486 | 7272 |
| 7487 @override | 7273 @override |
| 7488 DartEntry visitResolveDartUnitTask(ResolveDartUnitTask task) => AnalysisContex
tImpl_this._recordResolveDartUnitTaskResults(task); | 7274 DartEntry visitResolveDartUnitTask(ResolveDartUnitTask task) => AnalysisContex
tImpl_this._recordResolveDartUnitTaskResults(task); |
| 7489 | 7275 |
| 7490 @override | 7276 @override |
| 7491 HtmlEntry visitResolveHtmlTask(ResolveHtmlTask task) => AnalysisContextImpl_th
is._recordResolveHtmlTaskResults(task); | 7277 HtmlEntry visitResolveHtmlTask(ResolveHtmlTask task) => AnalysisContextImpl_th
is._recordResolveHtmlTaskResults(task); |
| 7492 | 7278 |
| 7493 @override | 7279 @override |
| 7494 DartEntry visitScanDartTask(ScanDartTask task) => AnalysisContextImpl_this._re
cordScanDartTaskResults(task); | 7280 DartEntry visitScanDartTask(ScanDartTask task) => AnalysisContextImpl_this._re
cordScanDartTaskResults(task); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7526 * be executed to further analyze the associated source. | 7312 * be executed to further analyze the associated source. |
| 7527 * * Otherwise, if [isBlocked] returns `true`, then there is no work that can be | 7313 * * Otherwise, if [isBlocked] returns `true`, then there is no work that can be |
| 7528 * done, but analysis for the associated source is not complete. | 7314 * done, but analysis for the associated source is not complete. |
| 7529 * * Otherwise, [getDependentSource] should return a source that needs to be ana
lyzed | 7315 * * Otherwise, [getDependentSource] should return a source that needs to be ana
lyzed |
| 7530 * before the analysis of the associated source can be completed. | 7316 * before the analysis of the associated source can be completed. |
| 7531 */ | 7317 */ |
| 7532 class AnalysisContextImpl_TaskData { | 7318 class AnalysisContextImpl_TaskData { |
| 7533 /** | 7319 /** |
| 7534 * The task that is to be performed. | 7320 * The task that is to be performed. |
| 7535 */ | 7321 */ |
| 7536 final AnalysisTask task; | 7322 AnalysisTask task; |
| 7537 | 7323 |
| 7538 /** | 7324 /** |
| 7539 * A flag indicating whether the associated source is blocked waiting for its
contents to be | 7325 * A flag indicating whether the associated source is blocked waiting for its
contents to be |
| 7540 * loaded. | 7326 * loaded. |
| 7541 */ | 7327 */ |
| 7542 bool _blocked = false; | 7328 bool _blocked = false; |
| 7543 | 7329 |
| 7544 /** | 7330 /** |
| 7545 * The source that needs to be analyzed before further progress can be made on
the associated | |
| 7546 * source. | |
| 7547 */ | |
| 7548 final Source dependentSource; | |
| 7549 | |
| 7550 /** | |
| 7551 * Initialize a newly created data holder. | 7331 * Initialize a newly created data holder. |
| 7552 * | 7332 * |
| 7553 * @param task the task that is to be performed | 7333 * @param task the task that is to be performed |
| 7554 * @param blocked `true` if the associated source is blocked waiting for its c
ontents to | 7334 * @param blocked `true` if the associated source is blocked waiting for its c
ontents to |
| 7555 * be loaded | 7335 * be loaded |
| 7556 * @param dependentSource t | |
| 7557 */ | 7336 */ |
| 7558 AnalysisContextImpl_TaskData(this.task, bool blocked, this.dependentSource) { | 7337 AnalysisContextImpl_TaskData(AnalysisTask task, bool blocked) { |
| 7338 this.task = task; |
| 7559 this._blocked = blocked; | 7339 this._blocked = blocked; |
| 7560 } | 7340 } |
| 7561 | 7341 |
| 7562 /** | 7342 /** |
| 7563 * Return `true` if the associated source is blocked waiting for its contents
to be | 7343 * Return `true` if the associated source is blocked waiting for its contents
to be |
| 7564 * loaded. | 7344 * loaded. |
| 7565 * | 7345 * |
| 7566 * @return `true` if the associated source is blocked waiting for its contents
to be | 7346 * @return `true` if the associated source is blocked waiting for its contents
to be |
| 7567 * loaded | 7347 * loaded |
| 7568 */ | 7348 */ |
| 7569 bool get isBlocked => _blocked; | 7349 bool get isBlocked => _blocked; |
| 7570 } | 7350 } |
| 7571 | 7351 |
| 7572 /** | 7352 /** |
| 7573 * Instances of the class `AnalysisErrorInfoImpl` represent the analysis errors
and line info | 7353 * Instances of the class `AnalysisErrorInfoImpl` represent the analysis errors
and line info |
| 7574 * associated with a source. | 7354 * associated with a source. |
| 7575 */ | 7355 */ |
| 7576 class AnalysisErrorInfoImpl implements AnalysisErrorInfo { | 7356 class AnalysisErrorInfoImpl implements AnalysisErrorInfo { |
| 7577 /** | 7357 /** |
| 7578 * The analysis errors associated with a source, or `null` if there are no err
ors. | 7358 * The analysis errors associated with a source, or `null` if there are no err
ors. |
| 7579 */ | 7359 */ |
| 7580 final List<AnalysisError> errors; | 7360 List<AnalysisError> errors; |
| 7581 | 7361 |
| 7582 /** | 7362 /** |
| 7583 * The line information associated with the errors, or `null` if there are no
errors. | 7363 * The line information associated with the errors, or `null` if there are no
errors. |
| 7584 */ | 7364 */ |
| 7585 final LineInfo lineInfo; | 7365 LineInfo lineInfo; |
| 7586 | 7366 |
| 7587 /** | 7367 /** |
| 7588 * Initialize an newly created error info with the errors and line information | 7368 * Initialize an newly created error info with the errors and line information |
| 7589 * | 7369 * |
| 7590 * @param errors the errors as a result of analysis | 7370 * @param errors the errors as a result of analysis |
| 7591 * @param lineinfo the line info for the errors | 7371 * @param lineinfo the line info for the errors |
| 7592 */ | 7372 */ |
| 7593 AnalysisErrorInfoImpl(this.errors, this.lineInfo); | 7373 AnalysisErrorInfoImpl(List<AnalysisError> errors, LineInfo lineInfo) { |
| 7374 this.errors = errors; |
| 7375 this.lineInfo = lineInfo; |
| 7376 } |
| 7594 } | 7377 } |
| 7595 | 7378 |
| 7596 /** | 7379 /** |
| 7597 * Instances of the class `AnalysisOptions` represent a set of analysis options
used to | 7380 * Instances of the class `AnalysisOptions` represent a set of analysis options
used to |
| 7598 * control the behavior of an analysis context. | 7381 * control the behavior of an analysis context. |
| 7599 */ | 7382 */ |
| 7600 class AnalysisOptionsImpl implements AnalysisOptions { | 7383 class AnalysisOptionsImpl implements AnalysisOptions { |
| 7601 /** | 7384 /** |
| 7602 * The maximum number of sources for which data should be kept in the cache. | 7385 * The maximum number of sources for which data should be kept in the cache. |
| 7603 */ | 7386 */ |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7679 } | 7462 } |
| 7680 | 7463 |
| 7681 /** | 7464 /** |
| 7682 * Instances of the class `ChangeNoticeImpl` represent a change to the analysis
results | 7465 * Instances of the class `ChangeNoticeImpl` represent a change to the analysis
results |
| 7683 * associated with a given source. | 7466 * associated with a given source. |
| 7684 */ | 7467 */ |
| 7685 class ChangeNoticeImpl implements ChangeNotice { | 7468 class ChangeNoticeImpl implements ChangeNotice { |
| 7686 /** | 7469 /** |
| 7687 * The source for which the result is being reported. | 7470 * The source for which the result is being reported. |
| 7688 */ | 7471 */ |
| 7689 final Source source; | 7472 Source source; |
| 7690 | 7473 |
| 7691 /** | 7474 /** |
| 7692 * The fully resolved AST that changed as a result of the analysis, or `null`
if the AST was | 7475 * The fully resolved AST that changed as a result of the analysis, or `null`
if the AST was |
| 7693 * not changed. | 7476 * not changed. |
| 7694 */ | 7477 */ |
| 7695 CompilationUnit compilationUnit; | 7478 CompilationUnit compilationUnit; |
| 7696 | 7479 |
| 7697 /** | 7480 /** |
| 7698 * The fully resolved HTML that changed as a result of the analysis, or `null`
if the HTML | 7481 * The fully resolved HTML that changed as a result of the analysis, or `null`
if the HTML |
| 7699 * was not changed. | 7482 * was not changed. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 7714 /** | 7497 /** |
| 7715 * An empty array of change notices. | 7498 * An empty array of change notices. |
| 7716 */ | 7499 */ |
| 7717 static List<ChangeNoticeImpl> EMPTY_ARRAY = new List<ChangeNoticeImpl>(0); | 7500 static List<ChangeNoticeImpl> EMPTY_ARRAY = new List<ChangeNoticeImpl>(0); |
| 7718 | 7501 |
| 7719 /** | 7502 /** |
| 7720 * Initialize a newly created notice associated with the given source. | 7503 * Initialize a newly created notice associated with the given source. |
| 7721 * | 7504 * |
| 7722 * @param source the source for which the change is being reported | 7505 * @param source the source for which the change is being reported |
| 7723 */ | 7506 */ |
| 7724 ChangeNoticeImpl(this.source); | 7507 ChangeNoticeImpl(Source source) { |
| 7508 this.source = source; |
| 7509 } |
| 7725 | 7510 |
| 7726 @override | 7511 @override |
| 7727 List<AnalysisError> get errors => _errors; | 7512 List<AnalysisError> get errors => _errors; |
| 7728 | 7513 |
| 7729 @override | 7514 @override |
| 7730 LineInfo get lineInfo => _lineInfo; | 7515 LineInfo get lineInfo => _lineInfo; |
| 7731 | 7516 |
| 7732 /** | 7517 /** |
| 7733 * Set the errors that changed as a result of the analysis to the given errors
and set the line | 7518 * Set the errors that changed as a result of the analysis to the given errors
and set the line |
| 7734 * information to the given line information. | 7519 * information to the given line information. |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7923 Namespace getPublicNamespace(LibraryElement library) { | 7708 Namespace getPublicNamespace(LibraryElement library) { |
| 7924 Source source = library.source; | 7709 Source source = library.source; |
| 7925 if (source.isInSystemLibrary) { | 7710 if (source.isInSystemLibrary) { |
| 7926 return _sdkAnalysisContext.getPublicNamespace(library); | 7711 return _sdkAnalysisContext.getPublicNamespace(library); |
| 7927 } else { | 7712 } else { |
| 7928 return super.getPublicNamespace(library); | 7713 return super.getPublicNamespace(library); |
| 7929 } | 7714 } |
| 7930 } | 7715 } |
| 7931 | 7716 |
| 7932 @override | 7717 @override |
| 7933 Namespace getPublicNamespace2(Source source) { | |
| 7934 if (source.isInSystemLibrary) { | |
| 7935 return _sdkAnalysisContext.getPublicNamespace2(source); | |
| 7936 } else { | |
| 7937 return super.getPublicNamespace2(source); | |
| 7938 } | |
| 7939 } | |
| 7940 | |
| 7941 @override | |
| 7942 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l
ibrary) { | 7718 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l
ibrary) { |
| 7943 if (unitSource.isInSystemLibrary) { | 7719 if (unitSource.isInSystemLibrary) { |
| 7944 return _sdkAnalysisContext.getResolvedCompilationUnit(unitSource, library)
; | 7720 return _sdkAnalysisContext.getResolvedCompilationUnit(unitSource, library)
; |
| 7945 } else { | 7721 } else { |
| 7946 return super.getResolvedCompilationUnit(unitSource, library); | 7722 return super.getResolvedCompilationUnit(unitSource, library); |
| 7947 } | 7723 } |
| 7948 } | 7724 } |
| 7949 | 7725 |
| 7950 @override | 7726 @override |
| 7951 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { | 7727 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS
ource) { |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8176 */ | 7952 */ |
| 8177 static IncrementalAnalysisCache verifyStructure(IncrementalAnalysisCache cache
, Source source, CompilationUnit unit) { | 7953 static IncrementalAnalysisCache verifyStructure(IncrementalAnalysisCache cache
, Source source, CompilationUnit unit) { |
| 8178 if (cache != null && unit != null && cache.source == source) { | 7954 if (cache != null && unit != null && cache.source == source) { |
| 8179 if (!AstComparator.equalUnits(cache.resolvedUnit, unit)) { | 7955 if (!AstComparator.equalUnits(cache.resolvedUnit, unit)) { |
| 8180 return null; | 7956 return null; |
| 8181 } | 7957 } |
| 8182 } | 7958 } |
| 8183 return cache; | 7959 return cache; |
| 8184 } | 7960 } |
| 8185 | 7961 |
| 8186 final Source librarySource; | 7962 Source librarySource; |
| 8187 | 7963 |
| 8188 final Source source; | 7964 Source source; |
| 8189 | 7965 |
| 8190 final String oldContents; | 7966 String oldContents; |
| 8191 | 7967 |
| 8192 final CompilationUnit resolvedUnit; | 7968 CompilationUnit resolvedUnit; |
| 8193 | 7969 |
| 8194 String _newContents; | 7970 String _newContents; |
| 8195 | 7971 |
| 8196 int _offset = 0; | 7972 int _offset = 0; |
| 8197 | 7973 |
| 8198 int _oldLength = 0; | 7974 int _oldLength = 0; |
| 8199 | 7975 |
| 8200 int _newLength = 0; | 7976 int _newLength = 0; |
| 8201 | 7977 |
| 8202 IncrementalAnalysisCache(this.librarySource, this.source, this.resolvedUnit, t
his.oldContents, String newContents, int offset, int oldLength, int newLength) { | 7978 IncrementalAnalysisCache(Source librarySource, Source source, CompilationUnit
resolvedUnit, String oldContents, String newContents, int offset, int oldLength,
int newLength) { |
| 7979 this.librarySource = librarySource; |
| 7980 this.source = source; |
| 7981 this.resolvedUnit = resolvedUnit; |
| 7982 this.oldContents = oldContents; |
| 8203 this._newContents = newContents; | 7983 this._newContents = newContents; |
| 8204 this._offset = offset; | 7984 this._offset = offset; |
| 8205 this._oldLength = oldLength; | 7985 this._oldLength = oldLength; |
| 8206 this._newLength = newLength; | 7986 this._newLength = newLength; |
| 8207 } | 7987 } |
| 8208 | 7988 |
| 8209 /** | 7989 /** |
| 8210 * Return the current contents for the receiver's source. | 7990 * Return the current contents for the receiver's source. |
| 8211 * | 7991 * |
| 8212 * @return the contents (not `null`) | 7992 * @return the contents (not `null`) |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8672 return _basis.getModificationStamp(source); | 8452 return _basis.getModificationStamp(source); |
| 8673 } finally { | 8453 } finally { |
| 8674 instrumentation.log(); | 8454 instrumentation.log(); |
| 8675 } | 8455 } |
| 8676 } | 8456 } |
| 8677 | 8457 |
| 8678 @override | 8458 @override |
| 8679 Namespace getPublicNamespace(LibraryElement library) => _basis.getPublicNamesp
ace(library); | 8459 Namespace getPublicNamespace(LibraryElement library) => _basis.getPublicNamesp
ace(library); |
| 8680 | 8460 |
| 8681 @override | 8461 @override |
| 8682 Namespace getPublicNamespace2(Source source) => _basis.getPublicNamespace2(sou
rce); | |
| 8683 | |
| 8684 @override | |
| 8685 List<Source> get refactoringUnsafeSources { | 8462 List<Source> get refactoringUnsafeSources { |
| 8686 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getRefactoringUnsafeSources"); | 8463 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis-
getRefactoringUnsafeSources"); |
| 8687 _checkThread(instrumentation); | 8464 _checkThread(instrumentation); |
| 8688 try { | 8465 try { |
| 8689 instrumentation.metric3("contextId", _contextId); | 8466 instrumentation.metric3("contextId", _contextId); |
| 8690 return _basis.refactoringUnsafeSources; | 8467 return _basis.refactoringUnsafeSources; |
| 8691 } finally { | 8468 } finally { |
| 8692 instrumentation.log(); | 8469 instrumentation.log(); |
| 8693 } | 8470 } |
| 8694 } | 8471 } |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9020 /** | 8797 /** |
| 9021 * Return a namespace containing mappings for all of the public names defined
by the given | 8798 * Return a namespace containing mappings for all of the public names defined
by the given |
| 9022 * library. | 8799 * library. |
| 9023 * | 8800 * |
| 9024 * @param library the library whose public namespace is to be returned | 8801 * @param library the library whose public namespace is to be returned |
| 9025 * @return the public namespace of the given library | 8802 * @return the public namespace of the given library |
| 9026 */ | 8803 */ |
| 9027 Namespace getPublicNamespace(LibraryElement library); | 8804 Namespace getPublicNamespace(LibraryElement library); |
| 9028 | 8805 |
| 9029 /** | 8806 /** |
| 9030 * Return a namespace containing mappings for all of the public names defined
by the library | |
| 9031 * defined by the given source. | |
| 9032 * | |
| 9033 * @param source the source defining the library whose public namespace is to
be returned | |
| 9034 * @return the public namespace corresponding to the library defined by the gi
ven source | |
| 9035 * @throws AnalysisException if the public namespace could not be computed | |
| 9036 */ | |
| 9037 Namespace getPublicNamespace2(Source source); | |
| 9038 | |
| 9039 /** | |
| 9040 * Returns a statistics about this context. | 8807 * Returns a statistics about this context. |
| 9041 */ | 8808 */ |
| 9042 AnalysisContentStatistics get statistics; | 8809 AnalysisContentStatistics get statistics; |
| 9043 | 8810 |
| 9044 /** | 8811 /** |
| 9045 * Returns a type provider for this context or throws an exception if dart:cor
e cannot be | 8812 * Returns a type provider for this context or throws an exception if dart:cor
e cannot be |
| 9046 * resolved. | 8813 * resolved. |
| 9047 * | 8814 * |
| 9048 * @return the type provider (not `null`) | 8815 * @return the type provider (not `null`) |
| 9049 * @throws AnalysisException if dart:core cannot be resolved | 8816 * @throws AnalysisException if dart:core cannot be resolved |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9291 } | 9058 } |
| 9292 } | 9059 } |
| 9293 | 9060 |
| 9294 /** | 9061 /** |
| 9295 * Instances of the class `ResolvableCompilationUnit` represent a compilation un
it that is not | 9062 * Instances of the class `ResolvableCompilationUnit` represent a compilation un
it that is not |
| 9296 * referenced by any other objects and for which we have modification stamp info
rmation. It is used | 9063 * referenced by any other objects and for which we have modification stamp info
rmation. It is used |
| 9297 * by the [LibraryResolver] to resolve a library. | 9064 * by the [LibraryResolver] to resolve a library. |
| 9298 */ | 9065 */ |
| 9299 class ResolvableCompilationUnit extends TimestampedData<CompilationUnit> { | 9066 class ResolvableCompilationUnit extends TimestampedData<CompilationUnit> { |
| 9300 /** | 9067 /** |
| 9068 * The source of the compilation unit. |
| 9069 */ |
| 9070 Source _source; |
| 9071 |
| 9072 /** |
| 9301 * Initialize a newly created holder to hold the given values. | 9073 * Initialize a newly created holder to hold the given values. |
| 9302 * | 9074 * |
| 9303 * @param modificationTime the modification time of the source from which the
AST was created | 9075 * @param modificationTime the modification time of the source from which the
AST was created |
| 9304 * @param unit the AST that was created from the source | 9076 * @param unit the AST that was created from the source |
| 9305 */ | 9077 */ |
| 9306 ResolvableCompilationUnit(int modificationTime, CompilationUnit unit) : super(
modificationTime, unit); | 9078 ResolvableCompilationUnit.con1(int modificationTime, CompilationUnit unit) : s
uper(modificationTime, unit); |
| 9079 |
| 9080 /** |
| 9081 * Initialize a newly created holder to hold the given values. |
| 9082 * |
| 9083 * @param modificationTime the modification time of the source from which the
AST was created |
| 9084 * @param unit the AST that was created from the source |
| 9085 * @param source the source of the compilation unit |
| 9086 */ |
| 9087 ResolvableCompilationUnit.con2(int modificationTime, CompilationUnit unit, Sou
rce source) : super(modificationTime, unit) { |
| 9088 this._source = source; |
| 9089 } |
| 9307 | 9090 |
| 9308 /** | 9091 /** |
| 9309 * Return the AST that was created from the source. | 9092 * Return the AST that was created from the source. |
| 9310 * | 9093 * |
| 9311 * @return the AST that was created from the source | 9094 * @return the AST that was created from the source |
| 9312 */ | 9095 */ |
| 9313 CompilationUnit get compilationUnit => data; | 9096 CompilationUnit get compilationUnit => data; |
| 9097 |
| 9098 /** |
| 9099 * Return the source of the compilation unit. |
| 9100 * |
| 9101 * @return the source of the compilation unit |
| 9102 */ |
| 9103 Source get source => _source; |
| 9314 } | 9104 } |
| 9315 | 9105 |
| 9316 /** | 9106 /** |
| 9317 * Instances of the class `ResolvableHtmlUnit` represent an HTML unit that is no
t referenced | 9107 * Instances of the class `ResolvableHtmlUnit` represent an HTML unit that is no
t referenced |
| 9318 * by any other objects and for which we have modification stamp information. It
is used by the | 9108 * by any other objects and for which we have modification stamp information. It
is used by the |
| 9319 * [ResolveHtmlTask] to resolve an HTML source. | 9109 * [ResolveHtmlTask] to resolve an HTML source. |
| 9320 */ | 9110 */ |
| 9321 class ResolvableHtmlUnit extends TimestampedData<ht.HtmlUnit> { | 9111 class ResolvableHtmlUnit extends TimestampedData<ht.HtmlUnit> { |
| 9322 /** | 9112 /** |
| 9323 * Initialize a newly created holder to hold the given values. | 9113 * Initialize a newly created holder to hold the given values. |
| 9324 * | 9114 * |
| 9325 * @param modificationTime the modification time of the source from which the
AST was created | 9115 * @param modificationTime the modification time of the source from which the
AST was created |
| 9326 * @param unit the AST that was created from the source | 9116 * @param unit the AST that was created from the source |
| 9327 */ | 9117 */ |
| 9328 ResolvableHtmlUnit(int modificationTime, ht.HtmlUnit unit) : super(modificatio
nTime, unit); | 9118 ResolvableHtmlUnit(int modificationTime, ht.HtmlUnit unit) : super(modificatio
nTime, unit); |
| 9329 | 9119 |
| 9330 /** | 9120 /** |
| 9331 * Return the AST that was created from the source. | 9121 * Return the AST that was created from the source. |
| 9332 * | 9122 * |
| 9333 * @return the AST that was created from the source | 9123 * @return the AST that was created from the source |
| 9334 */ | 9124 */ |
| 9335 ht.HtmlUnit get compilationUnit => data; | 9125 ht.HtmlUnit get compilationUnit => data; |
| 9336 } | 9126 } |
| 9337 | 9127 |
| 9338 /** | 9128 /** |
| 9339 * The enumerated type `Priority` defines the priority levels used to return sou
rces in an | 9129 * The enumerated type `Priority` defines the priority levels used to return sou
rces in an |
| 9340 * optimal order. | 9130 * optimal order. A smaller ordinal value equates to a higher priority. |
| 9341 */ | 9131 */ |
| 9342 class SourcePriority extends Enum<SourcePriority> { | 9132 class SourcePriority extends Enum<SourcePriority> { |
| 9343 /** | 9133 /** |
| 9344 * Used for a Dart source that is known to be a part contained in a library th
at was recently | 9134 * Used for a Dart source that is known to be a part contained in a library th
at was recently |
| 9345 * resolved. These parts are given a higher priority because there is a high p
robability that | 9135 * resolved. These parts are given a higher priority because there is a high p
robability that |
| 9346 * their AST structure is still in the cache and therefore would not need to b
e re-created. | 9136 * their AST structure is still in the cache and therefore would not need to b
e re-created. |
| 9347 */ | 9137 */ |
| 9348 static final SourcePriority PRIORITY_PART = new SourcePriority('PRIORITY_PART'
, 0); | 9138 static final SourcePriority PRIORITY_PART = new SourcePriority('PRIORITY_PART'
, 0); |
| 9349 | 9139 |
| 9350 /** | 9140 /** |
| 9351 * Used for a Dart source that is known to be a library. | 9141 * Used for a Dart source that is known to be a library. |
| 9352 */ | 9142 */ |
| 9353 static final SourcePriority LIBRARY = new SourcePriority('LIBRARY', 1); | 9143 static final SourcePriority LIBRARY = new SourcePriority('LIBRARY', 1); |
| 9354 | 9144 |
| 9355 /** | 9145 /** |
| 9356 * Used for a Dart source that is known to be a part but whose library has not
yet been | |
| 9357 * resolved. | |
| 9358 */ | |
| 9359 static final SourcePriority NORMAL_PART = new SourcePriority('NORMAL_PART', 2)
; | |
| 9360 | |
| 9361 /** | |
| 9362 * Used for a Dart source whose kind is unknown. | 9146 * Used for a Dart source whose kind is unknown. |
| 9363 */ | 9147 */ |
| 9364 static final SourcePriority UNKNOWN = new SourcePriority('UNKNOWN', 3); | 9148 static final SourcePriority UNKNOWN = new SourcePriority('UNKNOWN', 2); |
| 9149 |
| 9150 /** |
| 9151 * Used for a Dart source that is known to be a part but whose library has not
yet been resolved. |
| 9152 */ |
| 9153 static final SourcePriority NORMAL_PART = new SourcePriority('NORMAL_PART', 3)
; |
| 9365 | 9154 |
| 9366 /** | 9155 /** |
| 9367 * Used for an HTML source. | 9156 * Used for an HTML source. |
| 9368 */ | 9157 */ |
| 9369 static final SourcePriority HTML = new SourcePriority('HTML', 4); | 9158 static final SourcePriority HTML = new SourcePriority('HTML', 4); |
| 9370 | 9159 |
| 9371 static final List<SourcePriority> values = [PRIORITY_PART, LIBRARY, NORMAL_PAR
T, UNKNOWN, HTML]; | 9160 static final List<SourcePriority> values = [PRIORITY_PART, LIBRARY, UNKNOWN, N
ORMAL_PART, HTML]; |
| 9372 | 9161 |
| 9373 SourcePriority(String name, int ordinal) : super(name, ordinal); | 9162 SourcePriority(String name, int ordinal) : super(name, ordinal); |
| 9374 } | 9163 } |
| 9375 | 9164 |
| 9376 /** | 9165 /** |
| 9377 * Instances of the class `TimestampedData` represent analysis data for which we
have a | 9166 * Instances of the class `TimestampedData` represent analysis data for which we
have a |
| 9378 * modification time. | 9167 * modification time. |
| 9379 */ | 9168 */ |
| 9380 class TimestampedData<E> { | 9169 class TimestampedData<E> { |
| 9381 /** | 9170 /** |
| 9382 * The modification time of the source from which the data was created. | 9171 * The modification time of the source from which the data was created. |
| 9383 */ | 9172 */ |
| 9384 final int modificationTime; | 9173 int modificationTime = 0; |
| 9385 | 9174 |
| 9386 /** | 9175 /** |
| 9387 * The data that was created from the source. | 9176 * The data that was created from the source. |
| 9388 */ | 9177 */ |
| 9389 final E data; | 9178 E data; |
| 9390 | 9179 |
| 9391 /** | 9180 /** |
| 9392 * Initialize a newly created holder to hold the given values. | 9181 * Initialize a newly created holder to hold the given values. |
| 9393 * | 9182 * |
| 9394 * @param modificationTime the modification time of the source from which the
data was created | 9183 * @param modificationTime the modification time of the source from which the
data was created |
| 9395 * @param unit the data that was created from the source | 9184 * @param unit the data that was created from the source |
| 9396 */ | 9185 */ |
| 9397 TimestampedData(this.modificationTime, this.data); | 9186 TimestampedData(int modificationTime, E data) { |
| 9187 this.modificationTime = modificationTime; |
| 9188 this.data = data; |
| 9189 } |
| 9398 } | 9190 } |
| 9399 | 9191 |
| 9400 /** | 9192 /** |
| 9401 * Instances of the class `WorkManager` manage a list of sources that need to ha
ve analysis | 9193 * Instances of the class `WorkManager` manage a list of sources that need to ha
ve analysis |
| 9402 * work performed on them. | 9194 * work performed on them. |
| 9403 */ | 9195 */ |
| 9404 class WorkManager { | 9196 class WorkManager { |
| 9405 /** | 9197 /** |
| 9406 * An array containing the various queues is priority order. | 9198 * An array containing the various queues is priority order. |
| 9407 */ | 9199 */ |
| 9408 List<List<Source>> _workQueues; | 9200 List<List<Source>> _workQueues; |
| 9409 | 9201 |
| 9410 /** | 9202 /** |
| 9411 * Initialize a newly created manager to have no work queued up. | 9203 * Initialize a newly created manager to have no work queued up. |
| 9412 */ | 9204 */ |
| 9413 WorkManager() { | 9205 WorkManager() { |
| 9414 int queueCount = SourcePriority.values.length; | 9206 int queueCount = SourcePriority.values.length; |
| 9415 _workQueues = new List<List>(queueCount); | 9207 _workQueues = new List<List>(queueCount); |
| 9416 for (int i = 0; i < queueCount; i++) { | 9208 for (int i = 0; i < queueCount; i++) { |
| 9417 _workQueues[i] = new List<Source>(); | 9209 _workQueues[i] = new List<Source>(); |
| 9418 } | 9210 } |
| 9419 } | 9211 } |
| 9420 | 9212 |
| 9421 /** | 9213 /** |
| 9422 * Record that the given source needs to be analyzed. The priority level is us
ed to control when | 9214 * Record that the given source needs to be analyzed. The priority level is us
ed to control when |
| 9423 * the source will be analyzed with respect to other sources. | 9215 * the source will be analyzed with respect to other sources. If the source wa
s previously added |
| 9216 * then it's priority is updated. If it was previously added with the same pri
ority then it's |
| 9217 * position in the queue is unchanged. |
| 9424 * | 9218 * |
| 9425 * @param source the source that needs to be analyzed | 9219 * @param source the source that needs to be analyzed |
| 9426 * @param priority the priority level of the source | 9220 * @param priority the priority level of the source |
| 9427 */ | 9221 */ |
| 9428 void add(Source source, SourcePriority priority) { | 9222 void add(Source source, SourcePriority priority) { |
| 9429 // TODO(brianwilkerson) Optimize the order of the libraries so that librarie
s that depend on | |
| 9430 // other libraries get analyzed after the other libraries. | |
| 9431 int queueCount = _workQueues.length; | 9223 int queueCount = _workQueues.length; |
| 9432 int ordinal = priority.ordinal; | 9224 int ordinal = priority.ordinal; |
| 9433 for (int i = 0; i < queueCount; i++) { | 9225 for (int i = 0; i < queueCount; i++) { |
| 9434 List<Source> queue = _workQueues[i]; | 9226 List<Source> queue = _workQueues[i]; |
| 9435 if (i == ordinal) { | 9227 if (i == ordinal) { |
| 9436 if (!queue.contains(source)) { | 9228 if (!queue.contains(source)) { |
| 9437 queue.add(source); | 9229 queue.add(source); |
| 9438 } | 9230 } |
| 9439 } else { | 9231 } else { |
| 9440 queue.remove(source); | 9232 queue.remove(source); |
| 9441 } | 9233 } |
| 9442 } | 9234 } |
| 9443 } | 9235 } |
| 9444 | 9236 |
| 9445 /** | 9237 /** |
| 9446 * Return the next source for which some analysis work needs to be done. | 9238 * Record that the given source needs to be analyzed. The priority level is us
ed to control when |
| 9239 * the source will be analyzed with respect to other sources. If the source wa
s previously added |
| 9240 * then it's priority is updated. In either case, it will be analyzed before o
ther sources of the |
| 9241 * same priority. |
| 9447 * | 9242 * |
| 9448 * @return the next source for which some analysis work needs to be done | 9243 * @param source the source that needs to be analyzed |
| 9244 * @param priority the priority level of the source |
| 9449 */ | 9245 */ |
| 9450 Source get nextSource { | 9246 void addFirst(Source source, SourcePriority priority) { |
| 9451 int queueCount = _workQueues.length; | 9247 int queueCount = _workQueues.length; |
| 9248 int ordinal = priority.ordinal; |
| 9452 for (int i = 0; i < queueCount; i++) { | 9249 for (int i = 0; i < queueCount; i++) { |
| 9453 List<Source> queue = _workQueues[i]; | 9250 List<Source> queue = _workQueues[i]; |
| 9454 if (!queue.isEmpty) { | 9251 if (i == ordinal) { |
| 9455 return queue[0]; | 9252 queue.remove(source); |
| 9253 queue.insert(0, source); |
| 9254 } else { |
| 9255 queue.remove(source); |
| 9456 } | 9256 } |
| 9457 } | 9257 } |
| 9458 return null; | |
| 9459 } | 9258 } |
| 9460 | 9259 |
| 9461 /** | 9260 /** |
| 9261 * Return an iterator that can be used to access the sources to be analyzed in
the order in which |
| 9262 * they should be analyzed. |
| 9263 * |
| 9264 * <b>Note:</b> As with other iterators, no sources can be added or removed fr
om this work manager |
| 9265 * while the iterator is being used. Unlike some implementations, however, the
iterator will not |
| 9266 * detect when this requirement has been violated; it might work correctly, it
might return the |
| 9267 * wrong source, or it might throw an exception. |
| 9268 * |
| 9269 * @return an iterator that can be used to access the next source to be analyz
ed |
| 9270 */ |
| 9271 WorkManager_WorkIterator iterator() => new WorkManager_WorkIterator(this); |
| 9272 |
| 9273 /** |
| 9462 * Record that the given source is fully analyzed. | 9274 * Record that the given source is fully analyzed. |
| 9463 * | 9275 * |
| 9464 * @param source the source that is fully analyzed | 9276 * @param source the source that is fully analyzed |
| 9465 */ | 9277 */ |
| 9466 void remove(Source source) { | 9278 void remove(Source source) { |
| 9467 int queueCount = _workQueues.length; | 9279 int queueCount = _workQueues.length; |
| 9468 for (int i = 0; i < queueCount; i++) { | 9280 for (int i = 0; i < queueCount; i++) { |
| 9469 _workQueues[i].remove(source); | 9281 _workQueues[i].remove(source); |
| 9470 } | 9282 } |
| 9471 } | 9283 } |
| 9472 } | 9284 } |
| 9473 | 9285 |
| 9474 /** | 9286 /** |
| 9287 * Instances of the class `WorkIterator` implement an iterator that returns the
sources in a |
| 9288 * work manager in the order in which they are to be analyzed. |
| 9289 */ |
| 9290 class WorkManager_WorkIterator { |
| 9291 final WorkManager WorkManager_this; |
| 9292 |
| 9293 /** |
| 9294 * The index of the work queue through which we are currently iterating. |
| 9295 */ |
| 9296 int _queueIndex = 0; |
| 9297 |
| 9298 /** |
| 9299 * The index of the next element of the work queue to be returned. |
| 9300 */ |
| 9301 int _index = -1; |
| 9302 |
| 9303 /** |
| 9304 * Initialize a newly created iterator to be ready to return the first element
in the iteration. |
| 9305 */ |
| 9306 WorkManager_WorkIterator(this.WorkManager_this) { |
| 9307 _advance(); |
| 9308 } |
| 9309 |
| 9310 /** |
| 9311 * Return `true` if there is another [Source] available for processing. |
| 9312 * |
| 9313 * @return `true` if there is another [Source] available for processing |
| 9314 */ |
| 9315 bool get hasNext => _queueIndex < _workQueues.length; |
| 9316 |
| 9317 /** |
| 9318 * Return the next [Source] available for processing and advance so that the r
eturned |
| 9319 * source will not be returned again. |
| 9320 * |
| 9321 * @return the next [Source] available for processing |
| 9322 */ |
| 9323 Source next() { |
| 9324 if (!hasNext) { |
| 9325 throw new NoSuchElementException(); |
| 9326 } |
| 9327 Source source = WorkManager_this._workQueues[_queueIndex][_index]; |
| 9328 _advance(); |
| 9329 return source; |
| 9330 } |
| 9331 |
| 9332 /** |
| 9333 * Increment the [index] and [queueIndex] so that they are either indicating t
he |
| 9334 * next source to be returned or are indicating that there are no more sources
to be returned. |
| 9335 */ |
| 9336 void _advance() { |
| 9337 _index++; |
| 9338 if (_index >= WorkManager_this._workQueues[_queueIndex].length) { |
| 9339 _index = 0; |
| 9340 _queueIndex++; |
| 9341 while (_queueIndex < _workQueues.length && WorkManager_this._workQueues[_q
ueueIndex].isEmpty) { |
| 9342 _queueIndex++; |
| 9343 } |
| 9344 } |
| 9345 } |
| 9346 } |
| 9347 |
| 9348 /** |
| 9475 * An [Expression] with optional [AngularFilterNode]s. | 9349 * An [Expression] with optional [AngularFilterNode]s. |
| 9476 */ | 9350 */ |
| 9477 class AngularExpression { | 9351 class AngularExpression { |
| 9478 /** | 9352 /** |
| 9479 * The [Expression] to apply filters to. | 9353 * The [Expression] to apply filters to. |
| 9480 */ | 9354 */ |
| 9481 final Expression expression; | 9355 Expression expression; |
| 9482 | 9356 |
| 9483 /** | 9357 /** |
| 9484 * The filters to apply. | 9358 * The filters to apply. |
| 9485 */ | 9359 */ |
| 9486 final List<AngularFilterNode> filters; | 9360 List<AngularFilterNode> filters; |
| 9487 | 9361 |
| 9488 AngularExpression(this.expression, this.filters); | 9362 AngularExpression(Expression expression, List<AngularFilterNode> filters) { |
| 9363 this.expression = expression; |
| 9364 this.filters = filters; |
| 9365 } |
| 9489 | 9366 |
| 9490 /** | 9367 /** |
| 9491 * Return the offset of the character immediately following the last character
of this node's | 9368 * Return the offset of the character immediately following the last character
of this node's |
| 9492 * source range. This is equivalent to `node.getOffset() + node.getLength()`. | 9369 * source range. This is equivalent to `node.getOffset() + node.getLength()`. |
| 9493 * | 9370 * |
| 9494 * @return the offset of the character just past the node's source range | 9371 * @return the offset of the character just past the node's source range |
| 9495 */ | 9372 */ |
| 9496 int get end { | 9373 int get end { |
| 9497 if (filters.isEmpty) { | 9374 if (filters.isEmpty) { |
| 9498 return expression.end; | 9375 return expression.end; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9532 int get offset => expression.offset; | 9409 int get offset => expression.offset; |
| 9533 } | 9410 } |
| 9534 | 9411 |
| 9535 /** | 9412 /** |
| 9536 * Angular filter argument. | 9413 * Angular filter argument. |
| 9537 */ | 9414 */ |
| 9538 class AngularFilterArgument { | 9415 class AngularFilterArgument { |
| 9539 /** | 9416 /** |
| 9540 * The [TokenType#COLON] token. | 9417 * The [TokenType#COLON] token. |
| 9541 */ | 9418 */ |
| 9542 final Token token; | 9419 Token token; |
| 9543 | 9420 |
| 9544 /** | 9421 /** |
| 9545 * The argument expression. | 9422 * The argument expression. |
| 9546 */ | 9423 */ |
| 9547 final Expression expression; | 9424 Expression expression; |
| 9548 | 9425 |
| 9549 /** | 9426 /** |
| 9550 * The optional sub-[Expression]s. | 9427 * The optional sub-[Expression]s. |
| 9551 */ | 9428 */ |
| 9552 List<Expression> subExpressions = Expression.EMPTY_ARRAY; | 9429 List<Expression> subExpressions = Expression.EMPTY_ARRAY; |
| 9553 | 9430 |
| 9554 AngularFilterArgument(this.token, this.expression); | 9431 AngularFilterArgument(Token token, Expression expression) { |
| 9432 this.token = token; |
| 9433 this.expression = expression; |
| 9434 } |
| 9555 } | 9435 } |
| 9556 | 9436 |
| 9557 /** | 9437 /** |
| 9558 * Angular filter node. | 9438 * Angular filter node. |
| 9559 */ | 9439 */ |
| 9560 class AngularFilterNode { | 9440 class AngularFilterNode { |
| 9561 /** | 9441 /** |
| 9562 * The [TokenType#BAR] token. | 9442 * The [TokenType#BAR] token. |
| 9563 */ | 9443 */ |
| 9564 final Token token; | 9444 Token token; |
| 9565 | 9445 |
| 9566 /** | 9446 /** |
| 9567 * The name of the filter. | 9447 * The name of the filter. |
| 9568 */ | 9448 */ |
| 9569 final SimpleIdentifier name; | 9449 SimpleIdentifier name; |
| 9570 | 9450 |
| 9571 /** | 9451 /** |
| 9572 * The arguments for this filter. | 9452 * The arguments for this filter. |
| 9573 */ | 9453 */ |
| 9574 final List<AngularFilterArgument> arguments; | 9454 List<AngularFilterArgument> arguments; |
| 9575 | 9455 |
| 9576 AngularFilterNode(this.token, this.name, this.arguments); | 9456 AngularFilterNode(Token token, SimpleIdentifier name, List<AngularFilterArgume
nt> arguments) { |
| 9457 this.token = token; |
| 9458 this.name = name; |
| 9459 this.arguments = arguments; |
| 9460 } |
| 9577 } | 9461 } |
| 9578 | 9462 |
| 9579 /** | 9463 /** |
| 9580 * Instances of the class [AngularHtmlUnitResolver] resolve Angular specific exp
ressions. | 9464 * Instances of the class [AngularHtmlUnitResolver] resolve Angular specific exp
ressions. |
| 9581 */ | 9465 */ |
| 9582 class AngularHtmlUnitResolver extends ht.RecursiveXmlVisitor<Object> { | 9466 class AngularHtmlUnitResolver extends ht.RecursiveXmlVisitor<Object> { |
| 9583 static String _NG_APP = "ng-app"; | 9467 static String _NG_APP = "ng-app"; |
| 9584 | 9468 |
| 9585 /** | 9469 /** |
| 9586 * Checks if given [Element] is an artificial local variable and returns corre
sponding | 9470 * Checks if given [Element] is an artificial local variable and returns corre
sponding |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10372 int get offset => expression.offset; | 10256 int get offset => expression.offset; |
| 10373 } | 10257 } |
| 10374 | 10258 |
| 10375 /** | 10259 /** |
| 10376 * Abstract Angular specific [XmlExpression]. | 10260 * Abstract Angular specific [XmlExpression]. |
| 10377 */ | 10261 */ |
| 10378 abstract class AngularXmlExpression extends ht.XmlExpression { | 10262 abstract class AngularXmlExpression extends ht.XmlExpression { |
| 10379 /** | 10263 /** |
| 10380 * The expression that is enclosed between the delimiters. | 10264 * The expression that is enclosed between the delimiters. |
| 10381 */ | 10265 */ |
| 10382 final AngularExpression expression; | 10266 AngularExpression expression; |
| 10383 | 10267 |
| 10384 AngularXmlExpression(this.expression); | 10268 AngularXmlExpression(AngularExpression expression) { |
| 10269 this.expression = expression; |
| 10270 } |
| 10385 | 10271 |
| 10386 @override | 10272 @override |
| 10387 ht.XmlExpression_Reference getReference(int offset) { | 10273 ht.XmlExpression_Reference getReference(int offset) { |
| 10388 // main expression | 10274 // main expression |
| 10389 ht.XmlExpression_Reference reference = _getReferenceAtNode(expression.expres
sion, offset); | 10275 ht.XmlExpression_Reference reference = _getReferenceAtNode(expression.expres
sion, offset); |
| 10390 if (reference != null) { | 10276 if (reference != null) { |
| 10391 return reference; | 10277 return reference; |
| 10392 } | 10278 } |
| 10393 // filters | 10279 // filters |
| 10394 for (AngularFilterNode filter in expression.filters) { | 10280 for (AngularFilterNode filter in expression.filters) { |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10707 } | 10593 } |
| 10708 | 10594 |
| 10709 /** | 10595 /** |
| 10710 * The abstract class `AnalysisTask` defines the behavior of objects used to per
form an | 10596 * The abstract class `AnalysisTask` defines the behavior of objects used to per
form an |
| 10711 * analysis task. | 10597 * analysis task. |
| 10712 */ | 10598 */ |
| 10713 abstract class AnalysisTask { | 10599 abstract class AnalysisTask { |
| 10714 /** | 10600 /** |
| 10715 * The context in which the task is to be performed. | 10601 * The context in which the task is to be performed. |
| 10716 */ | 10602 */ |
| 10717 final InternalAnalysisContext context; | 10603 InternalAnalysisContext context; |
| 10718 | 10604 |
| 10719 /** | 10605 /** |
| 10720 * The exception that was thrown while performing this task, or `null` if the
task completed | 10606 * The exception that was thrown while performing this task, or `null` if the
task completed |
| 10721 * successfully. | 10607 * successfully. |
| 10722 */ | 10608 */ |
| 10723 AnalysisException _thrownException; | 10609 AnalysisException _thrownException; |
| 10724 | 10610 |
| 10725 /** | 10611 /** |
| 10726 * Initialize a newly created task to perform analysis within the given contex
t. | 10612 * Initialize a newly created task to perform analysis within the given contex
t. |
| 10727 * | 10613 * |
| 10728 * @param context the context in which the task is to be performed | 10614 * @param context the context in which the task is to be performed |
| 10729 */ | 10615 */ |
| 10730 AnalysisTask(this.context); | 10616 AnalysisTask(InternalAnalysisContext context) { |
| 10617 this.context = context; |
| 10618 } |
| 10731 | 10619 |
| 10732 /** | 10620 /** |
| 10733 * Use the given visitor to visit this task. | 10621 * Use the given visitor to visit this task. |
| 10734 * | 10622 * |
| 10735 * @param visitor the visitor that should be used to visit this task | 10623 * @param visitor the visitor that should be used to visit this task |
| 10736 * @return the value returned by the visitor | 10624 * @return the value returned by the visitor |
| 10737 * @throws AnalysisException if the visitor throws the exception | 10625 * @throws AnalysisException if the visitor throws the exception |
| 10738 */ | 10626 */ |
| 10739 accept(AnalysisTaskVisitor visitor); | 10627 accept(AnalysisTaskVisitor visitor); |
| 10740 | 10628 |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10869 /** | 10757 /** |
| 10870 * Visit a [ResolveAngularEntryHtmlTask]. | 10758 * Visit a [ResolveAngularEntryHtmlTask]. |
| 10871 * | 10759 * |
| 10872 * @param task the task to be visited | 10760 * @param task the task to be visited |
| 10873 * @return the result of visiting the task | 10761 * @return the result of visiting the task |
| 10874 * @throws AnalysisException if the visitor throws an exception for some reaso
n | 10762 * @throws AnalysisException if the visitor throws an exception for some reaso
n |
| 10875 */ | 10763 */ |
| 10876 E visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task); | 10764 E visitResolveAngularEntryHtmlTask(ResolveAngularEntryHtmlTask task); |
| 10877 | 10765 |
| 10878 /** | 10766 /** |
| 10879 * Visit a [ResolveDartDependenciesTask]. | |
| 10880 * | |
| 10881 * @param task the task to be visited | |
| 10882 * @return the result of visiting the task | |
| 10883 * @throws AnalysisException if the visitor throws an exception for some reaso
n | |
| 10884 */ | |
| 10885 E visitResolveDartDependenciesTask(ResolveDartDependenciesTask task); | |
| 10886 | |
| 10887 /** | |
| 10888 * Visit a [ResolveDartLibraryTask]. | 10767 * Visit a [ResolveDartLibraryTask]. |
| 10889 * | 10768 * |
| 10890 * @param task the task to be visited | 10769 * @param task the task to be visited |
| 10891 * @return the result of visiting the task | 10770 * @return the result of visiting the task |
| 10892 * @throws AnalysisException if the visitor throws an exception for some reaso
n | 10771 * @throws AnalysisException if the visitor throws an exception for some reaso
n |
| 10893 */ | 10772 */ |
| 10894 E visitResolveDartLibraryTask(ResolveDartLibraryTask task); | 10773 E visitResolveDartLibraryTask(ResolveDartLibraryTask task); |
| 10895 | 10774 |
| 10896 /** | 10775 /** |
| 10897 * Visit a [ResolveDartUnitTask]. | 10776 * Visit a [ResolveDartUnitTask]. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 10922 } | 10801 } |
| 10923 | 10802 |
| 10924 /** | 10803 /** |
| 10925 * Instances of the class `GenerateDartErrorsTask` generate errors and warnings
for a single | 10804 * Instances of the class `GenerateDartErrorsTask` generate errors and warnings
for a single |
| 10926 * Dart source. | 10805 * Dart source. |
| 10927 */ | 10806 */ |
| 10928 class GenerateDartErrorsTask extends AnalysisTask { | 10807 class GenerateDartErrorsTask extends AnalysisTask { |
| 10929 /** | 10808 /** |
| 10930 * The source for which errors and warnings are to be produced. | 10809 * The source for which errors and warnings are to be produced. |
| 10931 */ | 10810 */ |
| 10932 final Source source; | 10811 Source source; |
| 10933 | 10812 |
| 10934 /** | 10813 /** |
| 10935 * The element model for the library containing the source. | 10814 * The element model for the library containing the source. |
| 10936 */ | 10815 */ |
| 10937 final LibraryElement libraryElement; | 10816 LibraryElement libraryElement; |
| 10938 | 10817 |
| 10939 /** | 10818 /** |
| 10940 * The time at which the contents of the source were last modified. | 10819 * The time at which the contents of the source were last modified. |
| 10941 */ | 10820 */ |
| 10942 int _modificationTime = -1; | 10821 int _modificationTime = -1; |
| 10943 | 10822 |
| 10944 /** | 10823 /** |
| 10945 * The errors that were generated for the source. | 10824 * The errors that were generated for the source. |
| 10946 */ | 10825 */ |
| 10947 List<AnalysisError> _errors; | 10826 List<AnalysisError> _errors; |
| 10948 | 10827 |
| 10949 /** | 10828 /** |
| 10950 * Initialize a newly created task to perform analysis within the given contex
t. | 10829 * Initialize a newly created task to perform analysis within the given contex
t. |
| 10951 * | 10830 * |
| 10952 * @param context the context in which the task is to be performed | 10831 * @param context the context in which the task is to be performed |
| 10953 * @param source the source for which errors and warnings are to be produced | 10832 * @param source the source for which errors and warnings are to be produced |
| 10954 * @param libraryElement the element model for the library containing the sour
ce | 10833 * @param libraryElement the element model for the library containing the sour
ce |
| 10955 */ | 10834 */ |
| 10956 GenerateDartErrorsTask(InternalAnalysisContext context, this.source, this.libr
aryElement) : super(context); | 10835 GenerateDartErrorsTask(InternalAnalysisContext context, Source source, Library
Element libraryElement) : super(context) { |
| 10836 this.source = source; |
| 10837 this.libraryElement = libraryElement; |
| 10838 } |
| 10957 | 10839 |
| 10958 @override | 10840 @override |
| 10959 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartErrorsTask(thi
s); | 10841 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartErrorsTask(thi
s); |
| 10960 | 10842 |
| 10961 /** | 10843 /** |
| 10962 * Return the errors that were generated for the source. | 10844 * Return the errors that were generated for the source. |
| 10963 * | 10845 * |
| 10964 * @return the errors that were generated for the source | 10846 * @return the errors that were generated for the source |
| 10965 */ | 10847 */ |
| 10966 List<AnalysisError> get errors => _errors; | 10848 List<AnalysisError> get errors => _errors; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11005 } | 10887 } |
| 11006 } | 10888 } |
| 11007 | 10889 |
| 11008 /** | 10890 /** |
| 11009 * Instances of the class `GenerateDartHintsTask` generate hints for a single Da
rt library. | 10891 * Instances of the class `GenerateDartHintsTask` generate hints for a single Da
rt library. |
| 11010 */ | 10892 */ |
| 11011 class GenerateDartHintsTask extends AnalysisTask { | 10893 class GenerateDartHintsTask extends AnalysisTask { |
| 11012 /** | 10894 /** |
| 11013 * The element model for the library being analyzed. | 10895 * The element model for the library being analyzed. |
| 11014 */ | 10896 */ |
| 11015 final LibraryElement libraryElement; | 10897 LibraryElement libraryElement; |
| 11016 | 10898 |
| 11017 /** | 10899 /** |
| 11018 * A table mapping the sources that were analyzed to the hints that were gener
ated for the | 10900 * A table mapping the sources that were analyzed to the hints that were gener
ated for the |
| 11019 * sources. | 10901 * sources. |
| 11020 */ | 10902 */ |
| 11021 Map<Source, TimestampedData<List<AnalysisError>>> _hintMap; | 10903 Map<Source, TimestampedData<List<AnalysisError>>> _hintMap; |
| 11022 | 10904 |
| 11023 /** | 10905 /** |
| 11024 * Initialize a newly created task to perform analysis within the given contex
t. | 10906 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11025 * | 10907 * |
| 11026 * @param context the context in which the task is to be performed | 10908 * @param context the context in which the task is to be performed |
| 11027 * @param libraryElement the element model for the library being analyzed | 10909 * @param libraryElement the element model for the library being analyzed |
| 11028 */ | 10910 */ |
| 11029 GenerateDartHintsTask(InternalAnalysisContext context, this.libraryElement) :
super(context); | 10911 GenerateDartHintsTask(InternalAnalysisContext context, LibraryElement libraryE
lement) : super(context) { |
| 10912 this.libraryElement = libraryElement; |
| 10913 } |
| 11030 | 10914 |
| 11031 @override | 10915 @override |
| 11032 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartHintsTask(this
); | 10916 accept(AnalysisTaskVisitor visitor) => visitor.visitGenerateDartHintsTask(this
); |
| 11033 | 10917 |
| 11034 /** | 10918 /** |
| 11035 * Return a table mapping the sources that were analyzed to the hints that wer
e generated for the | 10919 * Return a table mapping the sources that were analyzed to the hints that wer
e generated for the |
| 11036 * sources, or `null` if the task has not been performed or if the analysis di
d not complete | 10920 * sources, or `null` if the task has not been performed or if the analysis di
d not complete |
| 11037 * normally. | 10921 * normally. |
| 11038 * | 10922 * |
| 11039 * @return a table mapping the sources that were analyzed to the hints that we
re generated for the | 10923 * @return a table mapping the sources that were analyzed to the hints that we
re generated for the |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11105 TimestampedData<CompilationUnit> _getCompilationUnit(Source unitSource) => con
text.internalResolveCompilationUnit(unitSource, libraryElement); | 10989 TimestampedData<CompilationUnit> _getCompilationUnit(Source unitSource) => con
text.internalResolveCompilationUnit(unitSource, libraryElement); |
| 11106 } | 10990 } |
| 11107 | 10991 |
| 11108 /** | 10992 /** |
| 11109 * Instances of the class `GetContentTask` get the contents of a source. | 10993 * Instances of the class `GetContentTask` get the contents of a source. |
| 11110 */ | 10994 */ |
| 11111 class GetContentTask extends AnalysisTask { | 10995 class GetContentTask extends AnalysisTask { |
| 11112 /** | 10996 /** |
| 11113 * The source to be read. | 10997 * The source to be read. |
| 11114 */ | 10998 */ |
| 11115 final Source source; | 10999 Source source; |
| 11116 | 11000 |
| 11117 /** | 11001 /** |
| 11118 * A flag indicating whether this task is complete. | 11002 * A flag indicating whether this task is complete. |
| 11119 */ | 11003 */ |
| 11120 bool _complete = false; | 11004 bool _complete = false; |
| 11121 | 11005 |
| 11122 /** | 11006 /** |
| 11123 * The contents of the source. | 11007 * The contents of the source. |
| 11124 */ | 11008 */ |
| 11125 String _content; | 11009 String _content; |
| 11126 | 11010 |
| 11127 /** | 11011 /** |
| 11128 * The time at which the contents of the source were last modified. | 11012 * The time at which the contents of the source were last modified. |
| 11129 */ | 11013 */ |
| 11130 int _modificationTime = -1; | 11014 int _modificationTime = -1; |
| 11131 | 11015 |
| 11132 /** | 11016 /** |
| 11133 * Initialize a newly created task to perform analysis within the given contex
t. | 11017 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11134 * | 11018 * |
| 11135 * @param context the context in which the task is to be performed | 11019 * @param context the context in which the task is to be performed |
| 11136 * @param source the source to be parsed | 11020 * @param source the source to be parsed |
| 11137 * @param contentData the time-stamped contents of the source | 11021 * @param contentData the time-stamped contents of the source |
| 11138 */ | 11022 */ |
| 11139 GetContentTask(InternalAnalysisContext context, this.source) : super(context)
{ | 11023 GetContentTask(InternalAnalysisContext context, Source source) : super(context
) { |
| 11140 if (source == null) { | 11024 if (source == null) { |
| 11141 throw new IllegalArgumentException("Cannot get contents of null source"); | 11025 throw new IllegalArgumentException("Cannot get contents of null source"); |
| 11142 } | 11026 } |
| 11027 this.source = source; |
| 11143 } | 11028 } |
| 11144 | 11029 |
| 11145 @override | 11030 @override |
| 11146 accept(AnalysisTaskVisitor visitor) => visitor.visitGetContentTask(this); | 11031 accept(AnalysisTaskVisitor visitor) => visitor.visitGetContentTask(this); |
| 11147 | 11032 |
| 11148 /** | 11033 /** |
| 11149 * Return the contents of the source, or `null` if the task has not completed
or if there | 11034 * Return the contents of the source, or `null` if the task has not completed
or if there |
| 11150 * was an exception while getting the contents. | 11035 * was an exception while getting the contents. |
| 11151 * | 11036 * |
| 11152 * @return the contents of the source | 11037 * @return the contents of the source |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11188 } | 11073 } |
| 11189 } | 11074 } |
| 11190 | 11075 |
| 11191 /** | 11076 /** |
| 11192 * Instances of the class `IncrementalAnalysisTask` incrementally update existin
g analysis. | 11077 * Instances of the class `IncrementalAnalysisTask` incrementally update existin
g analysis. |
| 11193 */ | 11078 */ |
| 11194 class IncrementalAnalysisTask extends AnalysisTask { | 11079 class IncrementalAnalysisTask extends AnalysisTask { |
| 11195 /** | 11080 /** |
| 11196 * The information used to perform incremental analysis. | 11081 * The information used to perform incremental analysis. |
| 11197 */ | 11082 */ |
| 11198 final IncrementalAnalysisCache cache; | 11083 IncrementalAnalysisCache cache; |
| 11199 | 11084 |
| 11200 /** | 11085 /** |
| 11201 * The compilation unit that was produced by incrementally updating the existi
ng unit. | 11086 * The compilation unit that was produced by incrementally updating the existi
ng unit. |
| 11202 */ | 11087 */ |
| 11203 CompilationUnit _updatedUnit; | 11088 CompilationUnit _updatedUnit; |
| 11204 | 11089 |
| 11205 /** | 11090 /** |
| 11206 * Initialize a newly created task to perform analysis within the given contex
t. | 11091 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11207 * | 11092 * |
| 11208 * @param context the context in which the task is to be performed | 11093 * @param context the context in which the task is to be performed |
| 11209 * @param cache the incremental analysis cache used to perform the analysis | 11094 * @param cache the incremental analysis cache used to perform the analysis |
| 11210 */ | 11095 */ |
| 11211 IncrementalAnalysisTask(InternalAnalysisContext context, this.cache) : super(c
ontext); | 11096 IncrementalAnalysisTask(InternalAnalysisContext context, IncrementalAnalysisCa
che cache) : super(context) { |
| 11097 this.cache = cache; |
| 11098 } |
| 11212 | 11099 |
| 11213 @override | 11100 @override |
| 11214 accept(AnalysisTaskVisitor visitor) => visitor.visitIncrementalAnalysisTask(th
is); | 11101 accept(AnalysisTaskVisitor visitor) => visitor.visitIncrementalAnalysisTask(th
is); |
| 11215 | 11102 |
| 11216 /** | 11103 /** |
| 11217 * Return the compilation unit that was produced by incrementally updating the
existing | 11104 * Return the compilation unit that was produced by incrementally updating the
existing |
| 11218 * compilation unit, or `null` if the task has not yet been performed, could n
ot be | 11105 * compilation unit, or `null` if the task has not yet been performed, could n
ot be |
| 11219 * performed, or if an exception occurred. | 11106 * performed, or if an exception occurred. |
| 11220 * | 11107 * |
| 11221 * @return the compilation unit | 11108 * @return the compilation unit |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11280 } | 11167 } |
| 11281 } | 11168 } |
| 11282 | 11169 |
| 11283 /** | 11170 /** |
| 11284 * Instances of the class `ParseDartTask` parse a specific source as a Dart file
. | 11171 * Instances of the class `ParseDartTask` parse a specific source as a Dart file
. |
| 11285 */ | 11172 */ |
| 11286 class ParseDartTask extends AnalysisTask { | 11173 class ParseDartTask extends AnalysisTask { |
| 11287 /** | 11174 /** |
| 11288 * The source to be parsed. | 11175 * The source to be parsed. |
| 11289 */ | 11176 */ |
| 11290 final Source source; | 11177 Source source; |
| 11291 | 11178 |
| 11292 /** | 11179 /** |
| 11293 * The time at which the contents of the source were last modified. | 11180 * The time at which the contents of the source were last modified. |
| 11294 */ | 11181 */ |
| 11295 final int modificationTime; | 11182 int modificationTime = 0; |
| 11296 | 11183 |
| 11297 /** | 11184 /** |
| 11298 * The head of the token stream used for parsing. | 11185 * The head of the token stream used for parsing. |
| 11299 */ | 11186 */ |
| 11300 Token _tokenStream; | 11187 Token _tokenStream; |
| 11301 | 11188 |
| 11302 /** | 11189 /** |
| 11190 * The line information associated with the source. |
| 11191 */ |
| 11192 LineInfo _lineInfo; |
| 11193 |
| 11194 /** |
| 11303 * The compilation unit that was produced by parsing the source. | 11195 * The compilation unit that was produced by parsing the source. |
| 11304 */ | 11196 */ |
| 11305 CompilationUnit _unit; | 11197 CompilationUnit _unit; |
| 11306 | 11198 |
| 11307 /** | 11199 /** |
| 11308 * The errors that were produced by scanning and parsing the source. | 11200 * A flag indicating whether the source contains a 'library' directive. |
| 11309 */ | 11201 */ |
| 11310 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; | 11202 bool _containsLibraryDirective = false; |
| 11311 | 11203 |
| 11312 /** | 11204 /** |
| 11313 * A flag indicating whether the source contains a 'part of' directive. | 11205 * A flag indicating whether the source contains a 'part of' directive. |
| 11314 */ | 11206 */ |
| 11315 bool _containsPartOfDirective = false; | 11207 bool _containsPartOfDirective = false; |
| 11316 | 11208 |
| 11317 /** | 11209 /** |
| 11318 * A flag indicating whether the source contains a 'library' directive. | 11210 * A set containing the sources referenced by 'export' directives. |
| 11319 */ | 11211 */ |
| 11320 bool _containsLibraryDirective = false; | 11212 Set<Source> _exportedSources = new Set<Source>(); |
| 11213 |
| 11214 /** |
| 11215 * A set containing the sources referenced by 'import' directives. |
| 11216 */ |
| 11217 Set<Source> _importedSources = new Set<Source>(); |
| 11218 |
| 11219 /** |
| 11220 * A set containing the sources referenced by 'part' directives. |
| 11221 */ |
| 11222 Set<Source> _includedSources = new Set<Source>(); |
| 11223 |
| 11224 /** |
| 11225 * The errors that were produced by scanning and parsing the source. |
| 11226 */ |
| 11227 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; |
| 11228 |
| 11229 /** |
| 11230 * The prefix of a URI using the `dart-ext` scheme to reference a native code
library. |
| 11231 */ |
| 11232 static String _DART_EXT_SCHEME = "dart-ext:"; |
| 11321 | 11233 |
| 11322 /** | 11234 /** |
| 11323 * Initialize a newly created task to perform analysis within the given contex
t. | 11235 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11324 * | 11236 * |
| 11325 * @param context the context in which the task is to be performed | 11237 * @param context the context in which the task is to be performed |
| 11326 * @param source the source to be parsed | 11238 * @param source the source to be parsed |
| 11327 * @param modificationTime the time at which the contents of the source were l
ast modified | 11239 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 11328 * @param tokenStream the head of the token stream used for parsing | 11240 * @param tokenStream the head of the token stream used for parsing |
| 11241 * @param lineInfo the line information associated with the source |
| 11329 */ | 11242 */ |
| 11330 ParseDartTask(InternalAnalysisContext context, this.source, this.modificationT
ime, Token tokenStream) : super(context) { | 11243 ParseDartTask(InternalAnalysisContext context, Source source, int modification
Time, Token tokenStream, LineInfo lineInfo) : super(context) { |
| 11244 this.source = source; |
| 11245 this.modificationTime = modificationTime; |
| 11331 this._tokenStream = tokenStream; | 11246 this._tokenStream = tokenStream; |
| 11247 this._lineInfo = lineInfo; |
| 11332 } | 11248 } |
| 11333 | 11249 |
| 11334 @override | 11250 @override |
| 11335 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this); | 11251 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this); |
| 11336 | 11252 |
| 11337 /** | 11253 /** |
| 11338 * Return the compilation unit that was produced by parsing the source, or `nu
ll` if the | 11254 * Return the compilation unit that was produced by parsing the source, or `nu
ll` if the |
| 11339 * task has not yet been performed or if an exception occurred. | 11255 * task has not yet been performed or if an exception occurred. |
| 11340 * | 11256 * |
| 11341 * @return the compilation unit that was produced by parsing the source | 11257 * @return the compilation unit that was produced by parsing the source |
| 11342 */ | 11258 */ |
| 11343 CompilationUnit get compilationUnit => _unit; | 11259 CompilationUnit get compilationUnit => _unit; |
| 11344 | 11260 |
| 11345 /** | 11261 /** |
| 11346 * Return the errors that were produced by scanning and parsing the source, or
an empty array if | 11262 * Return the errors that were produced by scanning and parsing the source, or
an empty array if |
| 11347 * the task has not yet been performed or if an exception occurred. | 11263 * the task has not yet been performed or if an exception occurred. |
| 11348 * | 11264 * |
| 11349 * @return the errors that were produced by scanning and parsing the source | 11265 * @return the errors that were produced by scanning and parsing the source |
| 11350 */ | 11266 */ |
| 11351 List<AnalysisError> get errors => _errors; | 11267 List<AnalysisError> get errors => _errors; |
| 11352 | 11268 |
| 11353 /** | 11269 /** |
| 11270 * Return an array containing the sources referenced by 'export' directives, o
r an empty array if |
| 11271 * the task has not yet been performed or if an exception occurred. |
| 11272 * |
| 11273 * @return an array containing the sources referenced by 'export' directives |
| 11274 */ |
| 11275 List<Source> get exportedSources => _toArray(_exportedSources); |
| 11276 |
| 11277 /** |
| 11278 * Return an array containing the sources referenced by 'import' directives, o
r an empty array if |
| 11279 * the task has not yet been performed or if an exception occurred. |
| 11280 * |
| 11281 * @return an array containing the sources referenced by 'import' directives |
| 11282 */ |
| 11283 List<Source> get importedSources => _toArray(_importedSources); |
| 11284 |
| 11285 /** |
| 11286 * Return an array containing the sources referenced by 'part' directives, or
an empty array if |
| 11287 * the task has not yet been performed or if an exception occurred. |
| 11288 * |
| 11289 * @return an array containing the sources referenced by 'part' directives |
| 11290 */ |
| 11291 List<Source> get includedSources => _toArray(_includedSources); |
| 11292 |
| 11293 /** |
| 11354 * Return `true` if the source contains a 'library' directive, or `false` if t
he task | 11294 * Return `true` if the source contains a 'library' directive, or `false` if t
he task |
| 11355 * has not yet been performed or if an exception occurred. | 11295 * has not yet been performed or if an exception occurred. |
| 11356 * | 11296 * |
| 11357 * @return `true` if the source contains a 'library' directive | 11297 * @return `true` if the source contains a 'library' directive |
| 11358 */ | 11298 */ |
| 11359 bool get hasLibraryDirective => _containsLibraryDirective; | 11299 bool get hasLibraryDirective => _containsLibraryDirective; |
| 11360 | 11300 |
| 11361 /** | 11301 /** |
| 11362 * Return `true` if the source contains a 'part of' directive, or `false` if t
he task | 11302 * Return `true` if the source contains a 'part of' directive, or `false` if t
he task |
| 11363 * has not yet been performed or if an exception occurred. | 11303 * has not yet been performed or if an exception occurred. |
| 11364 * | 11304 * |
| 11365 * @return `true` if the source contains a 'part of' directive | 11305 * @return `true` if the source contains a 'part of' directive |
| 11366 */ | 11306 */ |
| 11367 bool get hasPartOfDirective => _containsPartOfDirective; | 11307 bool get hasPartOfDirective => _containsPartOfDirective; |
| 11368 | 11308 |
| 11369 @override | 11309 @override |
| 11370 String get taskDescription { | 11310 String get taskDescription { |
| 11371 if (source == null) { | 11311 if (source == null) { |
| 11372 return "parse as dart null source"; | 11312 return "parse as dart null source"; |
| 11373 } | 11313 } |
| 11374 return "parse as dart ${source.fullName}"; | 11314 return "parse as dart ${source.fullName}"; |
| 11375 } | 11315 } |
| 11376 | 11316 |
| 11377 @override | 11317 @override |
| 11378 void internalPerform() { | 11318 void internalPerform() { |
| 11379 RecordingErrorListener errorListener = new RecordingErrorListener(); | |
| 11380 InternalAnalysisContext context = this.context; | |
| 11381 // | 11319 // |
| 11382 // Then parse the token stream. | 11320 // Then parse the token stream. |
| 11383 // | 11321 // |
| 11384 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); | 11322 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); |
| 11385 try { | 11323 try { |
| 11324 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 11386 Parser parser = new Parser(source, errorListener); | 11325 Parser parser = new Parser(source, errorListener); |
| 11387 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies
; | 11326 parser.parseFunctionBodies = context.analysisOptions.analyzeFunctionBodies
; |
| 11388 _unit = parser.parseCompilationUnit(_tokenStream); | 11327 _unit = parser.parseCompilationUnit(_tokenStream); |
| 11328 _unit.lineInfo = _lineInfo; |
| 11389 _errors = errorListener.getErrorsForSource(source); | 11329 _errors = errorListener.getErrorsForSource(source); |
| 11390 for (Directive directive in _unit.directives) { | 11330 for (Directive directive in _unit.directives) { |
| 11391 if (directive is LibraryDirective) { | 11331 if (directive is ExportDirective) { |
| 11332 Source exportSource = _resolveSource(source, directive, errorListener)
; |
| 11333 if (exportSource != null) { |
| 11334 _exportedSources.add(exportSource); |
| 11335 } |
| 11336 } else if (directive is ImportDirective) { |
| 11337 Source importSource = _resolveSource(source, directive, errorListener)
; |
| 11338 if (importSource != null) { |
| 11339 _importedSources.add(importSource); |
| 11340 } |
| 11341 } else if (directive is LibraryDirective) { |
| 11392 _containsLibraryDirective = true; | 11342 _containsLibraryDirective = true; |
| 11343 } else if (directive is PartDirective) { |
| 11344 Source partSource = _resolveSource(source, directive, errorListener); |
| 11345 if (partSource != null) { |
| 11346 _includedSources.add(partSource); |
| 11347 } |
| 11393 } else if (directive is PartOfDirective) { | 11348 } else if (directive is PartOfDirective) { |
| 11394 _containsPartOfDirective = true; | 11349 _containsPartOfDirective = true; |
| 11395 } | 11350 } |
| 11396 } | 11351 } |
| 11397 _unit.lineInfo = context.getLineInfo(source); | |
| 11398 } finally { | 11352 } finally { |
| 11399 timeCounterParse.stop(); | 11353 timeCounterParse.stop(); |
| 11400 } | 11354 } |
| 11401 } | 11355 } |
| 11356 |
| 11357 /** |
| 11358 * Return the result of resolving the URI of the given URI-based directive aga
inst the URI of the |
| 11359 * given library, or `null` if the URI is not valid. |
| 11360 * |
| 11361 * @param librarySource the source representing the library containing the dir
ective |
| 11362 * @param directive the directive which URI should be resolved |
| 11363 * @param errorListener the error listener to which errors should be reported |
| 11364 * @return the result of resolving the URI against the URI of the library |
| 11365 */ |
| 11366 Source _resolveSource(Source librarySource, UriBasedDirective directive, Analy
sisErrorListener errorListener) { |
| 11367 StringLiteral uriLiteral = directive.uri; |
| 11368 if (uriLiteral is StringInterpolation) { |
| 11369 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION, [])); |
| 11370 return null; |
| 11371 } |
| 11372 String uriContent = uriLiteral.stringValue.trim(); |
| 11373 directive.uriContent = uriContent; |
| 11374 if (directive is ImportDirective && uriContent.startsWith(_DART_EXT_SCHEME))
{ |
| 11375 return null; |
| 11376 } |
| 11377 try { |
| 11378 String encodedUriContent = Uri.encodeFull(uriContent); |
| 11379 parseUriWithException(encodedUriContent); |
| 11380 AnalysisContext analysisContext = context; |
| 11381 Source source = analysisContext.sourceFactory.resolveUri(librarySource, en
codedUriContent); |
| 11382 if (!analysisContext.exists(source)) { |
| 11383 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.o
ffset, uriLiteral.length, CompileTimeErrorCode.URI_DOES_NOT_EXIST, [uriContent])
); |
| 11384 } |
| 11385 directive.source = source; |
| 11386 return source; |
| 11387 } on URISyntaxException catch (exception) { |
| 11388 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); |
| 11389 } |
| 11390 return null; |
| 11391 } |
| 11392 |
| 11393 /** |
| 11394 * Efficiently convert the given set of sources to an array. |
| 11395 * |
| 11396 * @param sources the set to be converted |
| 11397 * @return an array containing all of the sources in the given set |
| 11398 */ |
| 11399 List<Source> _toArray(Set<Source> sources) { |
| 11400 int size = sources.length; |
| 11401 if (size == 0) { |
| 11402 return Source.EMPTY_ARRAY; |
| 11403 } |
| 11404 return new List.from(sources); |
| 11405 } |
| 11402 } | 11406 } |
| 11403 | 11407 |
| 11404 /** | 11408 /** |
| 11405 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil
e. | 11409 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil
e. |
| 11406 */ | 11410 */ |
| 11407 class ParseHtmlTask extends AnalysisTask { | 11411 class ParseHtmlTask extends AnalysisTask { |
| 11408 /** | 11412 /** |
| 11409 * The source to be parsed. | 11413 * The source to be parsed. |
| 11410 */ | 11414 */ |
| 11411 final Source source; | 11415 Source source; |
| 11412 | 11416 |
| 11413 /** | 11417 /** |
| 11414 * The time at which the contents of the source were last modified. | 11418 * The time at which the contents of the source were last modified. |
| 11415 */ | 11419 */ |
| 11416 final int modificationTime; | 11420 int modificationTime = 0; |
| 11417 | 11421 |
| 11418 /** | 11422 /** |
| 11419 * The contents of the source. | 11423 * The contents of the source. |
| 11420 */ | 11424 */ |
| 11421 String _content; | 11425 String _content; |
| 11422 | 11426 |
| 11423 /** | 11427 /** |
| 11424 * The line information that was produced. | 11428 * The line information that was produced. |
| 11425 */ | 11429 */ |
| 11426 LineInfo _lineInfo; | 11430 LineInfo _lineInfo; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 11451 static String _TAG_SCRIPT = "script"; | 11455 static String _TAG_SCRIPT = "script"; |
| 11452 | 11456 |
| 11453 /** | 11457 /** |
| 11454 * Initialize a newly created task to perform analysis within the given contex
t. | 11458 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11455 * | 11459 * |
| 11456 * @param context the context in which the task is to be performed | 11460 * @param context the context in which the task is to be performed |
| 11457 * @param source the source to be parsed | 11461 * @param source the source to be parsed |
| 11458 * @param modificationTime the time at which the contents of the source were l
ast modified | 11462 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 11459 * @param content the contents of the source | 11463 * @param content the contents of the source |
| 11460 */ | 11464 */ |
| 11461 ParseHtmlTask(InternalAnalysisContext context, this.source, this.modificationT
ime, String content) : super(context) { | 11465 ParseHtmlTask(InternalAnalysisContext context, Source source, int modification
Time, String content) : super(context) { |
| 11466 this.source = source; |
| 11467 this.modificationTime = modificationTime; |
| 11462 this._content = content; | 11468 this._content = content; |
| 11463 } | 11469 } |
| 11464 | 11470 |
| 11465 @override | 11471 @override |
| 11466 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this); | 11472 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this); |
| 11467 | 11473 |
| 11468 /** | 11474 /** |
| 11469 * Return the errors that were produced by scanning and parsing the source, or
`null` if the | 11475 * Return the errors that were produced by scanning and parsing the source, or
`null` if the |
| 11470 * task has not yet been performed or if an exception occurred. | 11476 * task has not yet been performed or if an exception occurred. |
| 11471 * | 11477 * |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11565 } | 11571 } |
| 11566 | 11572 |
| 11567 /** | 11573 /** |
| 11568 * Instances of the class `ResolveAngularComponentTemplateTask` resolve HTML tem
plate | 11574 * Instances of the class `ResolveAngularComponentTemplateTask` resolve HTML tem
plate |
| 11569 * referenced by [AngularComponentElement]. | 11575 * referenced by [AngularComponentElement]. |
| 11570 */ | 11576 */ |
| 11571 class ResolveAngularComponentTemplateTask extends AnalysisTask { | 11577 class ResolveAngularComponentTemplateTask extends AnalysisTask { |
| 11572 /** | 11578 /** |
| 11573 * The source to be resolved. | 11579 * The source to be resolved. |
| 11574 */ | 11580 */ |
| 11575 final Source source; | 11581 Source source; |
| 11576 | 11582 |
| 11577 /** | 11583 /** |
| 11578 * The time at which the contents of the source were last modified. | 11584 * The time at which the contents of the source were last modified. |
| 11579 */ | 11585 */ |
| 11580 final int modificationTime; | 11586 int modificationTime = 0; |
| 11581 | 11587 |
| 11582 /** | 11588 /** |
| 11583 * The HTML unit to be resolved. | 11589 * The HTML unit to be resolved. |
| 11584 */ | 11590 */ |
| 11585 ht.HtmlUnit _unit; | 11591 ht.HtmlUnit _unit; |
| 11586 | 11592 |
| 11587 /** | 11593 /** |
| 11588 * The [AngularComponentElement] to resolve template for. | 11594 * The [AngularComponentElement] to resolve template for. |
| 11589 */ | 11595 */ |
| 11590 AngularComponentElement _component; | 11596 AngularComponentElement _component; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 11607 /** | 11613 /** |
| 11608 * Initialize a newly created task to perform analysis within the given contex
t. | 11614 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11609 * | 11615 * |
| 11610 * @param context the context in which the task is to be performed | 11616 * @param context the context in which the task is to be performed |
| 11611 * @param source the source to be resolved | 11617 * @param source the source to be resolved |
| 11612 * @param modificationTime the time at which the contents of the source were l
ast modified | 11618 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 11613 * @param unit the HTML unit to be resolved | 11619 * @param unit the HTML unit to be resolved |
| 11614 * @param component the component that uses this HTML template, not `null` | 11620 * @param component the component that uses this HTML template, not `null` |
| 11615 * @param application the Angular application to resolve in context of | 11621 * @param application the Angular application to resolve in context of |
| 11616 */ | 11622 */ |
| 11617 ResolveAngularComponentTemplateTask(InternalAnalysisContext context, this.sour
ce, this.modificationTime, ht.HtmlUnit unit, AngularComponentElement component,
AngularApplication application) : super(context) { | 11623 ResolveAngularComponentTemplateTask(InternalAnalysisContext context, Source so
urce, int modificationTime, ht.HtmlUnit unit, AngularComponentElement component,
AngularApplication application) : super(context) { |
| 11624 this.source = source; |
| 11625 this.modificationTime = modificationTime; |
| 11618 this._unit = unit; | 11626 this._unit = unit; |
| 11619 this._component = component; | 11627 this._component = component; |
| 11620 this._application = application; | 11628 this._application = application; |
| 11621 } | 11629 } |
| 11622 | 11630 |
| 11623 @override | 11631 @override |
| 11624 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularComponentTem
plateTask(this); | 11632 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularComponentTem
plateTask(this); |
| 11625 | 11633 |
| 11626 List<AnalysisError> get resolutionErrors => _resolutionErrors; | 11634 List<AnalysisError> get resolutionErrors => _resolutionErrors; |
| 11627 | 11635 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 11658 } | 11666 } |
| 11659 | 11667 |
| 11660 /** | 11668 /** |
| 11661 * Instances of the class `ResolveAngularEntryHtmlTask` resolve a specific HTML
file as an | 11669 * Instances of the class `ResolveAngularEntryHtmlTask` resolve a specific HTML
file as an |
| 11662 * Angular entry point. | 11670 * Angular entry point. |
| 11663 */ | 11671 */ |
| 11664 class ResolveAngularEntryHtmlTask extends AnalysisTask { | 11672 class ResolveAngularEntryHtmlTask extends AnalysisTask { |
| 11665 /** | 11673 /** |
| 11666 * The source to be resolved. | 11674 * The source to be resolved. |
| 11667 */ | 11675 */ |
| 11668 final Source source; | 11676 Source source; |
| 11669 | 11677 |
| 11670 /** | 11678 /** |
| 11671 * The time at which the contents of the source were last modified. | 11679 * The time at which the contents of the source were last modified. |
| 11672 */ | 11680 */ |
| 11673 final int modificationTime; | 11681 int modificationTime = 0; |
| 11674 | 11682 |
| 11675 /** | 11683 /** |
| 11676 * The HTML unit to be resolved. | 11684 * The HTML unit to be resolved. |
| 11677 */ | 11685 */ |
| 11678 ht.HtmlUnit _unit; | 11686 ht.HtmlUnit _unit; |
| 11679 | 11687 |
| 11680 /** | 11688 /** |
| 11681 * The listener to record errors. | 11689 * The listener to record errors. |
| 11682 */ | 11690 */ |
| 11683 RecordingErrorListener _errorListener = new RecordingErrorListener(); | 11691 RecordingErrorListener _errorListener = new RecordingErrorListener(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 11698 AngularApplication _application; | 11706 AngularApplication _application; |
| 11699 | 11707 |
| 11700 /** | 11708 /** |
| 11701 * Initialize a newly created task to perform analysis within the given contex
t. | 11709 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11702 * | 11710 * |
| 11703 * @param context the context in which the task is to be performed | 11711 * @param context the context in which the task is to be performed |
| 11704 * @param source the source to be resolved | 11712 * @param source the source to be resolved |
| 11705 * @param modificationTime the time at which the contents of the source were l
ast modified | 11713 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 11706 * @param unit the HTML unit to be resolved | 11714 * @param unit the HTML unit to be resolved |
| 11707 */ | 11715 */ |
| 11708 ResolveAngularEntryHtmlTask(InternalAnalysisContext context, this.source, this
.modificationTime, ht.HtmlUnit unit) : super(context) { | 11716 ResolveAngularEntryHtmlTask(InternalAnalysisContext context, Source source, in
t modificationTime, ht.HtmlUnit unit) : super(context) { |
| 11717 this.source = source; |
| 11718 this.modificationTime = modificationTime; |
| 11709 this._unit = unit; | 11719 this._unit = unit; |
| 11710 } | 11720 } |
| 11711 | 11721 |
| 11712 @override | 11722 @override |
| 11713 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularEntryHtmlTas
k(this); | 11723 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveAngularEntryHtmlTas
k(this); |
| 11714 | 11724 |
| 11715 /** | 11725 /** |
| 11716 * Returns the [AngularApplication] for the Web application with this Angular
entry point, | 11726 * Returns the [AngularApplication] for the Web application with this Angular
entry point, |
| 11717 * maybe `null` if not an Angular entry point. | 11727 * maybe `null` if not an Angular entry point. |
| 11718 */ | 11728 */ |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11762 new AngularHtmlUnitResolver(context, _errorListener, source, lineInfo, _un
it).resolveEntryPoint(_application); | 11772 new AngularHtmlUnitResolver(context, _errorListener, source, lineInfo, _un
it).resolveEntryPoint(_application); |
| 11763 } | 11773 } |
| 11764 // | 11774 // |
| 11765 // Remember the resolved unit. | 11775 // Remember the resolved unit. |
| 11766 // | 11776 // |
| 11767 _resolvedUnit = _unit; | 11777 _resolvedUnit = _unit; |
| 11768 } | 11778 } |
| 11769 } | 11779 } |
| 11770 | 11780 |
| 11771 /** | 11781 /** |
| 11772 * Instances of the class `ResolveDartDependenciesTask` resolve the import, expo
rt, and part | 11782 * Instances of the class `ResolveDartLibraryTask` resolve a specific Dart libra
ry. |
| 11773 * directives in a single source. | |
| 11774 */ | |
| 11775 class ResolveDartDependenciesTask extends AnalysisTask { | |
| 11776 /** | |
| 11777 * The source containing the directives to be resolved. | |
| 11778 */ | |
| 11779 final Source source; | |
| 11780 | |
| 11781 /** | |
| 11782 * The time at which the contents of the source were last modified. | |
| 11783 */ | |
| 11784 final int modificationTime; | |
| 11785 | |
| 11786 /** | |
| 11787 * The compilation unit used to resolve the dependencies. | |
| 11788 */ | |
| 11789 CompilationUnit _unit; | |
| 11790 | |
| 11791 /** | |
| 11792 * A set containing the sources referenced by 'export' directives. | |
| 11793 */ | |
| 11794 Set<Source> _exportedSources = new Set<Source>(); | |
| 11795 | |
| 11796 /** | |
| 11797 * A set containing the sources referenced by 'import' directives. | |
| 11798 */ | |
| 11799 Set<Source> _importedSources = new Set<Source>(); | |
| 11800 | |
| 11801 /** | |
| 11802 * A set containing the sources referenced by 'part' directives. | |
| 11803 */ | |
| 11804 Set<Source> _includedSources = new Set<Source>(); | |
| 11805 | |
| 11806 /** | |
| 11807 * The errors that were produced by resolving the directives. | |
| 11808 */ | |
| 11809 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; | |
| 11810 | |
| 11811 /** | |
| 11812 * The prefix of a URI using the `dart-ext` scheme to reference a native code
library. | |
| 11813 */ | |
| 11814 static String _DART_EXT_SCHEME = "dart-ext:"; | |
| 11815 | |
| 11816 /** | |
| 11817 * Initialize a newly created task to perform analysis within the given contex
t. | |
| 11818 * | |
| 11819 * @param context the context in which the task is to be performed | |
| 11820 * @param source the source to be parsed | |
| 11821 * @param modificationTime the time at which the contents of the source were l
ast modified | |
| 11822 * @param unit the compilation unit used to resolve the dependencies | |
| 11823 */ | |
| 11824 ResolveDartDependenciesTask(InternalAnalysisContext context, this.source, this
.modificationTime, CompilationUnit unit) : super(context) { | |
| 11825 this._unit = unit; | |
| 11826 } | |
| 11827 | |
| 11828 @override | |
| 11829 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartDependenciesTas
k(this); | |
| 11830 | |
| 11831 /** | |
| 11832 * Return the errors that were produced by resolving the directives, or an emp
ty array if the task | |
| 11833 * has not yet been performed or if an exception occurred. | |
| 11834 * | |
| 11835 * @return the errors that were produced by resolving the directives. | |
| 11836 */ | |
| 11837 List<AnalysisError> get errors => _errors; | |
| 11838 | |
| 11839 /** | |
| 11840 * Return an array containing the sources referenced by 'export' directives, o
r an empty array if | |
| 11841 * the task has not yet been performed or if an exception occurred. | |
| 11842 * | |
| 11843 * @return an array containing the sources referenced by 'export' directives | |
| 11844 */ | |
| 11845 List<Source> get exportedSources => _toArray(_exportedSources); | |
| 11846 | |
| 11847 /** | |
| 11848 * Return an array containing the sources referenced by 'import' directives, o
r an empty array if | |
| 11849 * the task has not yet been performed or if an exception occurred. | |
| 11850 * | |
| 11851 * @return an array containing the sources referenced by 'import' directives | |
| 11852 */ | |
| 11853 List<Source> get importedSources => _toArray(_importedSources); | |
| 11854 | |
| 11855 /** | |
| 11856 * Return an array containing the sources referenced by 'part' directives, or
an empty array if | |
| 11857 * the task has not yet been performed or if an exception occurred. | |
| 11858 * | |
| 11859 * @return an array containing the sources referenced by 'part' directives | |
| 11860 */ | |
| 11861 List<Source> get includedSources => _toArray(_includedSources); | |
| 11862 | |
| 11863 @override | |
| 11864 String get taskDescription { | |
| 11865 if (source == null) { | |
| 11866 return "resolve dart dependencies null source"; | |
| 11867 } | |
| 11868 return "resolve dart dependencies ${source.fullName}"; | |
| 11869 } | |
| 11870 | |
| 11871 @override | |
| 11872 void internalPerform() { | |
| 11873 TimeCounter_TimeCounterHandle timeCounterParse = PerformanceStatistics.parse
.start(); | |
| 11874 try { | |
| 11875 RecordingErrorListener errorListener = new RecordingErrorListener(); | |
| 11876 for (Directive directive in _unit.directives) { | |
| 11877 if (directive is ExportDirective) { | |
| 11878 Source exportSource = _resolveSource(source, directive, errorListener)
; | |
| 11879 if (exportSource != null) { | |
| 11880 _exportedSources.add(exportSource); | |
| 11881 } | |
| 11882 } else if (directive is ImportDirective) { | |
| 11883 Source importSource = _resolveSource(source, directive, errorListener)
; | |
| 11884 if (importSource != null) { | |
| 11885 _importedSources.add(importSource); | |
| 11886 } | |
| 11887 } else if (directive is PartDirective) { | |
| 11888 Source partSource = _resolveSource(source, directive, errorListener); | |
| 11889 if (partSource != null) { | |
| 11890 _includedSources.add(partSource); | |
| 11891 } | |
| 11892 } | |
| 11893 } | |
| 11894 _errors = errorListener.errors; | |
| 11895 } finally { | |
| 11896 timeCounterParse.stop(); | |
| 11897 } | |
| 11898 } | |
| 11899 | |
| 11900 /** | |
| 11901 * Return the result of resolving the URI of the given URI-based directive aga
inst the URI of the | |
| 11902 * given library, or `null` if the URI is not valid. | |
| 11903 * | |
| 11904 * @param librarySource the source representing the library containing the dir
ective | |
| 11905 * @param directive the directive which URI should be resolved | |
| 11906 * @param errorListener the error listener to which errors should be reported | |
| 11907 * @return the result of resolving the URI against the URI of the library | |
| 11908 */ | |
| 11909 Source _resolveSource(Source librarySource, UriBasedDirective directive, Analy
sisErrorListener errorListener) { | |
| 11910 StringLiteral uriLiteral = directive.uri; | |
| 11911 if (uriLiteral is StringInterpolation) { | |
| 11912 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.URI_WITH_INTERPOLATION, [])); | |
| 11913 return null; | |
| 11914 } | |
| 11915 String uriContent = uriLiteral.stringValue.trim(); | |
| 11916 directive.uriContent = uriContent; | |
| 11917 if (directive is ImportDirective && uriContent.startsWith(_DART_EXT_SCHEME))
{ | |
| 11918 return null; | |
| 11919 } | |
| 11920 try { | |
| 11921 String encodedUriContent = Uri.encodeFull(uriContent); | |
| 11922 parseUriWithException(encodedUriContent); | |
| 11923 AnalysisContext analysisContext = context; | |
| 11924 Source source = analysisContext.sourceFactory.resolveUri(librarySource, en
codedUriContent); | |
| 11925 if (!analysisContext.exists(source)) { | |
| 11926 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.o
ffset, uriLiteral.length, CompileTimeErrorCode.URI_DOES_NOT_EXIST, [uriContent])
); | |
| 11927 } | |
| 11928 directive.source = source; | |
| 11929 return source; | |
| 11930 } on URISyntaxException catch (exception) { | |
| 11931 errorListener.onError(new AnalysisError.con2(librarySource, uriLiteral.off
set, uriLiteral.length, CompileTimeErrorCode.INVALID_URI, [uriContent])); | |
| 11932 } | |
| 11933 return null; | |
| 11934 } | |
| 11935 | |
| 11936 /** | |
| 11937 * Efficiently convert the given set of sources to an array. | |
| 11938 * | |
| 11939 * @param sources the set to be converted | |
| 11940 * @return an array containing all of the sources in the given set | |
| 11941 */ | |
| 11942 List<Source> _toArray(Set<Source> sources) { | |
| 11943 int size = sources.length; | |
| 11944 if (size == 0) { | |
| 11945 return Source.EMPTY_ARRAY; | |
| 11946 } | |
| 11947 return new List.from(sources); | |
| 11948 } | |
| 11949 } | |
| 11950 | |
| 11951 /** | |
| 11952 * Instances of the class `ResolveDartLibraryTask` parse a specific Dart library
. | |
| 11953 */ | 11783 */ |
| 11954 class ResolveDartLibraryTask extends AnalysisTask { | 11784 class ResolveDartLibraryTask extends AnalysisTask { |
| 11955 /** | 11785 /** |
| 11956 * The source representing the file whose compilation unit is to be returned. | 11786 * The source representing the file whose compilation unit is to be returned. |
| 11957 */ | 11787 */ |
| 11958 final Source unitSource; | 11788 Source unitSource; |
| 11959 | 11789 |
| 11960 /** | 11790 /** |
| 11961 * The source representing the library to be resolved. | 11791 * The source representing the library to be resolved. |
| 11962 */ | 11792 */ |
| 11963 final Source librarySource; | 11793 Source librarySource; |
| 11964 | 11794 |
| 11965 /** | 11795 /** |
| 11966 * The library resolver holding information about the libraries that were reso
lved. | 11796 * The library resolver holding information about the libraries that were reso
lved. |
| 11967 */ | 11797 */ |
| 11968 LibraryResolver _resolver; | 11798 LibraryResolver _resolver; |
| 11969 | 11799 |
| 11970 /** | 11800 /** |
| 11971 * Initialize a newly created task to perform analysis within the given contex
t. | 11801 * Initialize a newly created task to perform analysis within the given contex
t. |
| 11972 * | 11802 * |
| 11973 * @param context the context in which the task is to be performed | 11803 * @param context the context in which the task is to be performed |
| 11974 * @param unitSource the source representing the file whose compilation unit i
s to be returned | 11804 * @param unitSource the source representing the file whose compilation unit i
s to be returned |
| 11975 * @param librarySource the source representing the library to be resolved | 11805 * @param librarySource the source representing the library to be resolved |
| 11976 */ | 11806 */ |
| 11977 ResolveDartLibraryTask(InternalAnalysisContext context, this.unitSource, this.
librarySource) : super(context); | 11807 ResolveDartLibraryTask(InternalAnalysisContext context, Source unitSource, Sou
rce librarySource) : super(context) { |
| 11808 this.unitSource = unitSource; |
| 11809 this.librarySource = librarySource; |
| 11810 } |
| 11978 | 11811 |
| 11979 @override | 11812 @override |
| 11980 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartLibraryTask(thi
s); | 11813 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartLibraryTask(thi
s); |
| 11981 | 11814 |
| 11982 /** | 11815 /** |
| 11983 * Return the library resolver holding information about the libraries that we
re resolved. | 11816 * Return the library resolver holding information about the libraries that we
re resolved. |
| 11984 * | 11817 * |
| 11985 * @return the library resolver holding information about the libraries that w
ere resolved | 11818 * @return the library resolver holding information about the libraries that w
ere resolved |
| 11986 */ | 11819 */ |
| 11987 LibraryResolver get libraryResolver => _resolver; | 11820 LibraryResolver get libraryResolver => _resolver; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 12002 } | 11835 } |
| 12003 | 11836 |
| 12004 /** | 11837 /** |
| 12005 * Instances of the class `ResolveDartUnitTask` resolve a single Dart file based
on a existing | 11838 * Instances of the class `ResolveDartUnitTask` resolve a single Dart file based
on a existing |
| 12006 * element model. | 11839 * element model. |
| 12007 */ | 11840 */ |
| 12008 class ResolveDartUnitTask extends AnalysisTask { | 11841 class ResolveDartUnitTask extends AnalysisTask { |
| 12009 /** | 11842 /** |
| 12010 * The source that is to be resolved. | 11843 * The source that is to be resolved. |
| 12011 */ | 11844 */ |
| 12012 final Source source; | 11845 Source source; |
| 12013 | 11846 |
| 12014 /** | 11847 /** |
| 12015 * The element model for the library containing the source. | 11848 * The element model for the library containing the source. |
| 12016 */ | 11849 */ |
| 12017 LibraryElement _libraryElement; | 11850 LibraryElement _libraryElement; |
| 12018 | 11851 |
| 12019 /** | 11852 /** |
| 12020 * The time at which the contents of the source were last modified. | 11853 * The time at which the contents of the source were last modified. |
| 12021 */ | 11854 */ |
| 12022 int _modificationTime = -1; | 11855 int _modificationTime = -1; |
| 12023 | 11856 |
| 12024 /** | 11857 /** |
| 12025 * The compilation unit that was resolved by this task. | 11858 * The compilation unit that was resolved by this task. |
| 12026 */ | 11859 */ |
| 12027 CompilationUnit _resolvedUnit; | 11860 CompilationUnit _resolvedUnit; |
| 12028 | 11861 |
| 12029 /** | 11862 /** |
| 12030 * Initialize a newly created task to perform analysis within the given contex
t. | 11863 * Initialize a newly created task to perform analysis within the given contex
t. |
| 12031 * | 11864 * |
| 12032 * @param context the context in which the task is to be performed | 11865 * @param context the context in which the task is to be performed |
| 12033 * @param source the source to be parsed | 11866 * @param source the source to be parsed |
| 12034 * @param libraryElement the element model for the library containing the sour
ce | 11867 * @param libraryElement the element model for the library containing the sour
ce |
| 12035 */ | 11868 */ |
| 12036 ResolveDartUnitTask(InternalAnalysisContext context, this.source, LibraryEleme
nt libraryElement) : super(context) { | 11869 ResolveDartUnitTask(InternalAnalysisContext context, Source source, LibraryEle
ment libraryElement) : super(context) { |
| 11870 this.source = source; |
| 12037 this._libraryElement = libraryElement; | 11871 this._libraryElement = libraryElement; |
| 12038 } | 11872 } |
| 12039 | 11873 |
| 12040 @override | 11874 @override |
| 12041 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this); | 11875 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this); |
| 12042 | 11876 |
| 12043 /** | 11877 /** |
| 12044 * Return the source for the library containing the source that is to be resol
ved. | 11878 * Return the source for the library containing the source that is to be resol
ved. |
| 12045 * | 11879 * |
| 12046 * @return the source for the library containing the source that is to be reso
lved | 11880 * @return the source for the library containing the source that is to be reso
lved |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12144 } | 11978 } |
| 12145 } | 11979 } |
| 12146 | 11980 |
| 12147 /** | 11981 /** |
| 12148 * Instances of the class `ResolveHtmlTask` resolve a specific source as an HTML
file. | 11982 * Instances of the class `ResolveHtmlTask` resolve a specific source as an HTML
file. |
| 12149 */ | 11983 */ |
| 12150 class ResolveHtmlTask extends AnalysisTask { | 11984 class ResolveHtmlTask extends AnalysisTask { |
| 12151 /** | 11985 /** |
| 12152 * The source to be resolved. | 11986 * The source to be resolved. |
| 12153 */ | 11987 */ |
| 12154 final Source source; | 11988 Source source; |
| 12155 | 11989 |
| 12156 /** | 11990 /** |
| 12157 * The time at which the contents of the source were last modified. | 11991 * The time at which the contents of the source were last modified. |
| 12158 */ | 11992 */ |
| 12159 final int modificationTime; | 11993 int modificationTime = 0; |
| 12160 | 11994 |
| 12161 /** | 11995 /** |
| 12162 * The HTML unit to be resolved. | 11996 * The HTML unit to be resolved. |
| 12163 */ | 11997 */ |
| 12164 ht.HtmlUnit _unit; | 11998 ht.HtmlUnit _unit; |
| 12165 | 11999 |
| 12166 /** | 12000 /** |
| 12167 * The [HtmlUnit] that was resolved by this task. | 12001 * The [HtmlUnit] that was resolved by this task. |
| 12168 */ | 12002 */ |
| 12169 ht.HtmlUnit _resolvedUnit; | 12003 ht.HtmlUnit _resolvedUnit; |
| 12170 | 12004 |
| 12171 /** | 12005 /** |
| 12172 * The element produced by resolving the source. | 12006 * The element produced by resolving the source. |
| 12173 */ | 12007 */ |
| 12174 HtmlElement _element = null; | 12008 HtmlElement _element = null; |
| 12175 | 12009 |
| 12176 /** | 12010 /** |
| 12177 * The resolution errors that were discovered while resolving the source. | 12011 * The resolution errors that were discovered while resolving the source. |
| 12178 */ | 12012 */ |
| 12179 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; | 12013 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; |
| 12180 | 12014 |
| 12181 /** | 12015 /** |
| 12182 * Initialize a newly created task to perform analysis within the given contex
t. | 12016 * Initialize a newly created task to perform analysis within the given contex
t. |
| 12183 * | 12017 * |
| 12184 * @param context the context in which the task is to be performed | 12018 * @param context the context in which the task is to be performed |
| 12185 * @param source the source to be resolved | 12019 * @param source the source to be resolved |
| 12186 * @param modificationTime the time at which the contents of the source were l
ast modified | 12020 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 12187 * @param unit the HTML unit to be resolved | 12021 * @param unit the HTML unit to be resolved |
| 12188 */ | 12022 */ |
| 12189 ResolveHtmlTask(InternalAnalysisContext context, this.source, this.modificatio
nTime, ht.HtmlUnit unit) : super(context) { | 12023 ResolveHtmlTask(InternalAnalysisContext context, Source source, int modificati
onTime, ht.HtmlUnit unit) : super(context) { |
| 12024 this.source = source; |
| 12025 this.modificationTime = modificationTime; |
| 12190 this._unit = unit; | 12026 this._unit = unit; |
| 12191 } | 12027 } |
| 12192 | 12028 |
| 12193 @override | 12029 @override |
| 12194 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveHtmlTask(this); | 12030 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveHtmlTask(this); |
| 12195 | 12031 |
| 12196 HtmlElement get element => _element; | 12032 HtmlElement get element => _element; |
| 12197 | 12033 |
| 12198 List<AnalysisError> get resolutionErrors => _resolutionErrors; | 12034 List<AnalysisError> get resolutionErrors => _resolutionErrors; |
| 12199 | 12035 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12231 } | 12067 } |
| 12232 } | 12068 } |
| 12233 | 12069 |
| 12234 /** | 12070 /** |
| 12235 * Instances of the class `ScanDartTask` scan a specific source as a Dart file. | 12071 * Instances of the class `ScanDartTask` scan a specific source as a Dart file. |
| 12236 */ | 12072 */ |
| 12237 class ScanDartTask extends AnalysisTask { | 12073 class ScanDartTask extends AnalysisTask { |
| 12238 /** | 12074 /** |
| 12239 * The source to be scanned. | 12075 * The source to be scanned. |
| 12240 */ | 12076 */ |
| 12241 final Source source; | 12077 Source source; |
| 12242 | 12078 |
| 12243 /** | 12079 /** |
| 12244 * The time at which the contents of the source were last modified. | 12080 * The time at which the contents of the source were last modified. |
| 12245 */ | 12081 */ |
| 12246 final int modificationTime; | 12082 int modificationTime = 0; |
| 12247 | 12083 |
| 12248 /** | 12084 /** |
| 12249 * The contents of the source. | 12085 * The contents of the source. |
| 12250 */ | 12086 */ |
| 12251 String _content; | 12087 String _content; |
| 12252 | 12088 |
| 12253 /** | 12089 /** |
| 12254 * The token stream that was produced by scanning the source. | 12090 * The token stream that was produced by scanning the source. |
| 12255 */ | 12091 */ |
| 12256 Token _tokenStream; | 12092 Token _tokenStream; |
| 12257 | 12093 |
| 12258 /** | 12094 /** |
| 12259 * The line information that was produced. | 12095 * The line information that was produced. |
| 12260 */ | 12096 */ |
| 12261 LineInfo _lineInfo; | 12097 LineInfo _lineInfo; |
| 12262 | 12098 |
| 12263 /** | 12099 /** |
| 12264 * The errors that were produced by scanning the source. | 12100 * The errors that were produced by scanning the source. |
| 12265 */ | 12101 */ |
| 12266 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; | 12102 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; |
| 12267 | 12103 |
| 12268 /** | 12104 /** |
| 12269 * Initialize a newly created task to perform analysis within the given contex
t. | 12105 * Initialize a newly created task to perform analysis within the given contex
t. |
| 12270 * | 12106 * |
| 12271 * @param context the context in which the task is to be performed | 12107 * @param context the context in which the task is to be performed |
| 12272 * @param source the source to be parsed | 12108 * @param source the source to be parsed |
| 12273 * @param modificationTime the time at which the contents of the source were l
ast modified | 12109 * @param modificationTime the time at which the contents of the source were l
ast modified |
| 12274 * @param content the contents of the source | 12110 * @param content the contents of the source |
| 12275 */ | 12111 */ |
| 12276 ScanDartTask(InternalAnalysisContext context, this.source, this.modificationTi
me, String content) : super(context) { | 12112 ScanDartTask(InternalAnalysisContext context, Source source, int modificationT
ime, String content) : super(context) { |
| 12113 this.source = source; |
| 12114 this.modificationTime = modificationTime; |
| 12277 this._content = content; | 12115 this._content = content; |
| 12278 } | 12116 } |
| 12279 | 12117 |
| 12280 @override | 12118 @override |
| 12281 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this); | 12119 accept(AnalysisTaskVisitor visitor) => visitor.visitScanDartTask(this); |
| 12282 | 12120 |
| 12283 /** | 12121 /** |
| 12284 * Return the errors that were produced by scanning the source, or `null` if t
he task has | 12122 * Return the errors that were produced by scanning the source, or `null` if t
he task has |
| 12285 * not yet been performed or if an exception occurred. | 12123 * not yet been performed or if an exception occurred. |
| 12286 * | 12124 * |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12418 } | 12256 } |
| 12419 | 12257 |
| 12420 @override | 12258 @override |
| 12421 void logInformation(String message) { | 12259 void logInformation(String message) { |
| 12422 } | 12260 } |
| 12423 | 12261 |
| 12424 @override | 12262 @override |
| 12425 void logInformation2(String message, Exception exception) { | 12263 void logInformation2(String message, Exception exception) { |
| 12426 } | 12264 } |
| 12427 } | 12265 } |
| OLD | NEW |