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 import 'dart:math' as math; | 8 import 'dart:math' as math; |
| 9 | 9 |
| 10 import 'package:analyzer/src/context/cache.dart'; | 10 import 'package:analyzer/src/context/cache.dart'; |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 * | 245 * |
| 246 * [LIBRARY_ELEMENT4] plus resolved types for every element. | 246 * [LIBRARY_ELEMENT4] plus resolved types for every element. |
| 247 * | 247 * |
| 248 * The result is only available for [Source]s representing a library. | 248 * The result is only available for [Source]s representing a library. |
| 249 */ | 249 */ |
| 250 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT5 = | 250 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT5 = |
| 251 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT5', null, | 251 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT5', null, |
| 252 cachingPolicy: ELEMENT_CACHING_POLICY); | 252 cachingPolicy: ELEMENT_CACHING_POLICY); |
| 253 | 253 |
| 254 /** | 254 /** |
| 255 * The partial [LibraryElement] associated with a library. | |
| 256 * | |
| 257 * [LIBRARY_ELEMENT5] plus resolved elements and types for all expressions. | |
| 258 * | |
| 259 * The result is only available for [Source]s representing a library. | |
| 260 */ | |
| 261 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT6 = | |
| 262 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT6', null, | |
| 263 cachingPolicy: ELEMENT_CACHING_POLICY); | |
| 264 | |
| 265 /** | |
| 255 * The flag specifying whether all analysis errors are computed in a specific | 266 * The flag specifying whether all analysis errors are computed in a specific |
| 256 * library. | 267 * library. |
| 257 * | 268 * |
| 258 * The result is only available for [Source]s representing a library. | 269 * The result is only available for [Source]s representing a library. |
| 259 */ | 270 */ |
| 260 final ResultDescriptor<bool> LIBRARY_ERRORS_READY = | 271 final ResultDescriptor<bool> LIBRARY_ERRORS_READY = |
| 261 new ResultDescriptor<bool>('LIBRARY_ERRORS_READY', false); | 272 new ResultDescriptor<bool>('LIBRARY_ERRORS_READY', false); |
| 262 | 273 |
| 263 /** | 274 /** |
| 264 * The analysis errors associated with a compilation unit in a specific library. | 275 * The analysis errors associated with a compilation unit in a specific library. |
| (...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1210 * Create a [BuildFunctionTypeAliasesTask] based on the given [target] in | 1221 * Create a [BuildFunctionTypeAliasesTask] based on the given [target] in |
| 1211 * the given [context]. | 1222 * the given [context]. |
| 1212 */ | 1223 */ |
| 1213 static BuildFunctionTypeAliasesTask createTask( | 1224 static BuildFunctionTypeAliasesTask createTask( |
| 1214 AnalysisContext context, AnalysisTarget target) { | 1225 AnalysisContext context, AnalysisTarget target) { |
| 1215 return new BuildFunctionTypeAliasesTask(context, target); | 1226 return new BuildFunctionTypeAliasesTask(context, target); |
| 1216 } | 1227 } |
| 1217 } | 1228 } |
| 1218 | 1229 |
| 1219 /** | 1230 /** |
| 1220 * This task finishes building [LIBRARY_ELEMENT] by forcing building | 1231 * This task builds [LIBRARY_ELEMENT6] by forcing building constructors for |
| 1221 * constructors for classes in the defining and part units of a library. | 1232 * all the classes of the defining and part units of a library. |
| 1222 */ | 1233 */ |
| 1223 class BuildLibraryConstructorsTask extends SourceBasedAnalysisTask { | 1234 class BuildLibraryConstructorsTask extends SourceBasedAnalysisTask { |
| 1224 /** | 1235 /** |
| 1225 * The name of the [LIBRARY_ELEMENT5] input. | 1236 * The name of the [LIBRARY_ELEMENT5] input. |
| 1226 */ | 1237 */ |
| 1227 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 1238 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 1228 | 1239 |
| 1229 /** | 1240 /** |
| 1230 * The task descriptor describing this kind of task. | 1241 * The task descriptor describing this kind of task. |
| 1231 */ | 1242 */ |
| 1232 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 1243 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 1233 'BuildLibraryConstructorsTask', createTask, buildInputs, | 1244 'BuildLibraryConstructorsTask', createTask, buildInputs, |
| 1234 <ResultDescriptor>[LIBRARY_ELEMENT]); | 1245 <ResultDescriptor>[LIBRARY_ELEMENT6]); |
| 1235 | 1246 |
| 1236 BuildLibraryConstructorsTask( | 1247 BuildLibraryConstructorsTask( |
| 1237 InternalAnalysisContext context, AnalysisTarget target) | 1248 InternalAnalysisContext context, AnalysisTarget target) |
| 1238 : super(context, target); | 1249 : super(context, target); |
| 1239 | 1250 |
| 1240 @override | 1251 @override |
| 1241 TaskDescriptor get descriptor => DESCRIPTOR; | 1252 TaskDescriptor get descriptor => DESCRIPTOR; |
| 1242 | 1253 |
| 1243 @override | 1254 @override |
| 1244 void internalPerform() { | 1255 void internalPerform() { |
| 1245 LibraryElement library = getRequiredInput(LIBRARY_INPUT); | 1256 LibraryElement library = getRequiredInput(LIBRARY_INPUT); |
| 1246 outputs[LIBRARY_ELEMENT] = library; | 1257 outputs[LIBRARY_ELEMENT6] = library; |
| 1247 } | 1258 } |
| 1248 | 1259 |
| 1249 /** | 1260 /** |
| 1250 * Return a map from the names of the inputs of this kind of task to the task | 1261 * Return a map from the names of the inputs of this kind of task to the task |
| 1251 * input descriptors describing those inputs for a task with the | 1262 * input descriptors describing those inputs for a task with the |
| 1252 * given [target]. | 1263 * given [target]. |
| 1253 */ | 1264 */ |
| 1254 static Map<String, TaskInput> buildInputs(Source libSource) { | 1265 static Map<String, TaskInput> buildInputs(Source libSource) { |
| 1255 return <String, TaskInput>{ | 1266 return <String, TaskInput>{ |
| 1256 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(libSource), | 1267 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(libSource), |
| (...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1795 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 1806 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 1796 }; | 1807 }; |
| 1797 } else { | 1808 } else { |
| 1798 // Should never happen. | 1809 // Should never happen. |
| 1799 assert(false); | 1810 assert(false); |
| 1800 return <String, TaskInput>{}; | 1811 return <String, TaskInput>{}; |
| 1801 } | 1812 } |
| 1802 } | 1813 } |
| 1803 | 1814 |
| 1804 /** | 1815 /** |
| 1805 * Create a [ResolveReferencesTask] based on the given [target] in | 1816 * Create a [ResolveUnitReferencesTask] based on the given [target] in |
| 1806 * the given [context]. | 1817 * the given [context]. |
| 1807 */ | 1818 */ |
| 1808 static ComputeConstantDependenciesTask createTask( | 1819 static ComputeConstantDependenciesTask createTask( |
| 1809 AnalysisContext context, AnalysisTarget target) { | 1820 AnalysisContext context, AnalysisTarget target) { |
| 1810 return new ComputeConstantDependenciesTask(context, target); | 1821 return new ComputeConstantDependenciesTask(context, target); |
| 1811 } | 1822 } |
| 1812 } | 1823 } |
| 1813 | 1824 |
| 1814 /** | 1825 /** |
| 1815 * A task that computes the value of a constant ([CONSTANT_VALUE]) and | 1826 * A task that computes the value of a constant ([CONSTANT_VALUE]) and |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2107 outputs[RESOLVED_UNIT] = unit; | 2118 outputs[RESOLVED_UNIT] = unit; |
| 2108 } | 2119 } |
| 2109 | 2120 |
| 2110 /** | 2121 /** |
| 2111 * Return a map from the names of the inputs of this kind of task to the task | 2122 * Return a map from the names of the inputs of this kind of task to the task |
| 2112 * input descriptors describing those inputs for a task with the | 2123 * input descriptors describing those inputs for a task with the |
| 2113 * given [target]. | 2124 * given [target]. |
| 2114 */ | 2125 */ |
| 2115 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 2126 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 2116 return <String, TaskInput>{ | 2127 return <String, TaskInput>{ |
| 2128 'libraryElement': LIBRARY_ELEMENT.of(target.library), | |
|
Brian Wilkerson
2015/06/11 13:52:54
In a future CL, we should probably add comments in
| |
| 2117 UNIT_INPUT: RESOLVED_UNIT6.of(target), | 2129 UNIT_INPUT: RESOLVED_UNIT6.of(target), |
| 2118 CONSTANT_VALUES: | 2130 CONSTANT_VALUES: |
| 2119 COMPILATION_UNIT_CONSTANTS.of(target).toListOf(CONSTANT_VALUE) | 2131 COMPILATION_UNIT_CONSTANTS.of(target).toListOf(CONSTANT_VALUE) |
| 2120 }; | 2132 }; |
| 2121 } | 2133 } |
| 2122 | 2134 |
| 2123 /** | 2135 /** |
| 2124 * Create an [EvaluateUnitConstantsTask] based on the given [target] in | 2136 * Create an [EvaluateUnitConstantsTask] based on the given [target] in |
| 2125 * the given [context]. | 2137 * the given [context]. |
| 2126 */ | 2138 */ |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2502 outputs[LIBRARY_ERRORS_READY] = true; | 2514 outputs[LIBRARY_ERRORS_READY] = true; |
| 2503 } | 2515 } |
| 2504 | 2516 |
| 2505 /** | 2517 /** |
| 2506 * Return a map from the names of the inputs of this kind of task to the task | 2518 * Return a map from the names of the inputs of this kind of task to the task |
| 2507 * input descriptors describing those inputs for a task with the | 2519 * input descriptors describing those inputs for a task with the |
| 2508 * given [library]. | 2520 * given [library]. |
| 2509 */ | 2521 */ |
| 2510 static Map<String, TaskInput> buildInputs(Source library) { | 2522 static Map<String, TaskInput> buildInputs(Source library) { |
| 2511 return <String, TaskInput>{ | 2523 return <String, TaskInput>{ |
| 2524 'allLibraryElements': | |
| 2525 IMPORT_EXPORT_SOURCE_CLOSURE.of(library).toListOf(LIBRARY_ELEMENT), | |
| 2512 'allErrors': UNITS.of(library).toListOf(DART_ERRORS) | 2526 'allErrors': UNITS.of(library).toListOf(DART_ERRORS) |
| 2513 }; | 2527 }; |
| 2514 } | 2528 } |
| 2515 | 2529 |
| 2516 /** | 2530 /** |
| 2517 * Create a [LibraryErrorsReadyTask] based on the given [target] in the given | 2531 * Create a [LibraryErrorsReadyTask] based on the given [target] in the given |
| 2518 * [context]. | 2532 * [context]. |
| 2519 */ | 2533 */ |
| 2520 static LibraryErrorsReadyTask createTask( | 2534 static LibraryErrorsReadyTask createTask( |
| 2521 AnalysisContext context, AnalysisTarget target) { | 2535 AnalysisContext context, AnalysisTarget target) { |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2852 void _addPublicNames(CompilationUnitElement compilationUnit) { | 2866 void _addPublicNames(CompilationUnitElement compilationUnit) { |
| 2853 compilationUnit.accessors.forEach(_addIfPublic); | 2867 compilationUnit.accessors.forEach(_addIfPublic); |
| 2854 compilationUnit.enums.forEach(_addIfPublic); | 2868 compilationUnit.enums.forEach(_addIfPublic); |
| 2855 compilationUnit.functions.forEach(_addIfPublic); | 2869 compilationUnit.functions.forEach(_addIfPublic); |
| 2856 compilationUnit.functionTypeAliases.forEach(_addIfPublic); | 2870 compilationUnit.functionTypeAliases.forEach(_addIfPublic); |
| 2857 compilationUnit.types.forEach(_addIfPublic); | 2871 compilationUnit.types.forEach(_addIfPublic); |
| 2858 } | 2872 } |
| 2859 } | 2873 } |
| 2860 | 2874 |
| 2861 /** | 2875 /** |
| 2876 * A task that finishes resolution by requesting [RESOLVED_UNIT6] for every | |
| 2877 * unit in the libraries closure and produces [LIBRARY_ELEMENT]. | |
| 2878 */ | |
| 2879 class ResolveLibraryReferencesTask extends SourceBasedAnalysisTask { | |
| 2880 /** | |
| 2881 * The name of the [LIBRARY_ELEMENT6] input. | |
| 2882 */ | |
| 2883 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | |
| 2884 | |
| 2885 /** | |
| 2886 * The task descriptor describing this kind of task. | |
| 2887 */ | |
| 2888 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | |
| 2889 'ResolveLibraryReferencesTask', createTask, buildInputs, | |
| 2890 <ResultDescriptor>[LIBRARY_ELEMENT]); | |
| 2891 | |
| 2892 ResolveLibraryReferencesTask( | |
| 2893 InternalAnalysisContext context, AnalysisTarget target) | |
| 2894 : super(context, target); | |
| 2895 | |
| 2896 @override | |
| 2897 TaskDescriptor get descriptor => DESCRIPTOR; | |
| 2898 | |
| 2899 @override | |
| 2900 void internalPerform() { | |
| 2901 LibraryElement library = getRequiredInput(LIBRARY_INPUT); | |
| 2902 outputs[LIBRARY_ELEMENT] = library; | |
| 2903 } | |
| 2904 | |
| 2905 /** | |
| 2906 * Return a map from the names of the inputs of this kind of task to the task | |
| 2907 * input descriptors describing those inputs for a task with the | |
| 2908 * given [target]. | |
| 2909 */ | |
| 2910 static Map<String, TaskInput> buildInputs(Source libSource) { | |
| 2911 return <String, TaskInput>{ | |
| 2912 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(libSource), | |
| 2913 'resolvedUnits': IMPORT_EXPORT_SOURCE_CLOSURE | |
| 2914 .of(libSource) | |
| 2915 .toMapOf(UNITS) | |
| 2916 .toFlattenList((Source library, Source unit) => | |
| 2917 RESOLVED_UNIT6.of(new LibrarySpecificUnit(library, unit))), | |
| 2918 }; | |
| 2919 } | |
| 2920 | |
| 2921 /** | |
| 2922 * Create a [ResolveLibraryReferencesTask] based on the given [target] in | |
| 2923 * the given [context]. | |
| 2924 */ | |
| 2925 static ResolveLibraryReferencesTask createTask( | |
| 2926 AnalysisContext context, AnalysisTarget target) { | |
| 2927 return new ResolveLibraryReferencesTask(context, target); | |
| 2928 } | |
| 2929 } | |
| 2930 | |
| 2931 /** | |
| 2862 * An artifitial task that does nothing except to force type names resolution | 2932 * An artifitial task that does nothing except to force type names resolution |
| 2863 * for the defining and part units of a library. | 2933 * for the defining and part units of a library. |
| 2864 */ | 2934 */ |
| 2865 class ResolveLibraryTypeNamesTask extends SourceBasedAnalysisTask { | 2935 class ResolveLibraryTypeNamesTask extends SourceBasedAnalysisTask { |
| 2866 /** | 2936 /** |
| 2867 * The name of the [LIBRARY_ELEMENT4] input. | 2937 * The name of the [LIBRARY_ELEMENT4] input. |
| 2868 */ | 2938 */ |
| 2869 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 2939 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 2870 | 2940 |
| 2871 /** | 2941 /** |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2910 */ | 2980 */ |
| 2911 static ResolveLibraryTypeNamesTask createTask( | 2981 static ResolveLibraryTypeNamesTask createTask( |
| 2912 AnalysisContext context, AnalysisTarget target) { | 2982 AnalysisContext context, AnalysisTarget target) { |
| 2913 return new ResolveLibraryTypeNamesTask(context, target); | 2983 return new ResolveLibraryTypeNamesTask(context, target); |
| 2914 } | 2984 } |
| 2915 } | 2985 } |
| 2916 | 2986 |
| 2917 /** | 2987 /** |
| 2918 * A task that builds [RESOLVED_UNIT6] for a unit. | 2988 * A task that builds [RESOLVED_UNIT6] for a unit. |
| 2919 */ | 2989 */ |
| 2920 class ResolveReferencesTask extends SourceBasedAnalysisTask { | 2990 class ResolveUnitReferencesTask extends SourceBasedAnalysisTask { |
| 2921 /** | 2991 /** |
| 2922 * The name of the [LIBRARY_ELEMENT] input. | 2992 * The name of the [LIBRARY_ELEMENT6] input. |
| 2923 */ | 2993 */ |
| 2924 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 2994 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 2925 | 2995 |
| 2926 /** | 2996 /** |
| 2927 * The name of the [RESOLVED_UNIT5] input. | 2997 * The name of the [RESOLVED_UNIT5] input. |
| 2928 */ | 2998 */ |
| 2929 static const String UNIT_INPUT = 'UNIT_INPUT'; | 2999 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 2930 | 3000 |
| 2931 /** | 3001 /** |
| 2932 * The name of the [TYPE_PROVIDER] input. | 3002 * The name of the [TYPE_PROVIDER] input. |
| 2933 */ | 3003 */ |
| 2934 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; | 3004 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; |
| 2935 | 3005 |
| 2936 /** | 3006 /** |
| 2937 * The task descriptor describing this kind of task. | 3007 * The task descriptor describing this kind of task. |
| 2938 */ | 3008 */ |
| 2939 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( | 3009 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( |
| 2940 'ResolveReferencesTask', createTask, buildInputs, <ResultDescriptor>[ | 3010 'ResolveUnitReferencesTask', createTask, buildInputs, <ResultDescriptor>[ |
| 2941 RESOLVE_REFERENCES_ERRORS, | 3011 RESOLVE_REFERENCES_ERRORS, |
| 2942 RESOLVED_UNIT6 | 3012 RESOLVED_UNIT6 |
| 2943 ]); | 3013 ]); |
| 2944 | 3014 |
| 2945 ResolveReferencesTask(InternalAnalysisContext context, AnalysisTarget target) | 3015 ResolveUnitReferencesTask( |
| 3016 InternalAnalysisContext context, AnalysisTarget target) | |
| 2946 : super(context, target); | 3017 : super(context, target); |
| 2947 | 3018 |
| 2948 @override | 3019 @override |
| 2949 TaskDescriptor get descriptor => DESCRIPTOR; | 3020 TaskDescriptor get descriptor => DESCRIPTOR; |
| 2950 | 3021 |
| 2951 @override | 3022 @override |
| 2952 void internalPerform() { | 3023 void internalPerform() { |
| 2953 RecordingErrorListener errorListener = new RecordingErrorListener(); | 3024 RecordingErrorListener errorListener = new RecordingErrorListener(); |
| 2954 // | 3025 // |
| 2955 // Prepare inputs. | 3026 // Prepare inputs. |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 2974 outputs[RESOLVED_UNIT6] = unit; | 3045 outputs[RESOLVED_UNIT6] = unit; |
| 2975 } | 3046 } |
| 2976 | 3047 |
| 2977 /** | 3048 /** |
| 2978 * Return a map from the names of the inputs of this kind of task to the task | 3049 * Return a map from the names of the inputs of this kind of task to the task |
| 2979 * input descriptors describing those inputs for a task with the | 3050 * input descriptors describing those inputs for a task with the |
| 2980 * given [target]. | 3051 * given [target]. |
| 2981 */ | 3052 */ |
| 2982 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 3053 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 2983 return <String, TaskInput>{ | 3054 return <String, TaskInput>{ |
| 2984 LIBRARY_INPUT: LIBRARY_ELEMENT.of(target.library), | 3055 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(target.library), |
| 2985 UNIT_INPUT: RESOLVED_UNIT5.of(target), | 3056 UNIT_INPUT: RESOLVED_UNIT5.of(target), |
| 2986 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 3057 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 2987 }; | 3058 }; |
| 2988 } | 3059 } |
| 2989 | 3060 |
| 2990 /** | 3061 /** |
| 2991 * Create a [ResolveReferencesTask] based on the given [target] in | 3062 * Create a [ResolveUnitReferencesTask] based on the given [target] in |
| 2992 * the given [context]. | 3063 * the given [context]. |
| 2993 */ | 3064 */ |
| 2994 static ResolveReferencesTask createTask( | 3065 static ResolveUnitReferencesTask createTask( |
| 2995 AnalysisContext context, AnalysisTarget target) { | 3066 AnalysisContext context, AnalysisTarget target) { |
| 2996 return new ResolveReferencesTask(context, target); | 3067 return new ResolveUnitReferencesTask(context, target); |
| 2997 } | 3068 } |
| 2998 } | 3069 } |
| 2999 | 3070 |
| 3000 /** | 3071 /** |
| 3001 * A task that builds [RESOLVED_UNIT4] for a unit. | 3072 * A task that builds [RESOLVED_UNIT4] for a unit. |
| 3002 */ | 3073 */ |
| 3003 class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask { | 3074 class ResolveUnitTypeNamesTask extends SourceBasedAnalysisTask { |
| 3004 /** | 3075 /** |
| 3005 * The name of the input whose value is the defining [LIBRARY_ELEMENT4]. | 3076 * The name of the input whose value is the defining [LIBRARY_ELEMENT4]. |
| 3006 */ | 3077 */ |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3077 AnalysisContext context, AnalysisTarget target) { | 3148 AnalysisContext context, AnalysisTarget target) { |
| 3078 return new ResolveUnitTypeNamesTask(context, target); | 3149 return new ResolveUnitTypeNamesTask(context, target); |
| 3079 } | 3150 } |
| 3080 } | 3151 } |
| 3081 | 3152 |
| 3082 /** | 3153 /** |
| 3083 * A task that builds [RESOLVED_UNIT5] for a unit. | 3154 * A task that builds [RESOLVED_UNIT5] for a unit. |
| 3084 */ | 3155 */ |
| 3085 class ResolveVariableReferencesTask extends SourceBasedAnalysisTask { | 3156 class ResolveVariableReferencesTask extends SourceBasedAnalysisTask { |
| 3086 /** | 3157 /** |
| 3087 * The name of the [LIBRARY_ELEMENT] input. | 3158 * The name of the [LIBRARY_ELEMENT6] input. |
| 3088 */ | 3159 */ |
| 3089 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; | 3160 static const String LIBRARY_INPUT = 'LIBRARY_INPUT'; |
| 3090 | 3161 |
| 3091 /** | 3162 /** |
| 3092 * The name of the [RESOLVED_UNIT4] input. | 3163 * The name of the [RESOLVED_UNIT4] input. |
| 3093 */ | 3164 */ |
| 3094 static const String UNIT_INPUT = 'UNIT_INPUT'; | 3165 static const String UNIT_INPUT = 'UNIT_INPUT'; |
| 3095 | 3166 |
| 3096 /** | 3167 /** |
| 3097 * The name of the [TYPE_PROVIDER] input. | 3168 * The name of the [TYPE_PROVIDER] input. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3139 | 3210 |
| 3140 /** | 3211 /** |
| 3141 * Return a map from the names of the inputs of this kind of task to the task | 3212 * Return a map from the names of the inputs of this kind of task to the task |
| 3142 * input descriptors describing those inputs for a task with the | 3213 * input descriptors describing those inputs for a task with the |
| 3143 * given [target]. | 3214 * given [target]. |
| 3144 */ | 3215 */ |
| 3145 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 3216 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 3146 return <String, TaskInput>{ | 3217 return <String, TaskInput>{ |
| 3147 'fullyBuiltLibraryElements': IMPORT_EXPORT_SOURCE_CLOSURE | 3218 'fullyBuiltLibraryElements': IMPORT_EXPORT_SOURCE_CLOSURE |
| 3148 .of(target.library) | 3219 .of(target.library) |
| 3149 .toListOf(LIBRARY_ELEMENT), | 3220 .toListOf(LIBRARY_ELEMENT6), |
| 3150 LIBRARY_INPUT: LIBRARY_ELEMENT.of(target.library), | 3221 LIBRARY_INPUT: LIBRARY_ELEMENT6.of(target.library), |
| 3151 UNIT_INPUT: RESOLVED_UNIT4.of(target), | 3222 UNIT_INPUT: RESOLVED_UNIT4.of(target), |
| 3152 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 3223 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 3153 }; | 3224 }; |
| 3154 } | 3225 } |
| 3155 | 3226 |
| 3156 /** | 3227 /** |
| 3157 * Create a [ResolveVariableReferencesTask] based on the given [target] in | 3228 * Create a [ResolveVariableReferencesTask] based on the given [target] in |
| 3158 * the given [context]. | 3229 * the given [context]. |
| 3159 */ | 3230 */ |
| 3160 static ResolveVariableReferencesTask createTask( | 3231 static ResolveVariableReferencesTask createTask( |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3325 uriLiteral, [directive.uriContent]); | 3396 uriLiteral, [directive.uriContent]); |
| 3326 } | 3397 } |
| 3327 | 3398 |
| 3328 /** | 3399 /** |
| 3329 * Return a map from the names of the inputs of this kind of task to the task | 3400 * Return a map from the names of the inputs of this kind of task to the task |
| 3330 * input descriptors describing those inputs for a task with the | 3401 * input descriptors describing those inputs for a task with the |
| 3331 * given [target]. | 3402 * given [target]. |
| 3332 */ | 3403 */ |
| 3333 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { | 3404 static Map<String, TaskInput> buildInputs(LibrarySpecificUnit target) { |
| 3334 return <String, TaskInput>{ | 3405 return <String, TaskInput>{ |
| 3406 'libraryElement': LIBRARY_ELEMENT.of(target.library), | |
| 3335 UNIT_INPUT: RESOLVED_UNIT.of(target), | 3407 UNIT_INPUT: RESOLVED_UNIT.of(target), |
| 3336 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) | 3408 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request) |
| 3337 }; | 3409 }; |
| 3338 } | 3410 } |
| 3339 | 3411 |
| 3340 /** | 3412 /** |
| 3341 * Create a [VerifyUnitTask] based on the given [target] in | 3413 * Create a [VerifyUnitTask] based on the given [target] in |
| 3342 * the given [context]. | 3414 * the given [context]. |
| 3343 */ | 3415 */ |
| 3344 static VerifyUnitTask createTask( | 3416 static VerifyUnitTask createTask( |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3447 @override | 3519 @override |
| 3448 bool moveNext() { | 3520 bool moveNext() { |
| 3449 if (_newSources.isEmpty) { | 3521 if (_newSources.isEmpty) { |
| 3450 return false; | 3522 return false; |
| 3451 } | 3523 } |
| 3452 currentTarget = _newSources.first; | 3524 currentTarget = _newSources.first; |
| 3453 _newSources.remove(currentTarget); | 3525 _newSources.remove(currentTarget); |
| 3454 return true; | 3526 return true; |
| 3455 } | 3527 } |
| 3456 } | 3528 } |
| OLD | NEW |