| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.src.task.dart; | 5 library analyzer.src.task.dart; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 const ResultCachingPolicy AST_CACHING_POLICY = | 31 const ResultCachingPolicy AST_CACHING_POLICY = |
| 32 const SimpleResultCachingPolicy(256, 64); | 32 const SimpleResultCachingPolicy(256, 64); |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * The errors produced while resolving a library directives. | 35 * The errors produced while resolving a library directives. |
| 36 * | 36 * |
| 37 * The list will be empty if there were no errors, but will not be `null`. | 37 * The list will be empty if there were no errors, but will not be `null`. |
| 38 * | 38 * |
| 39 * The result is only available for targets representing a Dart library. | 39 * The result is only available for targets representing a Dart library. |
| 40 */ | 40 */ |
| 41 final ResultDescriptor<List<AnalysisError>> BUILD_DIRECTIVES_ERRORS = | 41 final ListResultDescriptor<AnalysisError> BUILD_DIRECTIVES_ERRORS = |
| 42 new ResultDescriptor<List<AnalysisError>>( | 42 new ListResultDescriptor<AnalysisError>( |
| 43 'BUILD_DIRECTIVES_ERRORS', AnalysisError.NO_ERRORS); | 43 'BUILD_DIRECTIVES_ERRORS', AnalysisError.NO_ERRORS); |
| 44 | 44 |
| 45 /** | 45 /** |
| 46 * The errors produced while building function type aliases. | 46 * The errors produced while building function type aliases. |
| 47 * | 47 * |
| 48 * The list will be empty if there were no errors, but will not be `null`. | 48 * The list will be empty if there were no errors, but will not be `null`. |
| 49 * | 49 * |
| 50 * The result is only available for targets representing a Dart library. | 50 * The result is only available for targets representing a Dart library. |
| 51 */ | 51 */ |
| 52 final ResultDescriptor<List<AnalysisError>> BUILD_FUNCTION_TYPE_ALIASES_ERRORS = | 52 final ListResultDescriptor<AnalysisError> BUILD_FUNCTION_TYPE_ALIASES_ERRORS = |
| 53 new ResultDescriptor<List<AnalysisError>>( | 53 new ListResultDescriptor<AnalysisError>( |
| 54 'BUILD_FUNCTION_TYPE_ALIASES_ERRORS', AnalysisError.NO_ERRORS); | 54 'BUILD_FUNCTION_TYPE_ALIASES_ERRORS', AnalysisError.NO_ERRORS); |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * The errors produced while building a library element. | 57 * The errors produced while building a library element. |
| 58 * | 58 * |
| 59 * The list will be empty if there were no errors, but will not be `null`. | 59 * The list will be empty if there were no errors, but will not be `null`. |
| 60 * | 60 * |
| 61 * The result is only available for targets representing a Dart library. | 61 * The result is only available for targets representing a Dart library. |
| 62 */ | 62 */ |
| 63 final ResultDescriptor<List<AnalysisError>> BUILD_LIBRARY_ERRORS = | 63 final ListResultDescriptor<AnalysisError> BUILD_LIBRARY_ERRORS = |
| 64 new ResultDescriptor<List<AnalysisError>>( | 64 new ListResultDescriptor<AnalysisError>( |
| 65 'BUILD_LIBRARY_ERRORS', AnalysisError.NO_ERRORS); | 65 'BUILD_LIBRARY_ERRORS', AnalysisError.NO_ERRORS); |
| 66 | 66 |
| 67 /** | 67 /** |
| 68 * The [ClassElement]s of a [LibrarySpecificUnit]. | 68 * The [ClassElement]s of a [LibrarySpecificUnit]. |
| 69 */ | 69 */ |
| 70 final ListResultDescriptor<ClassElement> CLASS_ELEMENTS = | 70 final ListResultDescriptor<ClassElement> CLASS_ELEMENTS = |
| 71 new ListResultDescriptor<ClassElement>('CLASS_ELEMENTS', null, | 71 new ListResultDescriptor<ClassElement>('CLASS_ELEMENTS', null, |
| 72 cachingPolicy: ELEMENT_CACHING_POLICY); | 72 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * The element model associated with a single compilation unit. | 75 * The element model associated with a single compilation unit. |
| 76 * | 76 * |
| 77 * The result is only available for targets representing a Dart compilation unit
. | 77 * The result is only available for targets representing a Dart compilation unit
. |
| 78 */ | 78 */ |
| 79 final ResultDescriptor<CompilationUnitElement> COMPILATION_UNIT_ELEMENT = | 79 final ResultDescriptor<CompilationUnitElement> COMPILATION_UNIT_ELEMENT = |
| 80 new ResultDescriptor<CompilationUnitElement>( | 80 new ResultDescriptor<CompilationUnitElement>( |
| 81 'COMPILATION_UNIT_ELEMENT', null, | 81 'COMPILATION_UNIT_ELEMENT', null, |
| 82 cachingPolicy: ELEMENT_CACHING_POLICY); | 82 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 83 | 83 |
| 84 /** | 84 /** |
| 85 * The [ConstructorElement]s of a [ClassElement]. | 85 * The [ConstructorElement]s of a [ClassElement]. |
| 86 */ | 86 */ |
| 87 final ResultDescriptor<List<ConstructorElement>> CONSTRUCTORS = | 87 final ListResultDescriptor<ConstructorElement> CONSTRUCTORS = |
| 88 new ResultDescriptor<List<ConstructorElement>>('CONSTRUCTORS', null); | 88 new ListResultDescriptor<ConstructorElement>('CONSTRUCTORS', null); |
| 89 | 89 |
| 90 /** | 90 /** |
| 91 * The errors produced while building a [ClassElement] constructors. | 91 * The errors produced while building a [ClassElement] constructors. |
| 92 * | 92 * |
| 93 * The list will be empty if there were no errors, but will not be `null`. | 93 * The list will be empty if there were no errors, but will not be `null`. |
| 94 * | 94 * |
| 95 * The result is only available for targets representing a [ClassElement]. | 95 * The result is only available for targets representing a [ClassElement]. |
| 96 */ | 96 */ |
| 97 final ResultDescriptor<List<AnalysisError>> CONSTRUCTORS_ERRORS = | 97 final ListResultDescriptor<AnalysisError> CONSTRUCTORS_ERRORS = |
| 98 new ResultDescriptor<List<AnalysisError>>( | 98 new ListResultDescriptor<AnalysisError>( |
| 99 'CONSTRUCTORS_ERRORS', AnalysisError.NO_ERRORS); | 99 'CONSTRUCTORS_ERRORS', AnalysisError.NO_ERRORS); |
| 100 | 100 |
| 101 /** | 101 /** |
| 102 * The sources representing the libraries that include a given source as a part. | 102 * The sources representing the libraries that include a given source as a part. |
| 103 * | 103 * |
| 104 * The result is only available for targets representing a compilation unit. | 104 * The result is only available for targets representing a compilation unit. |
| 105 */ | 105 */ |
| 106 final ListResultDescriptor<Source> CONTAINING_LIBRARIES = | 106 final ListResultDescriptor<Source> CONTAINING_LIBRARIES = |
| 107 new ListResultDescriptor<Source>('CONTAINING_LIBRARIES', Source.EMPTY_LIST); | 107 new ListResultDescriptor<Source>('CONTAINING_LIBRARIES', Source.EMPTY_LIST); |
| 108 | 108 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 121 final ListResultDescriptor<Source> EXPORT_SOURCE_CLOSURE = | 121 final ListResultDescriptor<Source> EXPORT_SOURCE_CLOSURE = |
| 122 new ListResultDescriptor<Source>('EXPORT_SOURCE_CLOSURE', null); | 122 new ListResultDescriptor<Source>('EXPORT_SOURCE_CLOSURE', null); |
| 123 | 123 |
| 124 /** | 124 /** |
| 125 * The errors produced while generating hints a compilation unit. | 125 * The errors produced while generating hints a compilation unit. |
| 126 * | 126 * |
| 127 * The list will be empty if there were no errors, but will not be `null`. | 127 * The list will be empty if there were no errors, but will not be `null`. |
| 128 * | 128 * |
| 129 * The result is only available for targets representing a Dart compilation unit
. | 129 * The result is only available for targets representing a Dart compilation unit
. |
| 130 */ | 130 */ |
| 131 final ResultDescriptor<List<AnalysisError>> HINTS = | 131 final ListResultDescriptor<AnalysisError> HINTS = |
| 132 new ResultDescriptor<List<AnalysisError>>( | 132 new ListResultDescriptor<AnalysisError>( |
| 133 'HINT_ERRORS', AnalysisError.NO_ERRORS); | 133 'HINT_ERRORS', AnalysisError.NO_ERRORS); |
| 134 | 134 |
| 135 /** | 135 /** |
| 136 * The sources representing the import closure of a library. | 136 * The sources representing the import closure of a library. |
| 137 * The [Source]s include only library sources, not their units. | 137 * The [Source]s include only library sources, not their units. |
| 138 * | 138 * |
| 139 * The result is only available for targets representing a Dart library. | 139 * The result is only available for targets representing a Dart library. |
| 140 */ | 140 */ |
| 141 final ListResultDescriptor<Source> IMPORT_SOURCE_CLOSURE = | 141 final ListResultDescriptor<Source> IMPORT_SOURCE_CLOSURE = |
| 142 new ListResultDescriptor<Source>('IMPORT_SOURCE_CLOSURE', null); | 142 new ListResultDescriptor<Source>('IMPORT_SOURCE_CLOSURE', null); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT5 = | 201 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT5 = |
| 202 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT5', null, | 202 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT5', null, |
| 203 cachingPolicy: ELEMENT_CACHING_POLICY); | 203 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 204 | 204 |
| 205 /** | 205 /** |
| 206 * The analysis errors associated with a compilation unit in a specific library. | 206 * The analysis errors associated with a compilation unit in a specific library. |
| 207 * | 207 * |
| 208 * The result is only available for targets representing a Dart compilation unit | 208 * The result is only available for targets representing a Dart compilation unit |
| 209 * in a specific library. | 209 * in a specific library. |
| 210 */ | 210 */ |
| 211 final ResultDescriptor<List<AnalysisError>> LIBRARY_UNIT_ERRORS = | 211 final ListResultDescriptor<AnalysisError> LIBRARY_UNIT_ERRORS = |
| 212 new ResultDescriptor<List<AnalysisError>>( | 212 new ListResultDescriptor<AnalysisError>( |
| 213 'LIBRARY_UNIT_ERRORS', AnalysisError.NO_ERRORS); | 213 'LIBRARY_UNIT_ERRORS', AnalysisError.NO_ERRORS); |
| 214 | 214 |
| 215 /** | 215 /** |
| 216 * The errors produced while parsing a compilation unit. | 216 * The errors produced while parsing a compilation unit. |
| 217 * | 217 * |
| 218 * The list will be empty if there were no errors, but will not be `null`. | 218 * The list will be empty if there were no errors, but will not be `null`. |
| 219 * | 219 * |
| 220 * The result is only available for targets representing a Dart compilation unit
. | 220 * The result is only available for targets representing a Dart compilation unit
. |
| 221 */ | 221 */ |
| 222 final ResultDescriptor<List<AnalysisError>> PARSE_ERRORS = | 222 final ListResultDescriptor<AnalysisError> PARSE_ERRORS = |
| 223 new ResultDescriptor<List<AnalysisError>>( | 223 new ListResultDescriptor<AnalysisError>( |
| 224 'PARSE_ERRORS', AnalysisError.NO_ERRORS); | 224 'PARSE_ERRORS', AnalysisError.NO_ERRORS); |
| 225 | 225 |
| 226 /** | 226 /** |
| 227 * The errors produced while resolving references. | 227 * The errors produced while resolving references. |
| 228 * | 228 * |
| 229 * The list will be empty if there were no errors, but will not be `null`. | 229 * The list will be empty if there were no errors, but will not be `null`. |
| 230 * | 230 * |
| 231 * The result is only available for targets representing a unit. | 231 * The result is only available for targets representing a unit. |
| 232 */ | 232 */ |
| 233 final ResultDescriptor<List<AnalysisError>> RESOLVE_REFERENCES_ERRORS = | 233 final ListResultDescriptor<AnalysisError> RESOLVE_REFERENCES_ERRORS = |
| 234 new ResultDescriptor<List<AnalysisError>>( | 234 new ListResultDescriptor<AnalysisError>( |
| 235 'RESOLVE_REFERENCES_ERRORS', AnalysisError.NO_ERRORS); | 235 'RESOLVE_REFERENCES_ERRORS', AnalysisError.NO_ERRORS); |
| 236 | 236 |
| 237 /** | 237 /** |
| 238 * The errors produced while resolving type names. | 238 * The errors produced while resolving type names. |
| 239 * | 239 * |
| 240 * The list will be empty if there were no errors, but will not be `null`. | 240 * The list will be empty if there were no errors, but will not be `null`. |
| 241 * | 241 * |
| 242 * The result is only available for targets representing a Dart library. | 242 * The result is only available for targets representing a Dart library. |
| 243 */ | 243 */ |
| 244 final ResultDescriptor<List<AnalysisError>> RESOLVE_TYPE_NAMES_ERRORS = | 244 final ListResultDescriptor<AnalysisError> RESOLVE_TYPE_NAMES_ERRORS = |
| 245 new ResultDescriptor<List<AnalysisError>>( | 245 new ListResultDescriptor<AnalysisError>( |
| 246 'RESOLVE_TYPE_NAMES_ERRORS', AnalysisError.NO_ERRORS); | 246 'RESOLVE_TYPE_NAMES_ERRORS', AnalysisError.NO_ERRORS); |
| 247 | 247 |
| 248 /** | 248 /** |
| 249 * The partially resolved [CompilationUnit] associated with a unit. | 249 * The partially resolved [CompilationUnit] associated with a unit. |
| 250 * | 250 * |
| 251 * All declarations bound to the element defined by the declaration. | 251 * All declarations bound to the element defined by the declaration. |
| 252 * | 252 * |
| 253 * The result is only available for targets representing a unit. | 253 * The result is only available for targets representing a unit. |
| 254 */ | 254 */ |
| 255 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 = | 255 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 = |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, | 300 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, |
| 301 cachingPolicy: AST_CACHING_POLICY); | 301 cachingPolicy: AST_CACHING_POLICY); |
| 302 | 302 |
| 303 /** | 303 /** |
| 304 * The errors produced while scanning a compilation unit. | 304 * The errors produced while scanning a compilation unit. |
| 305 * | 305 * |
| 306 * The list will be empty if there were no errors, but will not be `null`. | 306 * The list will be empty if there were no errors, but will not be `null`. |
| 307 * | 307 * |
| 308 * The result is only available for targets representing a Dart compilation unit
. | 308 * The result is only available for targets representing a Dart compilation unit
. |
| 309 */ | 309 */ |
| 310 final ResultDescriptor<List<AnalysisError>> SCAN_ERRORS = | 310 final ListResultDescriptor<AnalysisError> SCAN_ERRORS = |
| 311 new ResultDescriptor<List<AnalysisError>>( | 311 new ListResultDescriptor<AnalysisError>( |
| 312 'SCAN_ERRORS', AnalysisError.NO_ERRORS); | 312 'SCAN_ERRORS', AnalysisError.NO_ERRORS); |
| 313 | 313 |
| 314 /** | 314 /** |
| 315 * The [ResultCachingPolicy] for [TOKEN_STREAM]. | 315 * The [ResultCachingPolicy] for [TOKEN_STREAM]. |
| 316 */ | 316 */ |
| 317 const ResultCachingPolicy TOKEN_STREAM_CACHING_POLICY = | 317 const ResultCachingPolicy TOKEN_STREAM_CACHING_POLICY = |
| 318 const SimpleResultCachingPolicy(1, 1); | 318 const SimpleResultCachingPolicy(1, 1); |
| 319 | 319 |
| 320 /** | 320 /** |
| 321 * The [TypeProvider] of the context. | 321 * The [TypeProvider] of the context. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 337 new ResultDescriptor<UsedLocalElements>('USED_LOCAL_ELEMENTS', null, | 337 new ResultDescriptor<UsedLocalElements>('USED_LOCAL_ELEMENTS', null, |
| 338 cachingPolicy: ELEMENT_CACHING_POLICY); | 338 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 339 | 339 |
| 340 /** | 340 /** |
| 341 * The errors produced while verifying a compilation unit. | 341 * The errors produced while verifying a compilation unit. |
| 342 * | 342 * |
| 343 * The list will be empty if there were no errors, but will not be `null`. | 343 * The list will be empty if there were no errors, but will not be `null`. |
| 344 * | 344 * |
| 345 * The result is only available for targets representing a Dart compilation unit
. | 345 * The result is only available for targets representing a Dart compilation unit
. |
| 346 */ | 346 */ |
| 347 final ResultDescriptor<List<AnalysisError>> VERIFY_ERRORS = | 347 final ListResultDescriptor<AnalysisError> VERIFY_ERRORS = |
| 348 new ResultDescriptor<List<AnalysisError>>( | 348 new ListResultDescriptor<AnalysisError>( |
| 349 'VERIFY_ERRORS', AnalysisError.NO_ERRORS); | 349 'VERIFY_ERRORS', AnalysisError.NO_ERRORS); |
| 350 | 350 |
| 351 /** | 351 /** |
| 352 * A task that builds implicit constructors for a [ClassElement], or keeps | 352 * A task that builds implicit constructors for a [ClassElement], or keeps |
| 353 * the existing explicit constructors if the class has them. | 353 * the existing explicit constructors if the class has them. |
| 354 */ | 354 */ |
| 355 class BuildClassConstructorsTask extends SourceBasedAnalysisTask { | 355 class BuildClassConstructorsTask extends SourceBasedAnalysisTask { |
| 356 /** | 356 /** |
| 357 * The name of the [CONSTRUCTORS] input for the superclass. | 357 * The name of the [CONSTRUCTORS] input for the superclass. |
| 358 */ | 358 */ |
| (...skipping 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2982 @override | 2982 @override |
| 2983 bool moveNext() { | 2983 bool moveNext() { |
| 2984 if (_newSources.isEmpty) { | 2984 if (_newSources.isEmpty) { |
| 2985 return false; | 2985 return false; |
| 2986 } | 2986 } |
| 2987 currentTarget = _newSources.first; | 2987 currentTarget = _newSources.first; |
| 2988 _newSources.remove(currentTarget); | 2988 _newSources.remove(currentTarget); |
| 2989 return true; | 2989 return true; |
| 2990 } | 2990 } |
| 2991 } | 2991 } |
| OLD | NEW |