| 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 18 matching lines...) Expand all Loading... |
| 29 * The [ResultCachingPolicy] for ASTs. | 29 * The [ResultCachingPolicy] for ASTs. |
| 30 */ | 30 */ |
| 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 [Source]s representing a library. |
| 40 */ | 40 */ |
| 41 final ListResultDescriptor<AnalysisError> BUILD_DIRECTIVES_ERRORS = | 41 final ListResultDescriptor<AnalysisError> BUILD_DIRECTIVES_ERRORS = |
| 42 new ListResultDescriptor<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 [LibrarySpecificUnit]s. |
| 51 */ | 51 */ |
| 52 final ListResultDescriptor<AnalysisError> BUILD_FUNCTION_TYPE_ALIASES_ERRORS = | 52 final ListResultDescriptor<AnalysisError> BUILD_FUNCTION_TYPE_ALIASES_ERRORS = |
| 53 new ListResultDescriptor<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 [Source]s representing a library. |
| 62 */ | 62 */ |
| 63 final ListResultDescriptor<AnalysisError> BUILD_LIBRARY_ERRORS = | 63 final ListResultDescriptor<AnalysisError> BUILD_LIBRARY_ERRORS = |
| 64 new ListResultDescriptor<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 [Source] representing a Dart library. |
| 69 * |
| 70 * The list contains the elements for all of the classes defined in the library, |
| 71 * not just those in the defining compilation unit. The list will be empty if |
| 72 * there are no classes, but will not be `null`. |
| 69 */ | 73 */ |
| 70 final ListResultDescriptor<ClassElement> CLASS_ELEMENTS = | 74 final ListResultDescriptor<ClassElement> CLASS_ELEMENTS = |
| 71 new ListResultDescriptor<ClassElement>('CLASS_ELEMENTS', null, | 75 new ListResultDescriptor<ClassElement>('CLASS_ELEMENTS', null, |
| 72 cachingPolicy: ELEMENT_CACHING_POLICY); | 76 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 73 | 77 |
| 74 /** | 78 /** |
| 75 * The element model associated with a single compilation unit. | 79 * The element model associated with a single compilation unit. |
| 76 * | 80 * |
| 77 * The result is only available for targets representing a Dart compilation unit
. | 81 * The result is only available for [LibrarySpecificUnit]s. |
| 78 */ | 82 */ |
| 79 final ResultDescriptor<CompilationUnitElement> COMPILATION_UNIT_ELEMENT = | 83 final ResultDescriptor<CompilationUnitElement> COMPILATION_UNIT_ELEMENT = |
| 80 new ResultDescriptor<CompilationUnitElement>( | 84 new ResultDescriptor<CompilationUnitElement>( |
| 81 'COMPILATION_UNIT_ELEMENT', null, | 85 'COMPILATION_UNIT_ELEMENT', null, |
| 82 cachingPolicy: ELEMENT_CACHING_POLICY); | 86 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 83 | 87 |
| 84 /** | 88 /** |
| 85 * The list of [Element]s which a given constant element depends on. | 89 * The list of [Element]s on which the target constant element depends. |
| 86 * | 90 * |
| 87 * The result is only available for targets representing a constant [Element] | 91 * The result is only available for targets representing a constant [Element] |
| 88 * (i.e. a constant variable declaration, a constant constructor, or a | 92 * (i.e. a constant variable declaration, a constant constructor, or a |
| 89 * parameter element with a default value). | 93 * parameter element with a default value). |
| 90 */ | 94 */ |
| 91 final ListResultDescriptor<Element> CONSTANT_DEPENDENCIES = | 95 final ListResultDescriptor<Element> CONSTANT_DEPENDENCIES = |
| 92 new ListResultDescriptor<Element>('CONSTANT_DEPENDENCIES', <Element>[]); | 96 new ListResultDescriptor<Element>('CONSTANT_DEPENDENCIES', <Element>[]); |
| 93 | 97 |
| 94 /** | 98 /** |
| 95 * An [Element] that has been successfully constant-evaluated. | 99 * An [Element] that has been successfully constant-evaluated. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 113 * | 117 * |
| 114 * The result is only available for targets representing a [ClassElement]. | 118 * The result is only available for targets representing a [ClassElement]. |
| 115 */ | 119 */ |
| 116 final ListResultDescriptor<AnalysisError> CONSTRUCTORS_ERRORS = | 120 final ListResultDescriptor<AnalysisError> CONSTRUCTORS_ERRORS = |
| 117 new ListResultDescriptor<AnalysisError>( | 121 new ListResultDescriptor<AnalysisError>( |
| 118 'CONSTRUCTORS_ERRORS', AnalysisError.NO_ERRORS); | 122 'CONSTRUCTORS_ERRORS', AnalysisError.NO_ERRORS); |
| 119 | 123 |
| 120 /** | 124 /** |
| 121 * The sources representing the libraries that include a given source as a part. | 125 * The sources representing the libraries that include a given source as a part. |
| 122 * | 126 * |
| 123 * The result is only available for targets representing a compilation unit. | 127 * The result is only available for [Source]s representing a compilation unit. |
| 124 */ | 128 */ |
| 125 final ListResultDescriptor<Source> CONTAINING_LIBRARIES = | 129 final ListResultDescriptor<Source> CONTAINING_LIBRARIES = |
| 126 new ListResultDescriptor<Source>('CONTAINING_LIBRARIES', Source.EMPTY_LIST); | 130 new ListResultDescriptor<Source>('CONTAINING_LIBRARIES', Source.EMPTY_LIST); |
| 127 | 131 |
| 128 /** | 132 /** |
| 129 * The [ResultCachingPolicy] for [Element]s. | 133 * The [ResultCachingPolicy] for [Element]s. |
| 130 */ | 134 */ |
| 131 const ResultCachingPolicy ELEMENT_CACHING_POLICY = | 135 const ResultCachingPolicy ELEMENT_CACHING_POLICY = |
| 132 const SimpleResultCachingPolicy(-1, -1); | 136 const SimpleResultCachingPolicy(-1, -1); |
| 133 | 137 |
| 134 /** | 138 /** |
| 135 * The sources representing the export closure of a library. | 139 * The sources representing the export closure of a library. |
| 136 * The [Source]s include only library sources, not their units. | 140 * The [Source]s include only library sources, not their units. |
| 137 * | 141 * |
| 138 * The result is only available for targets representing a Dart library. | 142 * The result is only available for [Source]s representing a library. |
| 139 */ | 143 */ |
| 140 final ListResultDescriptor<Source> EXPORT_SOURCE_CLOSURE = | 144 final ListResultDescriptor<Source> EXPORT_SOURCE_CLOSURE = |
| 141 new ListResultDescriptor<Source>('EXPORT_SOURCE_CLOSURE', null); | 145 new ListResultDescriptor<Source>('EXPORT_SOURCE_CLOSURE', null); |
| 142 | 146 |
| 143 /** | 147 /** |
| 144 * The errors produced while generating hints a compilation unit. | 148 * The errors produced while generating hints a compilation unit. |
| 145 * | 149 * |
| 146 * The list will be empty if there were no errors, but will not be `null`. | 150 * The list will be empty if there were no errors, but will not be `null`. |
| 147 * | 151 * |
| 148 * The result is only available for targets representing a Dart compilation unit
. | 152 * The result is only available for [LibrarySpecificUnit]s. |
| 149 */ | 153 */ |
| 150 final ListResultDescriptor<AnalysisError> HINTS = | 154 final ListResultDescriptor<AnalysisError> HINTS = |
| 151 new ListResultDescriptor<AnalysisError>( | 155 new ListResultDescriptor<AnalysisError>( |
| 152 'HINT_ERRORS', AnalysisError.NO_ERRORS); | 156 'HINT_ERRORS', AnalysisError.NO_ERRORS); |
| 153 | 157 |
| 154 /** | 158 /** |
| 155 * The sources representing the import closure of a library. | 159 * The sources representing the import closure of a library. |
| 156 * The [Source]s include only library sources, not their units. | 160 * The [Source]s include only library sources, not their units. |
| 157 * | 161 * |
| 158 * The result is only available for targets representing a Dart library. | 162 * The result is only available for [Source]s representing a library. |
| 159 */ | 163 */ |
| 160 final ListResultDescriptor<Source> IMPORT_SOURCE_CLOSURE = | 164 final ListResultDescriptor<Source> IMPORT_SOURCE_CLOSURE = |
| 161 new ListResultDescriptor<Source>('IMPORT_SOURCE_CLOSURE', null); | 165 new ListResultDescriptor<Source>('IMPORT_SOURCE_CLOSURE', null); |
| 162 | 166 |
| 163 /** | 167 /** |
| 164 * The partial [LibraryElement] associated with a library. | 168 * The partial [LibraryElement] associated with a library. |
| 165 * | 169 * |
| 166 * The [LibraryElement] and its [CompilationUnitElement]s are attached to each | 170 * The [LibraryElement] and its [CompilationUnitElement]s are attached to each |
| 167 * other. Directives 'library', 'part' and 'part of' are resolved. | 171 * other. Directives 'library', 'part' and 'part of' are resolved. |
| 168 * | 172 * |
| 169 * The result is only available for targets representing a Dart library. | 173 * The result is only available for [Source]s representing a library. |
| 170 */ | 174 */ |
| 171 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT1 = | 175 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT1 = |
| 172 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT1', null, | 176 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT1', null, |
| 173 cachingPolicy: ELEMENT_CACHING_POLICY); | 177 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 174 | 178 |
| 175 /** | 179 /** |
| 176 * The partial [LibraryElement] associated with a library. | 180 * The partial [LibraryElement] associated with a library. |
| 177 * | 181 * |
| 178 * In addition to [LIBRARY_ELEMENT1] [LibraryElement.imports] and | 182 * In addition to [LIBRARY_ELEMENT1] [LibraryElement.imports] and |
| 179 * [LibraryElement.exports] are set. | 183 * [LibraryElement.exports] are set. |
| 180 * | 184 * |
| 181 * The result is only available for targets representing a Dart library. | 185 * The result is only available for [Source]s representing a library. |
| 182 */ | 186 */ |
| 183 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT2 = | 187 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT2 = |
| 184 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT2', null, | 188 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT2', null, |
| 185 cachingPolicy: ELEMENT_CACHING_POLICY); | 189 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 186 | 190 |
| 187 /** | 191 /** |
| 188 * The partial [LibraryElement] associated with a library. | 192 * The partial [LibraryElement] associated with a library. |
| 189 * | 193 * |
| 190 * In addition to [LIBRARY_ELEMENT2] the [LibraryElement.publicNamespace] is set
. | 194 * In addition to [LIBRARY_ELEMENT2] the [LibraryElement.publicNamespace] is set
. |
| 191 * | 195 * |
| 192 * The result is only available for targets representing a Dart library. | 196 * The result is only available for [Source]s representing a library. |
| 193 */ | 197 */ |
| 194 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT3 = | 198 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT3 = |
| 195 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT3', null, | 199 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT3', null, |
| 196 cachingPolicy: ELEMENT_CACHING_POLICY); | 200 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 197 | 201 |
| 198 /** | 202 /** |
| 199 * The partial [LibraryElement] associated with a library. | 203 * The partial [LibraryElement] associated with a library. |
| 200 * | 204 * |
| 201 * In addition to [LIBRARY_ELEMENT3] the [LibraryElement.entryPoint] is set, | 205 * In addition to [LIBRARY_ELEMENT3] the [LibraryElement.entryPoint] is set, |
| 202 * if the library does not declare one already and one of the exported | 206 * if the library does not declare one already and one of the exported |
| 203 * libraries exports one. | 207 * libraries exports one. |
| 204 * | 208 * |
| 205 * Also [LibraryElement.exportNamespace] is set. | 209 * Also [LibraryElement.exportNamespace] is set. |
| 206 * | 210 * |
| 207 * The result is only available for targets representing a Dart library. | 211 * The result is only available for [Source]s representing a library. |
| 208 */ | 212 */ |
| 209 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT4 = | 213 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT4 = |
| 210 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT4', null, | 214 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT4', null, |
| 211 cachingPolicy: ELEMENT_CACHING_POLICY); | 215 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 212 | 216 |
| 213 /** | 217 /** |
| 214 * The partial [LibraryElement] associated with a library. | 218 * The partial [LibraryElement] associated with a library. |
| 215 * | 219 * |
| 216 * [LIBRARY_ELEMENT4] plus [RESOLVED_UNIT4] for every unit. | 220 * [LIBRARY_ELEMENT4] plus [RESOLVED_UNIT4] for every unit. |
| 217 * | 221 * |
| 218 * The result is only available for targets representing a Dart library. | 222 * The result is only available for [Source]s representing a library. |
| 219 */ | 223 */ |
| 220 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT5 = | 224 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT5 = |
| 221 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT5', null, | 225 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT5', null, |
| 222 cachingPolicy: ELEMENT_CACHING_POLICY); | 226 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 223 | 227 |
| 224 /** | 228 /** |
| 225 * The analysis errors associated with a compilation unit in a specific library. | 229 * The analysis errors associated with a compilation unit in a specific library. |
| 226 * | 230 * |
| 227 * The result is only available for targets representing a Dart compilation unit | 231 * The result is only available for [LibrarySpecificUnit]s. |
| 228 * in a specific library. | |
| 229 */ | 232 */ |
| 230 final ListResultDescriptor<AnalysisError> LIBRARY_UNIT_ERRORS = | 233 final ListResultDescriptor<AnalysisError> LIBRARY_UNIT_ERRORS = |
| 231 new ListResultDescriptor<AnalysisError>( | 234 new ListResultDescriptor<AnalysisError>( |
| 232 'LIBRARY_UNIT_ERRORS', AnalysisError.NO_ERRORS); | 235 'LIBRARY_UNIT_ERRORS', AnalysisError.NO_ERRORS); |
| 233 | 236 |
| 234 /** | 237 /** |
| 235 * The errors produced while parsing a compilation unit. | 238 * The errors produced while parsing a compilation unit. |
| 236 * | 239 * |
| 237 * 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`. |
| 238 * | 241 * |
| 239 * The result is only available for targets representing a Dart compilation unit
. | 242 * The result is only available for [Source]s representing a compilation unit. |
| 240 */ | 243 */ |
| 241 final ListResultDescriptor<AnalysisError> PARSE_ERRORS = | 244 final ListResultDescriptor<AnalysisError> PARSE_ERRORS = |
| 242 new ListResultDescriptor<AnalysisError>( | 245 new ListResultDescriptor<AnalysisError>( |
| 243 'PARSE_ERRORS', AnalysisError.NO_ERRORS); | 246 'PARSE_ERRORS', AnalysisError.NO_ERRORS); |
| 244 | 247 |
| 245 /** | 248 /** |
| 246 * The errors produced while resolving references. | 249 * The errors produced while resolving references. |
| 247 * | 250 * |
| 248 * The list will be empty if there were no errors, but will not be `null`. | 251 * The list will be empty if there were no errors, but will not be `null`. |
| 249 * | 252 * |
| 250 * The result is only available for targets representing a unit. | 253 * The result is only available for [LibrarySpecificUnit]s. |
| 251 */ | 254 */ |
| 252 final ListResultDescriptor<AnalysisError> RESOLVE_REFERENCES_ERRORS = | 255 final ListResultDescriptor<AnalysisError> RESOLVE_REFERENCES_ERRORS = |
| 253 new ListResultDescriptor<AnalysisError>( | 256 new ListResultDescriptor<AnalysisError>( |
| 254 'RESOLVE_REFERENCES_ERRORS', AnalysisError.NO_ERRORS); | 257 'RESOLVE_REFERENCES_ERRORS', AnalysisError.NO_ERRORS); |
| 255 | 258 |
| 256 /** | 259 /** |
| 257 * The errors produced while resolving type names. | 260 * The errors produced while resolving type names. |
| 258 * | 261 * |
| 259 * The list will be empty if there were no errors, but will not be `null`. | 262 * The list will be empty if there were no errors, but will not be `null`. |
| 260 * | 263 * |
| 261 * The result is only available for targets representing a Dart library. | 264 * The result is only available for [LibrarySpecificUnit]s. |
| 262 */ | 265 */ |
| 263 final ListResultDescriptor<AnalysisError> RESOLVE_TYPE_NAMES_ERRORS = | 266 final ListResultDescriptor<AnalysisError> RESOLVE_TYPE_NAMES_ERRORS = |
| 264 new ListResultDescriptor<AnalysisError>( | 267 new ListResultDescriptor<AnalysisError>( |
| 265 'RESOLVE_TYPE_NAMES_ERRORS', AnalysisError.NO_ERRORS); | 268 'RESOLVE_TYPE_NAMES_ERRORS', AnalysisError.NO_ERRORS); |
| 266 | 269 |
| 267 /** | 270 /** |
| 268 * The partially resolved [CompilationUnit] associated with a unit. | 271 * The partially resolved [CompilationUnit] associated with a unit. |
| 269 * | 272 * |
| 270 * All declarations bound to the element defined by the declaration. | 273 * All declarations bound to the element defined by the declaration. |
| 271 * | 274 * |
| 272 * The result is only available for targets representing a unit. | 275 * The result is only available for [LibrarySpecificUnit]s. |
| 273 */ | 276 */ |
| 274 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 = | 277 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT1 = |
| 275 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT1', null, | 278 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT1', null, |
| 276 cachingPolicy: AST_CACHING_POLICY); | 279 cachingPolicy: AST_CACHING_POLICY); |
| 277 | 280 |
| 278 /** | 281 /** |
| 279 * The partially resolved [CompilationUnit] associated with a unit. | 282 * The partially resolved [CompilationUnit] associated with a unit. |
| 280 * | 283 * |
| 281 * All the enum member elements are built. | 284 * All the enum member elements are built. |
| 282 * | 285 * |
| 283 * The result is only available for targets representing a unit. | 286 * The result is only available for [LibrarySpecificUnit]s. |
| 284 */ | 287 */ |
| 285 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT2 = | 288 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT2 = |
| 286 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT2', null, | 289 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT2', null, |
| 287 cachingPolicy: AST_CACHING_POLICY); | 290 cachingPolicy: AST_CACHING_POLICY); |
| 288 | 291 |
| 289 /** | 292 /** |
| 290 * The partially resolved [CompilationUnit] associated with a unit. | 293 * The partially resolved [CompilationUnit] associated with a unit. |
| 291 * | 294 * |
| 292 * All the function type aliases are resolved. | 295 * All the function type aliases are resolved. |
| 293 * | 296 * |
| 294 * The result is only available for targets representing a unit. | 297 * The result is only available for [LibrarySpecificUnit]s. |
| 295 */ | 298 */ |
| 296 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT3 = | 299 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT3 = |
| 297 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT3', null, | 300 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT3', null, |
| 298 cachingPolicy: AST_CACHING_POLICY); | 301 cachingPolicy: AST_CACHING_POLICY); |
| 299 | 302 |
| 300 /** | 303 /** |
| 301 * The partially resolved [CompilationUnit] associated with a unit. | 304 * The partially resolved [CompilationUnit] associated with a unit. |
| 302 * | 305 * |
| 303 * [RESOLVED_UNIT3] with resolved type names. | 306 * [RESOLVED_UNIT3] with resolved type names. |
| 304 * | 307 * |
| 305 * The result is only available for targets representing a unit. | 308 * The result is only available for [LibrarySpecificUnit]s. |
| 306 */ | 309 */ |
| 307 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT4 = | 310 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT4 = |
| 308 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT4', null, | 311 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT4', null, |
| 309 cachingPolicy: AST_CACHING_POLICY); | 312 cachingPolicy: AST_CACHING_POLICY); |
| 310 | 313 |
| 311 /** | 314 /** |
| 312 * The partially resolved [CompilationUnit] associated with a unit. | 315 * The partially resolved [CompilationUnit] associated with a unit. |
| 313 * | 316 * |
| 314 * [RESOLVED_UNIT4] plus resolved local variables and formal parameters. | 317 * [RESOLVED_UNIT4] plus resolved local variables and formal parameters. |
| 315 * | 318 * |
| 316 * The result is only available for targets representing a unit. | 319 * The result is only available for [LibrarySpecificUnit]s. |
| 317 */ | 320 */ |
| 318 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = | 321 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT5 = |
| 319 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, | 322 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT5', null, |
| 320 cachingPolicy: AST_CACHING_POLICY); | 323 cachingPolicy: AST_CACHING_POLICY); |
| 321 | 324 |
| 322 /** | 325 /** |
| 323 * The errors produced while scanning a compilation unit. | 326 * The errors produced while scanning a compilation unit. |
| 324 * | 327 * |
| 325 * The list will be empty if there were no errors, but will not be `null`. | 328 * The list will be empty if there were no errors, but will not be `null`. |
| 326 * | 329 * |
| 327 * The result is only available for targets representing a Dart compilation unit
. | 330 * The result is only available for [Source]s representing a compilation unit. |
| 328 */ | 331 */ |
| 329 final ListResultDescriptor<AnalysisError> SCAN_ERRORS = | 332 final ListResultDescriptor<AnalysisError> SCAN_ERRORS = |
| 330 new ListResultDescriptor<AnalysisError>( | 333 new ListResultDescriptor<AnalysisError>( |
| 331 'SCAN_ERRORS', AnalysisError.NO_ERRORS); | 334 'SCAN_ERRORS', AnalysisError.NO_ERRORS); |
| 332 | 335 |
| 333 /** | 336 /** |
| 334 * The [ResultCachingPolicy] for [TOKEN_STREAM]. | 337 * The [ResultCachingPolicy] for [TOKEN_STREAM]. |
| 335 */ | 338 */ |
| 336 const ResultCachingPolicy TOKEN_STREAM_CACHING_POLICY = | 339 const ResultCachingPolicy TOKEN_STREAM_CACHING_POLICY = |
| 337 const SimpleResultCachingPolicy(1, 1); | 340 const SimpleResultCachingPolicy(1, 1); |
| 338 | 341 |
| 339 /** | 342 /** |
| 340 * The [TypeProvider] of the context. | 343 * The [TypeProvider] of the [AnalysisContext]. |
| 341 */ | 344 */ |
| 342 final ResultDescriptor<TypeProvider> TYPE_PROVIDER = | 345 final ResultDescriptor<TypeProvider> TYPE_PROVIDER = |
| 343 new ResultDescriptor<TypeProvider>('TYPE_PROVIDER', null); | 346 new ResultDescriptor<TypeProvider>('TYPE_PROVIDER', null); |
| 344 | 347 |
| 345 /** | 348 /** |
| 346 * The [UsedImportedElements] of a [LibrarySpecificUnit]. | 349 * The [UsedImportedElements] of a [LibrarySpecificUnit]. |
| 347 */ | 350 */ |
| 348 final ResultDescriptor<UsedImportedElements> USED_IMPORTED_ELEMENTS = | 351 final ResultDescriptor<UsedImportedElements> USED_IMPORTED_ELEMENTS = |
| 349 new ResultDescriptor<UsedImportedElements>('USED_IMPORTED_ELEMENTS', null, | 352 new ResultDescriptor<UsedImportedElements>('USED_IMPORTED_ELEMENTS', null, |
| 350 cachingPolicy: ELEMENT_CACHING_POLICY); | 353 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 351 | 354 |
| 352 /** | 355 /** |
| 353 * The [UsedLocalElements] of a [LibrarySpecificUnit]. | 356 * The [UsedLocalElements] of a [LibrarySpecificUnit]. |
| 354 */ | 357 */ |
| 355 final ResultDescriptor<UsedLocalElements> USED_LOCAL_ELEMENTS = | 358 final ResultDescriptor<UsedLocalElements> USED_LOCAL_ELEMENTS = |
| 356 new ResultDescriptor<UsedLocalElements>('USED_LOCAL_ELEMENTS', null, | 359 new ResultDescriptor<UsedLocalElements>('USED_LOCAL_ELEMENTS', null, |
| 357 cachingPolicy: ELEMENT_CACHING_POLICY); | 360 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 358 | 361 |
| 359 /** | 362 /** |
| 360 * The errors produced while verifying a compilation unit. | 363 * The errors produced while verifying a compilation unit. |
| 361 * | 364 * |
| 362 * The list will be empty if there were no errors, but will not be `null`. | 365 * The list will be empty if there were no errors, but will not be `null`. |
| 363 * | 366 * |
| 364 * The result is only available for targets representing a Dart compilation unit
. | 367 * The result is only available for [LibrarySpecificUnit]s. |
| 365 */ | 368 */ |
| 366 final ListResultDescriptor<AnalysisError> VERIFY_ERRORS = | 369 final ListResultDescriptor<AnalysisError> VERIFY_ERRORS = |
| 367 new ListResultDescriptor<AnalysisError>( | 370 new ListResultDescriptor<AnalysisError>( |
| 368 'VERIFY_ERRORS', AnalysisError.NO_ERRORS); | 371 'VERIFY_ERRORS', AnalysisError.NO_ERRORS); |
| 369 | 372 |
| 370 /** | 373 /** |
| 371 * A task that builds implicit constructors for a [ClassElement], or keeps | 374 * A task that builds implicit constructors for a [ClassElement], or keeps |
| 372 * the existing explicit constructors if the class has them. | 375 * the existing explicit constructors if the class has them. |
| 373 */ | 376 */ |
| 374 class BuildClassConstructorsTask extends SourceBasedAnalysisTask { | 377 class BuildClassConstructorsTask extends SourceBasedAnalysisTask { |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 * The name of the input whose value is the AST for the compilation unit. | 603 * The name of the input whose value is the AST for the compilation unit. |
| 601 */ | 604 */ |
| 602 static const String PARSED_UNIT_INPUT_NAME = 'PARSED_UNIT_INPUT_NAME'; | 605 static const String PARSED_UNIT_INPUT_NAME = 'PARSED_UNIT_INPUT_NAME'; |
| 603 | 606 |
| 604 /** | 607 /** |
| 605 * The task descriptor describing this kind of task. | 608 * The task descriptor describing this kind of task. |
| 606 */ | 609 */ |
| 607 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 610 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 608 'BuildCompilationUnitElementTask', createTask, buildInputs, | 611 'BuildCompilationUnitElementTask', createTask, buildInputs, |
| 609 <ResultDescriptor>[ | 612 <ResultDescriptor>[ |
| 610 CLASS_ELEMENTS, | |
| 611 COMPILATION_UNIT_ELEMENT, | 613 COMPILATION_UNIT_ELEMENT, |
| 612 RESOLVED_UNIT1 | 614 RESOLVED_UNIT1 |
| 613 ]); | 615 ]); |
| 614 | 616 |
| 615 /** | 617 /** |
| 616 * Initialize a newly created task to build a compilation unit element for | 618 * Initialize a newly created task to build a compilation unit element for |
| 617 * the given [target] in the given [context]. | 619 * the given [target] in the given [context]. |
| 618 */ | 620 */ |
| 619 BuildCompilationUnitElementTask( | 621 BuildCompilationUnitElementTask( |
| 620 InternalAnalysisContext context, AnalysisTarget target) | 622 InternalAnalysisContext context, AnalysisTarget target) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 632 CompilationUnit unit = getRequiredInput(PARSED_UNIT_INPUT_NAME); | 634 CompilationUnit unit = getRequiredInput(PARSED_UNIT_INPUT_NAME); |
| 633 // | 635 // |
| 634 // Process inputs. | 636 // Process inputs. |
| 635 // | 637 // |
| 636 unit = AstCloner.clone(unit); | 638 unit = AstCloner.clone(unit); |
| 637 CompilationUnitBuilder builder = new CompilationUnitBuilder(); | 639 CompilationUnitBuilder builder = new CompilationUnitBuilder(); |
| 638 CompilationUnitElement element = builder.buildCompilationUnit(source, unit); | 640 CompilationUnitElement element = builder.buildCompilationUnit(source, unit); |
| 639 // | 641 // |
| 640 // Record outputs. | 642 // Record outputs. |
| 641 // | 643 // |
| 642 outputs[CLASS_ELEMENTS] = element.types; | |
| 643 outputs[COMPILATION_UNIT_ELEMENT] = element; | 644 outputs[COMPILATION_UNIT_ELEMENT] = element; |
| 644 outputs[RESOLVED_UNIT1] = unit; | 645 outputs[RESOLVED_UNIT1] = unit; |
| 645 } | 646 } |
| 646 | 647 |
| 647 /** | 648 /** |
| 648 * Return a map from the names of the inputs of this kind of task to the task | 649 * Return a map from the names of the inputs of this kind of task to the task |
| 649 * input descriptors describing those inputs for a task with the given | 650 * input descriptors describing those inputs for a task with the given |
| 650 * [target]. | 651 * [target]. |
| 651 */ | 652 */ |
| 652 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 653 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| (...skipping 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3062 @override | 3063 @override |
| 3063 bool moveNext() { | 3064 bool moveNext() { |
| 3064 if (_newSources.isEmpty) { | 3065 if (_newSources.isEmpty) { |
| 3065 return false; | 3066 return false; |
| 3066 } | 3067 } |
| 3067 currentTarget = _newSources.first; | 3068 currentTarget = _newSources.first; |
| 3068 _newSources.remove(currentTarget); | 3069 _newSources.remove(currentTarget); |
| 3069 return true; | 3070 return true; |
| 3070 } | 3071 } |
| 3071 } | 3072 } |
| OLD | NEW |