Chromium Code Reviews| 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 | 8 |
| 9 import 'package:analyzer/src/context/cache.dart'; | 9 import 'package:analyzer/src/context/cache.dart'; |
| 10 import 'package:analyzer/src/generated/ast.dart'; | 10 import 'package:analyzer/src/generated/ast.dart'; |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 /** | 155 /** |
| 156 * The sources representing the combined import/export closure of a library. | 156 * The sources representing the combined import/export closure of a library. |
| 157 * The [Source]s include only library sources, not their units. | 157 * The [Source]s include only library sources, not their units. |
| 158 * | 158 * |
| 159 * The result is only available for [Source]s representing a library. | 159 * The result is only available for [Source]s representing a library. |
| 160 */ | 160 */ |
| 161 final ListResultDescriptor<Source> IMPORT_EXPORT_SOURCE_CLOSURE = | 161 final ListResultDescriptor<Source> IMPORT_EXPORT_SOURCE_CLOSURE = |
| 162 new ListResultDescriptor<Source>('IMPORT_EXPORT_SOURCE_CLOSURE', null); | 162 new ListResultDescriptor<Source>('IMPORT_EXPORT_SOURCE_CLOSURE', null); |
| 163 | 163 |
| 164 /** | 164 /** |
| 165 * The sources representing [LibrarySpecificUnit]s for all of the [UNITS] of | |
| 166 * the combined import/export closure of a library. | |
| 167 * | |
| 168 * The result is only available for [Source]s representing a library. | |
| 169 */ | |
| 170 final ListResultDescriptor< | |
| 171 LibrarySpecificUnit> IMPORT_EXPORT_SOURCE_CLOSURE_UNITS = | |
|
Brian Wilkerson
2015/10/23 13:58:57
This doesn't appear to be used anywhere (that I ca
| |
| 172 new ListResultDescriptor<LibrarySpecificUnit>( | |
| 173 'IMPORT_EXPORT_SOURCE_CLOSURE_UNITS', LibrarySpecificUnit.EMPTY_LIST); | |
| 174 | |
| 175 /** | |
| 165 * A list of the [VariableElement]s whose type should be inferred that another | 176 * A list of the [VariableElement]s whose type should be inferred that another |
| 166 * inferable static variable (the target) depends on. | 177 * inferable static variable (the target) depends on. |
| 167 * | 178 * |
| 168 * The result is only available for [VariableElement]s, and only when strong | 179 * The result is only available for [VariableElement]s, and only when strong |
| 169 * mode is enabled. | 180 * mode is enabled. |
| 170 */ | 181 */ |
| 171 final ListResultDescriptor< | 182 final ListResultDescriptor< |
| 172 VariableElement> INFERABLE_STATIC_VARIABLE_DEPENDENCIES = | 183 VariableElement> INFERABLE_STATIC_VARIABLE_DEPENDENCIES = |
| 173 new ListResultDescriptor<VariableElement>( | 184 new ListResultDescriptor<VariableElement>( |
| 174 'INFERABLE_STATIC_VARIABLE_DEPENDENCIES', null); | 185 'INFERABLE_STATIC_VARIABLE_DEPENDENCIES', null); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 /** | 308 /** |
| 298 * The flag specifying whether all analysis errors are computed in a specific | 309 * The flag specifying whether all analysis errors are computed in a specific |
| 299 * library. | 310 * library. |
| 300 * | 311 * |
| 301 * The result is only available for [Source]s representing a library. | 312 * The result is only available for [Source]s representing a library. |
| 302 */ | 313 */ |
| 303 final ResultDescriptor<bool> LIBRARY_ERRORS_READY = | 314 final ResultDescriptor<bool> LIBRARY_ERRORS_READY = |
| 304 new ResultDescriptor<bool>('LIBRARY_ERRORS_READY', false); | 315 new ResultDescriptor<bool>('LIBRARY_ERRORS_READY', false); |
| 305 | 316 |
| 306 /** | 317 /** |
| 318 * The [LibrarySpecificUnit]s that a library consists of. | |
| 319 * | |
| 320 * The list will include the defining unit and units for [INCLUDED_PARTS]. | |
| 321 * So, it is never empty or `null`. | |
| 322 * | |
| 323 * The result is only available for [Source]s representing a library. | |
| 324 */ | |
| 325 final ListResultDescriptor<LibrarySpecificUnit> LIBRARY_SPECIFIC_UNITS = | |
| 326 new ListResultDescriptor<LibrarySpecificUnit>( | |
| 327 'LIBRARY_SPECIFIC_UNITS', LibrarySpecificUnit.EMPTY_LIST); | |
| 328 | |
| 329 /** | |
| 307 * The analysis errors associated with a compilation unit in a specific library. | 330 * The analysis errors associated with a compilation unit in a specific library. |
| 308 * | 331 * |
| 309 * The result is only available for [LibrarySpecificUnit]s. | 332 * The result is only available for [LibrarySpecificUnit]s. |
| 310 */ | 333 */ |
| 311 final ListResultDescriptor<AnalysisError> LIBRARY_UNIT_ERRORS = | 334 final ListResultDescriptor<AnalysisError> LIBRARY_UNIT_ERRORS = |
| 312 new ListResultDescriptor<AnalysisError>( | 335 new ListResultDescriptor<AnalysisError>( |
| 313 'LIBRARY_UNIT_ERRORS', AnalysisError.NO_ERRORS); | 336 'LIBRARY_UNIT_ERRORS', AnalysisError.NO_ERRORS); |
| 314 | 337 |
| 315 /** | 338 /** |
| 316 * The errors produced while generating lints for a compilation unit. | 339 * The errors produced while generating lints for a compilation unit. |
| (...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1459 // | 1482 // |
| 1460 // Record outputs. | 1483 // Record outputs. |
| 1461 // | 1484 // |
| 1462 outputs[IMPORT_EXPORT_SOURCE_CLOSURE] = importExportClosure; | 1485 outputs[IMPORT_EXPORT_SOURCE_CLOSURE] = importExportClosure; |
| 1463 outputs[IS_CLIENT] = importExportClosure.contains(htmlSource); | 1486 outputs[IS_CLIENT] = importExportClosure.contains(htmlSource); |
| 1464 } | 1487 } |
| 1465 | 1488 |
| 1466 /** | 1489 /** |
| 1467 * Return a map from the names of the inputs of this kind of task to the task | 1490 * Return a map from the names of the inputs of this kind of task to the task |
| 1468 * input descriptors describing those inputs for a task with the | 1491 * input descriptors describing those inputs for a task with the |
| 1469 * given library [libSource]. | 1492 * given library [target]. |
| 1470 */ | 1493 */ |
| 1471 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 1494 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 1472 Source source = target; | 1495 Source source = target; |
| 1473 return <String, TaskInput>{ | 1496 return <String, TaskInput>{ |
| 1474 IMPORT_EXPORT_INPUT: | 1497 IMPORT_EXPORT_INPUT: |
| 1475 new _ImportExportSourceClosureTaskInput(source, LIBRARY_ELEMENT2) | 1498 new _ImportExportSourceClosureTaskInput(source, LIBRARY_ELEMENT2) |
| 1476 }; | 1499 }; |
| 1477 } | 1500 } |
| 1478 | 1501 |
| 1479 /** | 1502 /** |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1607 // | 1630 // |
| 1608 // TODO(brianwilkerson) This could be improved by computing a more accurate | 1631 // TODO(brianwilkerson) This could be improved by computing a more accurate |
| 1609 // list of the sources containing constructors that are actually referenced. | 1632 // list of the sources containing constructors that are actually referenced. |
| 1610 // | 1633 // |
| 1611 if (target is Element) { | 1634 if (target is Element) { |
| 1612 CompilationUnitElementImpl unit = target | 1635 CompilationUnitElementImpl unit = target |
| 1613 .getAncestor((Element element) => element is CompilationUnitElement); | 1636 .getAncestor((Element element) => element is CompilationUnitElement); |
| 1614 Source librarySource = unit.librarySource; | 1637 Source librarySource = unit.librarySource; |
| 1615 return <String, TaskInput>{ | 1638 return <String, TaskInput>{ |
| 1616 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE.of(librarySource).toList( | 1639 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE.of(librarySource).toList( |
| 1617 (Source library) => UNITS.of(library).toList((Source source) => | 1640 (Source library) => LIBRARY_SPECIFIC_UNITS |
| 1618 RESOLVED_UNIT9.of(new LibrarySpecificUnit(library, source)))), | 1641 .of(library) |
| 1642 .toList((LibrarySpecificUnit unit) => RESOLVED_UNIT9.of(unit))), | |
|
Brian Wilkerson
2015/10/23 13:58:57
Note that this is the code that will be reverted,
| |
| 1619 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 1643 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 1620 }; | 1644 }; |
| 1621 } else if (target is ConstantEvaluationTarget_Annotation) { | 1645 } else if (target is ConstantEvaluationTarget_Annotation) { |
| 1622 Source librarySource = target.librarySource; | 1646 Source librarySource = target.librarySource; |
| 1623 return <String, TaskInput>{ | 1647 return <String, TaskInput>{ |
| 1624 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE.of(librarySource).toList( | 1648 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE.of(librarySource).toList( |
| 1625 (Source library) => UNITS.of(library).toList((Source source) => | 1649 (Source library) => LIBRARY_SPECIFIC_UNITS |
| 1626 RESOLVED_UNIT9.of(new LibrarySpecificUnit(library, source)))), | 1650 .of(library) |
| 1651 .toList((LibrarySpecificUnit unit) => RESOLVED_UNIT9.of(unit))), | |
| 1627 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 1652 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 1628 }; | 1653 }; |
| 1629 } | 1654 } |
| 1630 throw new AnalysisException( | 1655 throw new AnalysisException( |
| 1631 'Cannot build inputs for a ${target.runtimeType}'); | 1656 'Cannot build inputs for a ${target.runtimeType}'); |
| 1632 } | 1657 } |
| 1633 | 1658 |
| 1634 /** | 1659 /** |
| 1635 * Create a [ComputeConstantDependenciesTask] based on the given [target] in | 1660 * Create a [ComputeConstantDependenciesTask] based on the given [target] in |
| 1636 * the given [context]. | 1661 * the given [context]. |
| (...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2575 /** | 2600 /** |
| 2576 * Return a map from the names of the inputs of this kind of task to the task | 2601 * Return a map from the names of the inputs of this kind of task to the task |
| 2577 * input descriptors describing those inputs for a task with the | 2602 * input descriptors describing those inputs for a task with the |
| 2578 * given [target]. | 2603 * given [target]. |
| 2579 */ | 2604 */ |
| 2580 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 2605 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 2581 LibrarySpecificUnit unit = target; | 2606 LibrarySpecificUnit unit = target; |
| 2582 Source libSource = unit.library; | 2607 Source libSource = unit.library; |
| 2583 return <String, TaskInput>{ | 2608 return <String, TaskInput>{ |
| 2584 RESOLVED_UNIT_INPUT: RESOLVED_UNIT.of(unit), | 2609 RESOLVED_UNIT_INPUT: RESOLVED_UNIT.of(unit), |
| 2585 USED_LOCAL_ELEMENTS_INPUT: UNITS.of(libSource).toList((unit) { | 2610 USED_LOCAL_ELEMENTS_INPUT: |
| 2586 LibrarySpecificUnit target = new LibrarySpecificUnit(libSource, unit); | 2611 LIBRARY_SPECIFIC_UNITS.of(libSource).toListOf(USED_LOCAL_ELEMENTS), |
| 2587 return USED_LOCAL_ELEMENTS.of(target); | 2612 USED_IMPORTED_ELEMENTS_INPUT: |
| 2588 }), | 2613 LIBRARY_SPECIFIC_UNITS.of(libSource).toListOf(USED_IMPORTED_ELEMENTS), |
| 2589 USED_IMPORTED_ELEMENTS_INPUT: UNITS.of(libSource).toList((unit) { | |
| 2590 LibrarySpecificUnit target = new LibrarySpecificUnit(libSource, unit); | |
| 2591 return USED_IMPORTED_ELEMENTS.of(target); | |
| 2592 }), | |
| 2593 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 2614 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 2594 }; | 2615 }; |
| 2595 } | 2616 } |
| 2596 | 2617 |
| 2597 /** | 2618 /** |
| 2598 * Create a [GenerateHintsTask] based on the given [target] in | 2619 * Create a [GenerateHintsTask] based on the given [target] in |
| 2599 * the given [context]. | 2620 * the given [context]. |
| 2600 */ | 2621 */ |
| 2601 static GenerateHintsTask createTask( | 2622 static GenerateHintsTask createTask( |
| 2602 AnalysisContext context, AnalysisTarget target) { | 2623 AnalysisContext context, AnalysisTarget target) { |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3029 TaskDescriptor get descriptor => DESCRIPTOR; | 3050 TaskDescriptor get descriptor => DESCRIPTOR; |
| 3030 | 3051 |
| 3031 @override | 3052 @override |
| 3032 void internalPerform() { | 3053 void internalPerform() { |
| 3033 outputs[LIBRARY_ERRORS_READY] = true; | 3054 outputs[LIBRARY_ERRORS_READY] = true; |
| 3034 } | 3055 } |
| 3035 | 3056 |
| 3036 /** | 3057 /** |
| 3037 * Return a map from the names of the inputs of this kind of task to the task | 3058 * Return a map from the names of the inputs of this kind of task to the task |
| 3038 * input descriptors describing those inputs for a task with the | 3059 * input descriptors describing those inputs for a task with the |
| 3039 * given [library]. | 3060 * given [target]. |
| 3040 */ | 3061 */ |
| 3041 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 3062 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3042 Source source = target; | 3063 Source source = target; |
| 3043 return <String, TaskInput>{ | 3064 return <String, TaskInput>{ |
| 3044 'allErrors': UNITS.of(source).toListOf(DART_ERRORS) | 3065 'allErrors': UNITS.of(source).toListOf(DART_ERRORS) |
| 3045 }; | 3066 }; |
| 3046 } | 3067 } |
| 3047 | 3068 |
| 3048 /** | 3069 /** |
| 3049 * Create a [LibraryErrorsReadyTask] based on the given [target] in the given | 3070 * Create a [LibraryErrorsReadyTask] based on the given [target] in the given |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3208 | 3229 |
| 3209 /** | 3230 /** |
| 3210 * The task descriptor describing this kind of task. | 3231 * The task descriptor describing this kind of task. |
| 3211 */ | 3232 */ |
| 3212 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3233 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 3213 'ParseDartTask', createTask, buildInputs, <ResultDescriptor>[ | 3234 'ParseDartTask', createTask, buildInputs, <ResultDescriptor>[ |
| 3214 EXPLICITLY_IMPORTED_LIBRARIES, | 3235 EXPLICITLY_IMPORTED_LIBRARIES, |
| 3215 EXPORTED_LIBRARIES, | 3236 EXPORTED_LIBRARIES, |
| 3216 IMPORTED_LIBRARIES, | 3237 IMPORTED_LIBRARIES, |
| 3217 INCLUDED_PARTS, | 3238 INCLUDED_PARTS, |
| 3239 LIBRARY_SPECIFIC_UNITS, | |
| 3218 PARSE_ERRORS, | 3240 PARSE_ERRORS, |
| 3219 PARSED_UNIT, | 3241 PARSED_UNIT, |
| 3220 SOURCE_KIND, | 3242 SOURCE_KIND, |
| 3221 UNITS | 3243 UNITS |
| 3222 ]); | 3244 ]); |
| 3223 | 3245 |
| 3224 /** | 3246 /** |
| 3225 * Initialize a newly created task to parse the content of the Dart file | 3247 * Initialize a newly created task to parse the content of the Dart file |
| 3226 * associated with the given [target] in the given [context]. | 3248 * associated with the given [target] in the given [context]. |
| 3227 */ | 3249 */ |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3294 // Record outputs. | 3316 // Record outputs. |
| 3295 // | 3317 // |
| 3296 List<Source> explicitlyImportedSources = | 3318 List<Source> explicitlyImportedSources = |
| 3297 explicitlyImportedSourceSet.toList(); | 3319 explicitlyImportedSourceSet.toList(); |
| 3298 List<Source> exportedSources = exportedSourceSet.toList(); | 3320 List<Source> exportedSources = exportedSourceSet.toList(); |
| 3299 List<Source> importedSources = importedSourceSet.toList(); | 3321 List<Source> importedSources = importedSourceSet.toList(); |
| 3300 List<Source> includedSources = includedSourceSet.toList(); | 3322 List<Source> includedSources = includedSourceSet.toList(); |
| 3301 List<AnalysisError> parseErrors = | 3323 List<AnalysisError> parseErrors = |
| 3302 removeDuplicateErrors(errorListener.errors); | 3324 removeDuplicateErrors(errorListener.errors); |
| 3303 List<Source> unitSources = <Source>[source]..addAll(includedSourceSet); | 3325 List<Source> unitSources = <Source>[source]..addAll(includedSourceSet); |
| 3326 List<LibrarySpecificUnit> librarySpecificUnits = | |
| 3327 unitSources.map((s) => new LibrarySpecificUnit(source, s)).toList(); | |
| 3304 outputs[EXPLICITLY_IMPORTED_LIBRARIES] = explicitlyImportedSources; | 3328 outputs[EXPLICITLY_IMPORTED_LIBRARIES] = explicitlyImportedSources; |
| 3305 outputs[EXPORTED_LIBRARIES] = exportedSources; | 3329 outputs[EXPORTED_LIBRARIES] = exportedSources; |
| 3306 outputs[IMPORTED_LIBRARIES] = importedSources; | 3330 outputs[IMPORTED_LIBRARIES] = importedSources; |
| 3307 outputs[INCLUDED_PARTS] = includedSources; | 3331 outputs[INCLUDED_PARTS] = includedSources; |
| 3332 outputs[LIBRARY_SPECIFIC_UNITS] = librarySpecificUnits; | |
| 3308 outputs[PARSE_ERRORS] = parseErrors; | 3333 outputs[PARSE_ERRORS] = parseErrors; |
| 3309 outputs[PARSED_UNIT] = unit; | 3334 outputs[PARSED_UNIT] = unit; |
| 3310 outputs[SOURCE_KIND] = sourceKind; | 3335 outputs[SOURCE_KIND] = sourceKind; |
| 3311 outputs[UNITS] = unitSources; | 3336 outputs[UNITS] = unitSources; |
| 3312 } | 3337 } |
| 3313 | 3338 |
| 3314 /** | 3339 /** |
| 3315 * Return a map from the names of the inputs of this kind of task to the task | 3340 * Return a map from the names of the inputs of this kind of task to the task |
| 3316 * input descriptors describing those inputs for a task with the given | 3341 * input descriptors describing those inputs for a task with the given |
| 3317 * [source]. | 3342 * [source]. |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3778 | 3803 |
| 3779 /** | 3804 /** |
| 3780 * Return a map from the names of the inputs of this kind of task to the task | 3805 * Return a map from the names of the inputs of this kind of task to the task |
| 3781 * input descriptors describing those inputs for a task with the | 3806 * input descriptors describing those inputs for a task with the |
| 3782 * given [target]. | 3807 * given [target]. |
| 3783 */ | 3808 */ |
| 3784 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 3809 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3785 Source source = target; | 3810 Source source = target; |
| 3786 return <String, TaskInput>{ | 3811 return <String, TaskInput>{ |
| 3787 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(source), | 3812 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(source), |
| 3788 UNITS_INPUT: UNITS.of(source).toList((Source unit) => | 3813 UNITS_INPUT: LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT9), |
| 3789 RESOLVED_UNIT9.of(new LibrarySpecificUnit(source, unit))), | |
| 3790 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE | 3814 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE |
| 3791 .of(source) | 3815 .of(source) |
| 3792 .toMapOf(UNITS) | 3816 .toFlattenListOf(LIBRARY_SPECIFIC_UNITS) |
| 3793 .toFlattenList((Source library, Source unit) => | 3817 .toListOf(RESOLVED_UNIT9), |
| 3794 RESOLVED_UNIT9.of(new LibrarySpecificUnit(library, unit))), | |
| 3795 }; | 3818 }; |
| 3796 } | 3819 } |
| 3797 | 3820 |
| 3798 /** | 3821 /** |
| 3799 * Create a [ResolveLibraryReferencesTask] based on the given [target] in | 3822 * Create a [ResolveLibraryReferencesTask] based on the given [target] in |
| 3800 * the given [context]. | 3823 * the given [context]. |
| 3801 */ | 3824 */ |
| 3802 static ResolveLibraryReferencesTask createTask( | 3825 static ResolveLibraryReferencesTask createTask( |
| 3803 AnalysisContext context, AnalysisTarget target) { | 3826 AnalysisContext context, AnalysisTarget target) { |
| 3804 return new ResolveLibraryReferencesTask(context, target); | 3827 return new ResolveLibraryReferencesTask(context, target); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3854 } | 3877 } |
| 3855 | 3878 |
| 3856 /** | 3879 /** |
| 3857 * Return a map from the names of the inputs of this kind of task to the task | 3880 * Return a map from the names of the inputs of this kind of task to the task |
| 3858 * input descriptors describing those inputs for a task with the | 3881 * input descriptors describing those inputs for a task with the |
| 3859 * given [target]. | 3882 * given [target]. |
| 3860 */ | 3883 */ |
| 3861 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 3884 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 3862 Source source = target; | 3885 Source source = target; |
| 3863 return <String, TaskInput>{ | 3886 return <String, TaskInput>{ |
| 3864 'resolvedUnit': UNITS.of(source).toList((Source unit) => | 3887 'resolvedUnit': |
| 3865 RESOLVED_UNIT3.of(new LibrarySpecificUnit(source, unit))), | 3888 LIBRARY_SPECIFIC_UNITS.of(source).toListOf(RESOLVED_UNIT3), |
| 3866 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(source), | 3889 LIBRARY_INPUT: LIBRARY_ELEMENT4.of(source), |
| 3867 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 3890 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 3868 }; | 3891 }; |
| 3869 } | 3892 } |
| 3870 | 3893 |
| 3871 /** | 3894 /** |
| 3872 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in | 3895 * Create a [ResolveLibraryTypeNamesTask] based on the given [target] in |
| 3873 * the given [context]. | 3896 * the given [context]. |
| 3874 */ | 3897 */ |
| 3875 static ResolveLibraryTypeNamesTask createTask( | 3898 static ResolveLibraryTypeNamesTask createTask( |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4309 /** | 4332 /** |
| 4310 * Return a map from the names of the inputs of this kind of task to the task | 4333 * Return a map from the names of the inputs of this kind of task to the task |
| 4311 * input descriptors describing those inputs for a task with the | 4334 * input descriptors describing those inputs for a task with the |
| 4312 * given [target]. | 4335 * given [target]. |
| 4313 */ | 4336 */ |
| 4314 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 4337 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4315 LibrarySpecificUnit unit = target; | 4338 LibrarySpecificUnit unit = target; |
| 4316 return <String, TaskInput>{ | 4339 return <String, TaskInput>{ |
| 4317 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE | 4340 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE |
| 4318 .of(unit.library) | 4341 .of(unit.library) |
| 4319 .toMapOf(UNITS) | 4342 .toFlattenListOf(LIBRARY_SPECIFIC_UNITS) |
| 4320 .toFlattenList((Source library, Source unit) => | 4343 .toListOf(RESOLVED_UNIT10), |
| 4321 RESOLVED_UNIT10.of(new LibrarySpecificUnit(library, unit))), | |
| 4322 UNIT_INPUT: RESOLVED_UNIT10.of(unit), | 4344 UNIT_INPUT: RESOLVED_UNIT10.of(unit), |
| 4323 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 4345 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 4324 }; | 4346 }; |
| 4325 } | 4347 } |
| 4326 | 4348 |
| 4327 /** | 4349 /** |
| 4328 * Create a [StrongModeVerifyUnitTask] based on the given [target] in | 4350 * Create a [StrongModeVerifyUnitTask] based on the given [target] in |
| 4329 * the given [context]. | 4351 * the given [context]. |
| 4330 */ | 4352 */ |
| 4331 static StrongModeVerifyUnitTask createTask( | 4353 static StrongModeVerifyUnitTask createTask( |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4440 /** | 4462 /** |
| 4441 * Return a map from the names of the inputs of this kind of task to the task | 4463 * Return a map from the names of the inputs of this kind of task to the task |
| 4442 * input descriptors describing those inputs for a task with the | 4464 * input descriptors describing those inputs for a task with the |
| 4443 * given [target]. | 4465 * given [target]. |
| 4444 */ | 4466 */ |
| 4445 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { | 4467 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { |
| 4446 LibrarySpecificUnit unit = target; | 4468 LibrarySpecificUnit unit = target; |
| 4447 return <String, TaskInput>{ | 4469 return <String, TaskInput>{ |
| 4448 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE | 4470 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE |
| 4449 .of(unit.library) | 4471 .of(unit.library) |
| 4450 .toMapOf(UNITS) | 4472 .toFlattenListOf(LIBRARY_SPECIFIC_UNITS) |
| 4451 .toFlattenList((Source library, Source unit) => | 4473 .toListOf(RESOLVED_UNIT), |
| 4452 RESOLVED_UNIT.of(new LibrarySpecificUnit(library, unit))), | |
| 4453 UNIT_INPUT: RESOLVED_UNIT.of(unit), | 4474 UNIT_INPUT: RESOLVED_UNIT.of(unit), |
| 4454 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 4475 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 4455 }; | 4476 }; |
| 4456 } | 4477 } |
| 4457 | 4478 |
| 4458 /** | 4479 /** |
| 4459 * Create a [VerifyUnitTask] based on the given [target] in | 4480 * Create a [VerifyUnitTask] based on the given [target] in |
| 4460 * the given [context]. | 4481 * the given [context]. |
| 4461 */ | 4482 */ |
| 4462 static VerifyUnitTask createTask( | 4483 static VerifyUnitTask createTask( |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 4478 | 4499 |
| 4479 _ExportSourceClosureTaskInput(this.target, this.resultDescriptor); | 4500 _ExportSourceClosureTaskInput(this.target, this.resultDescriptor); |
| 4480 | 4501 |
| 4481 @override | 4502 @override |
| 4482 TaskInputBuilder<List<Source>> createBuilder() => | 4503 TaskInputBuilder<List<Source>> createBuilder() => |
| 4483 new _SourceClosureTaskInputBuilder( | 4504 new _SourceClosureTaskInputBuilder( |
| 4484 target, _SourceClosureKind.EXPORT, resultDescriptor); | 4505 target, _SourceClosureKind.EXPORT, resultDescriptor); |
| 4485 } | 4506 } |
| 4486 | 4507 |
| 4487 /** | 4508 /** |
| 4509 * The lists of library source that are imported or exported directly or | |
| 4510 * indirectly by a [Source]. | |
| 4511 */ | |
| 4512 class _ImportExportClosure {} | |
| 4513 | |
| 4514 /** | |
| 4488 * A [TaskInput] whose value is a list of library sources imported or exported, | 4515 * A [TaskInput] whose value is a list of library sources imported or exported, |
| 4489 * directly or indirectly by the target [Source]. | 4516 * directly or indirectly by the target [Source]. |
| 4490 * | 4517 * |
| 4491 * [resultDescriptor] is the type of result which should be produced for each | 4518 * [resultDescriptor] is the type of result which should be produced for each |
| 4492 * target [Source]. | 4519 * target [Source]. |
| 4493 */ | 4520 */ |
| 4494 class _ImportExportSourceClosureTaskInput extends TaskInputImpl<List<Source>> { | 4521 class _ImportExportSourceClosureTaskInput extends TaskInputImpl<List<Source>> { |
| 4495 final Source target; | 4522 final Source target; |
| 4496 final ResultDescriptor resultDescriptor; | 4523 final ResultDescriptor resultDescriptor; |
| 4497 | 4524 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4582 | 4609 |
| 4583 @override | 4610 @override |
| 4584 bool moveNext() { | 4611 bool moveNext() { |
| 4585 if (_newSources.isEmpty) { | 4612 if (_newSources.isEmpty) { |
| 4586 return false; | 4613 return false; |
| 4587 } | 4614 } |
| 4588 currentTarget = _newSources.removeLast(); | 4615 currentTarget = _newSources.removeLast(); |
| 4589 return true; | 4616 return true; |
| 4590 } | 4617 } |
| 4591 } | 4618 } |
| OLD | NEW |