Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(247)

Side by Side Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 1534033004: Use READY_RESOLVED_UNIT flag for ordering tasks. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 138
139 /** 139 /**
140 * The sources representing the libraries that include a given source as a part. 140 * The sources representing the libraries that include a given source as a part.
141 * 141 *
142 * The result is only available for [Source]s representing a compilation unit. 142 * The result is only available for [Source]s representing a compilation unit.
143 */ 143 */
144 final ListResultDescriptor<Source> CONTAINING_LIBRARIES = 144 final ListResultDescriptor<Source> CONTAINING_LIBRARIES =
145 new ListResultDescriptor<Source>('CONTAINING_LIBRARIES', Source.EMPTY_LIST); 145 new ListResultDescriptor<Source>('CONTAINING_LIBRARIES', Source.EMPTY_LIST);
146 146
147 /** 147 /**
148 * The flag specifying that [RESOLVED_UNIT] has been been computed for this
149 * compilation unit (without requiring that the AST for it still be in cache).
150 *
151 * The result is only available for [LibrarySpecificUnit]s.
152 */
153 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT =
154 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT', false);
155
156 /**
157 * The flag specifying that [RESOLVED_UNIT1] has been been computed for this
158 * compilation unit (without requiring that the AST for it still be in cache).
159 *
160 * The result is only available for [LibrarySpecificUnit]s.
161 */
162 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT1 =
163 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT1', false);
164
165 /**
166 * The flag specifying that [RESOLVED_UNIT10] has been been computed for this
167 * compilation unit (without requiring that the AST for it still be in cache).
168 *
169 * The result is only available for [LibrarySpecificUnit]s.
170 */
171 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT10 =
172 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT10', false);
173
174 /**
175 * The flag specifying that [RESOLVED_UNIT11] has been been computed for this
176 * compilation unit (without requiring that the AST for it still be in cache).
177 *
178 * The result is only available for [LibrarySpecificUnit]s.
179 */
180 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT11 =
181 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT11', false);
182
183 /**
184 * The flag specifying that [RESOLVED_UNIT2] has been been computed for this
185 * compilation unit (without requiring that the AST for it still be in cache).
186 *
187 * The result is only available for [LibrarySpecificUnit]s.
188 */
189 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT2 =
190 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT2', false);
191
192 /**
193 * The flag specifying that [RESOLVED_UNIT3] has been been computed for this
194 * compilation unit (without requiring that the AST for it still be in cache).
195 *
196 * The result is only available for [LibrarySpecificUnit]s.
197 */
198 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT3 =
199 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT3', false);
200
201 /**
202 * The flag specifying that [RESOLVED_UNIT4] has been been computed for this
203 * compilation unit (without requiring that the AST for it still be in cache).
204 *
205 * The result is only available for [LibrarySpecificUnit]s.
206 */
207 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT4 =
208 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT4', false);
209
210 /**
211 * The flag specifying that [RESOLVED_UNIT5] has been been computed for this
212 * compilation unit (without requiring that the AST for it still be in cache).
213 *
214 * The result is only available for [LibrarySpecificUnit]s.
215 */
216 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT5 =
217 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT5', false);
218
219 /**
220 * The flag specifying that [RESOLVED_UNIT6] has been been computed for this
221 * compilation unit (without requiring that the AST for it still be in cache).
222 *
223 * The result is only available for [LibrarySpecificUnit]s.
224 */
225 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT6 =
226 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT6', false);
227
228 /**
229 * The flag specifying that [RESOLVED_UNIT7] has been been computed for this
230 * compilation unit (without requiring that the AST for it still be in cache).
231 *
232 * The result is only available for [LibrarySpecificUnit]s.
233 */
234 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT7 =
235 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT7', false);
236
237 /**
238 * The flag specifying that [RESOLVED_UNIT8] has been been computed for this
239 * compilation unit (without requiring that the AST for it still be in cache).
240 *
241 * The result is only available for [LibrarySpecificUnit]s.
242 */
243 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT8 =
244 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT8', false);
245
246 /**
247 * The flag specifying that [RESOLVED_UNIT9] has been been computed for this
248 * compilation unit (without requiring that the AST for it still be in cache).
249 *
250 * The result is only available for [LibrarySpecificUnit]s.
251 */
252 final ResultDescriptor<bool> CREATED_RESOLVED_UNIT9 =
253 new ResultDescriptor<bool>('CREATED_RESOLVED_UNIT9', false);
254
255 /**
148 * The sources representing the export closure of a library. 256 * The sources representing the export closure of a library.
149 * The [Source]s include only library sources, not their units. 257 * The [Source]s include only library sources, not their units.
150 * 258 *
151 * The result is only available for [Source]s representing a library. 259 * The result is only available for [Source]s representing a library.
152 */ 260 */
153 final ListResultDescriptor<Source> EXPORT_SOURCE_CLOSURE = 261 final ListResultDescriptor<Source> EXPORT_SOURCE_CLOSURE =
154 new ListResultDescriptor<Source>('EXPORT_SOURCE_CLOSURE', null); 262 new ListResultDescriptor<Source>('EXPORT_SOURCE_CLOSURE', null);
155 263
156 /** 264 /**
157 * The errors produced while generating hints a compilation unit. 265 * The errors produced while generating hints a compilation unit.
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 839
732 /** 840 /**
733 * The task descriptor describing this kind of task. 841 * The task descriptor describing this kind of task.
734 */ 842 */
735 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 843 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
736 'BuildCompilationUnitElementTask', 844 'BuildCompilationUnitElementTask',
737 createTask, 845 createTask,
738 buildInputs, <ResultDescriptor>[ 846 buildInputs, <ResultDescriptor>[
739 COMPILATION_UNIT_CONSTANTS, 847 COMPILATION_UNIT_CONSTANTS,
740 COMPILATION_UNIT_ELEMENT, 848 COMPILATION_UNIT_ELEMENT,
849 CREATED_RESOLVED_UNIT1,
741 RESOLVED_UNIT1 850 RESOLVED_UNIT1
742 ]); 851 ]);
743 852
744 /** 853 /**
745 * Initialize a newly created task to build a compilation unit element for 854 * Initialize a newly created task to build a compilation unit element for
746 * the given [target] in the given [context]. 855 * the given [target] in the given [context].
747 */ 856 */
748 BuildCompilationUnitElementTask( 857 BuildCompilationUnitElementTask(
749 InternalAnalysisContext context, AnalysisTarget target) 858 InternalAnalysisContext context, AnalysisTarget target)
750 : super(context, target); 859 : super(context, target);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
783 unit.accept(constantFinder); 892 unit.accept(constantFinder);
784 List<ConstantEvaluationTarget> constants = 893 List<ConstantEvaluationTarget> constants =
785 new List<ConstantEvaluationTarget>.from( 894 new List<ConstantEvaluationTarget>.from(
786 constantFinder.constantsToCompute); 895 constantFinder.constantsToCompute);
787 // 896 //
788 // Record outputs. 897 // Record outputs.
789 // 898 //
790 outputs[COMPILATION_UNIT_CONSTANTS] = constants; 899 outputs[COMPILATION_UNIT_CONSTANTS] = constants;
791 outputs[COMPILATION_UNIT_ELEMENT] = element; 900 outputs[COMPILATION_UNIT_ELEMENT] = element;
792 outputs[RESOLVED_UNIT1] = unit; 901 outputs[RESOLVED_UNIT1] = unit;
902 outputs[CREATED_RESOLVED_UNIT1] = true;
793 } 903 }
794 904
795 /** 905 /**
796 * Return a map from the names of the inputs of this kind of task to the task 906 * Return a map from the names of the inputs of this kind of task to the task
797 * input descriptors describing those inputs for a task with the given 907 * input descriptors describing those inputs for a task with the given
798 * [target]. 908 * [target].
799 */ 909 */
800 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 910 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
801 LibrarySpecificUnit unit = target; 911 LibrarySpecificUnit unit = target;
802 return <String, TaskInput>{ 912 return <String, TaskInput>{
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1092 */ 1202 */
1093 static const String UNIT_INPUT = 'UNIT_INPUT'; 1203 static const String UNIT_INPUT = 'UNIT_INPUT';
1094 1204
1095 /** 1205 /**
1096 * The task descriptor describing this kind of task. 1206 * The task descriptor describing this kind of task.
1097 */ 1207 */
1098 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 1208 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
1099 'BuildEnumMemberElementsTask', 1209 'BuildEnumMemberElementsTask',
1100 createTask, 1210 createTask,
1101 buildInputs, 1211 buildInputs,
1102 <ResultDescriptor>[RESOLVED_UNIT2]); 1212 <ResultDescriptor>[CREATED_RESOLVED_UNIT2, RESOLVED_UNIT2]);
1103 1213
1104 BuildEnumMemberElementsTask( 1214 BuildEnumMemberElementsTask(
1105 InternalAnalysisContext context, AnalysisTarget target) 1215 InternalAnalysisContext context, AnalysisTarget target)
1106 : super(context, target); 1216 : super(context, target);
1107 1217
1108 @override 1218 @override
1109 TaskDescriptor get descriptor => DESCRIPTOR; 1219 TaskDescriptor get descriptor => DESCRIPTOR;
1110 1220
1111 @override 1221 @override
1112 void internalPerform() { 1222 void internalPerform() {
1113 // 1223 //
1114 // Prepare inputs. 1224 // Prepare inputs.
1115 // 1225 //
1116 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); 1226 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
1117 CompilationUnit unit = getRequiredInput(UNIT_INPUT); 1227 CompilationUnit unit = getRequiredInput(UNIT_INPUT);
1118 // 1228 //
1119 // Record outputs. 1229 // Record outputs.
1120 // 1230 //
1121 EnumMemberBuilder builder = new EnumMemberBuilder(typeProvider); 1231 EnumMemberBuilder builder = new EnumMemberBuilder(typeProvider);
1122 unit.accept(builder); 1232 unit.accept(builder);
1233 outputs[CREATED_RESOLVED_UNIT2] = true;
1123 outputs[RESOLVED_UNIT2] = unit; 1234 outputs[RESOLVED_UNIT2] = unit;
1124 } 1235 }
1125 1236
1126 /** 1237 /**
1127 * Return a map from the names of the inputs of this kind of task to the task 1238 * Return a map from the names of the inputs of this kind of task to the task
1128 * input descriptors describing those inputs for a task with the 1239 * input descriptors describing those inputs for a task with the
1129 * given [target]. 1240 * given [target].
1130 */ 1241 */
1131 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 1242 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
1132 LibrarySpecificUnit unit = target; 1243 LibrarySpecificUnit unit = target;
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
2391 */ 2502 */
2392 static const String CONSTANT_VALUES = 'CONSTANT_VALUES'; 2503 static const String CONSTANT_VALUES = 'CONSTANT_VALUES';
2393 2504
2394 /** 2505 /**
2395 * The task descriptor describing this kind of task. 2506 * The task descriptor describing this kind of task.
2396 */ 2507 */
2397 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 2508 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
2398 'EvaluateUnitConstantsTask', 2509 'EvaluateUnitConstantsTask',
2399 createTask, 2510 createTask,
2400 buildInputs, 2511 buildInputs,
2401 <ResultDescriptor>[RESOLVED_UNIT11]); 2512 <ResultDescriptor>[CREATED_RESOLVED_UNIT11, RESOLVED_UNIT11]);
2402 2513
2403 EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target) 2514 EvaluateUnitConstantsTask(AnalysisContext context, LibrarySpecificUnit target)
2404 : super(context, target); 2515 : super(context, target);
2405 2516
2406 @override 2517 @override
2407 TaskDescriptor get descriptor => DESCRIPTOR; 2518 TaskDescriptor get descriptor => DESCRIPTOR;
2408 2519
2409 @override 2520 @override
2410 void internalPerform() { 2521 void internalPerform() {
2411 // No actual work needs to be performed; the task manager will ensure that 2522 // No actual work needs to be performed; the task manager will ensure that
2412 // all constants are evaluated before this method is called. 2523 // all constants are evaluated before this method is called.
2413 CompilationUnit unit = getRequiredInput(UNIT_INPUT); 2524 CompilationUnit unit = getRequiredInput(UNIT_INPUT);
2414 outputs[RESOLVED_UNIT11] = unit; 2525 outputs[RESOLVED_UNIT11] = unit;
2526 outputs[CREATED_RESOLVED_UNIT11] = true;
2415 } 2527 }
2416 2528
2417 /** 2529 /**
2418 * Return a map from the names of the inputs of this kind of task to the task 2530 * Return a map from the names of the inputs of this kind of task to the task
2419 * input descriptors describing those inputs for a task with the 2531 * input descriptors describing those inputs for a task with the
2420 * given [target]. 2532 * given [target].
2421 */ 2533 */
2422 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 2534 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
2423 LibrarySpecificUnit unit = target; 2535 LibrarySpecificUnit unit = target;
2424 return <String, TaskInput>{ 2536 return <String, TaskInput>{
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
2884 */ 2996 */
2885 static const String UNIT_INPUT = 'UNIT_INPUT'; 2997 static const String UNIT_INPUT = 'UNIT_INPUT';
2886 2998
2887 /** 2999 /**
2888 * The task descriptor describing this kind of task. 3000 * The task descriptor describing this kind of task.
2889 */ 3001 */
2890 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 3002 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
2891 'InferInstanceMembersInUnitTask', 3003 'InferInstanceMembersInUnitTask',
2892 createTask, 3004 createTask,
2893 buildInputs, 3005 buildInputs,
2894 <ResultDescriptor>[RESOLVED_UNIT9]); 3006 <ResultDescriptor>[CREATED_RESOLVED_UNIT9, RESOLVED_UNIT9]);
2895 3007
2896 /** 3008 /**
2897 * Initialize a newly created task to build a library element for the given 3009 * Initialize a newly created task to build a library element for the given
2898 * [unit] in the given [context]. 3010 * [unit] in the given [context].
2899 */ 3011 */
2900 InferInstanceMembersInUnitTask( 3012 InferInstanceMembersInUnitTask(
2901 InternalAnalysisContext context, LibrarySpecificUnit unit) 3013 InternalAnalysisContext context, LibrarySpecificUnit unit)
2902 : super(context, unit); 3014 : super(context, unit);
2903 3015
2904 @override 3016 @override
(...skipping 11 matching lines...) Expand all
2916 // 3028 //
2917 if (context.analysisOptions.strongMode) { 3029 if (context.analysisOptions.strongMode) {
2918 InstanceMemberInferrer inferrer = new InstanceMemberInferrer(typeProvider, 3030 InstanceMemberInferrer inferrer = new InstanceMemberInferrer(typeProvider,
2919 typeSystem: context.typeSystem); 3031 typeSystem: context.typeSystem);
2920 inferrer.inferCompilationUnit(unit.element); 3032 inferrer.inferCompilationUnit(unit.element);
2921 } 3033 }
2922 // 3034 //
2923 // Record outputs. 3035 // Record outputs.
2924 // 3036 //
2925 outputs[RESOLVED_UNIT9] = unit; 3037 outputs[RESOLVED_UNIT9] = unit;
3038 outputs[CREATED_RESOLVED_UNIT9] = true;
2926 } 3039 }
2927 3040
2928 /** 3041 /**
2929 * Return a map from the names of the inputs of this kind of task to the task 3042 * Return a map from the names of the inputs of this kind of task to the task
2930 * input descriptors describing those inputs for a task with the given 3043 * input descriptors describing those inputs for a task with the given
2931 * [libSource]. 3044 * [libSource].
2932 */ 3045 */
2933 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 3046 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
2934 LibrarySpecificUnit unit = target; 3047 LibrarySpecificUnit unit = target;
2935 return <String, TaskInput>{ 3048 return <String, TaskInput>{
2936 UNIT_INPUT: RESOLVED_UNIT8.of(unit), 3049 UNIT_INPUT: RESOLVED_UNIT8.of(unit),
2937 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), 3050 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
2938 // In strong mode, add additional dependencies to enforce inference 3051 // In strong mode, add additional dependencies to enforce inference
2939 // ordering. 3052 // ordering.
2940 3053
2941 // Require that field re-resolution be complete for all units in the 3054 // Require that field re-resolution be complete for all units in the
2942 // current library cycle. 3055 // current library cycle.
2943 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( 3056 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList(
2944 (CompilationUnitElementImpl unit) => RESOLVED_UNIT8 3057 (CompilationUnitElementImpl unit) => CREATED_RESOLVED_UNIT8
2945 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))), 3058 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))),
2946 // Require that full inference be complete for all dependencies of the 3059 // Require that full inference be complete for all dependencies of the
2947 // current library cycle. 3060 // current library cycle.
2948 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( 3061 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList(
2949 (CompilationUnitElementImpl unit) => RESOLVED_UNIT9 3062 (CompilationUnitElementImpl unit) => CREATED_RESOLVED_UNIT9
2950 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) 3063 .of(new LibrarySpecificUnit(unit.librarySource, unit.source)))
2951 }; 3064 };
2952 } 3065 }
2953 3066
2954 /** 3067 /**
2955 * Create a [InferInstanceMembersInUnitTask] based on the given [target] in 3068 * Create a [InferInstanceMembersInUnitTask] based on the given [target] in
2956 * the given [context]. 3069 * the given [context].
2957 */ 3070 */
2958 static InferInstanceMembersInUnitTask createTask( 3071 static InferInstanceMembersInUnitTask createTask(
2959 AnalysisContext context, AnalysisTarget target) { 3072 AnalysisContext context, AnalysisTarget target) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
3005 */ 3118 */
3006 static const String INFERRED_VARIABLES_INPUT = 'INFERRED_VARIABLES_INPUT'; 3119 static const String INFERRED_VARIABLES_INPUT = 'INFERRED_VARIABLES_INPUT';
3007 3120
3008 /** 3121 /**
3009 * The task descriptor describing this kind of task. 3122 * The task descriptor describing this kind of task.
3010 */ 3123 */
3011 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 3124 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
3012 'InferStaticVariableTypesInUnitTask', 3125 'InferStaticVariableTypesInUnitTask',
3013 createTask, 3126 createTask,
3014 buildInputs, 3127 buildInputs,
3015 <ResultDescriptor>[RESOLVED_UNIT7]); 3128 <ResultDescriptor>[CREATED_RESOLVED_UNIT7, RESOLVED_UNIT7]);
3016 3129
3017 /** 3130 /**
3018 * Initialize a newly created task to build a library element for the given 3131 * Initialize a newly created task to build a library element for the given
3019 * [unit] in the given [context]. 3132 * [unit] in the given [context].
3020 */ 3133 */
3021 InferStaticVariableTypesInUnitTask( 3134 InferStaticVariableTypesInUnitTask(
3022 InternalAnalysisContext context, LibrarySpecificUnit unit) 3135 InternalAnalysisContext context, LibrarySpecificUnit unit)
3023 : super(context, unit); 3136 : super(context, unit);
3024 3137
3025 @override 3138 @override
3026 TaskDescriptor get descriptor => DESCRIPTOR; 3139 TaskDescriptor get descriptor => DESCRIPTOR;
3027 3140
3028 @override 3141 @override
3029 void internalPerform() { 3142 void internalPerform() {
3030 // 3143 //
3031 // Prepare inputs. 3144 // Prepare inputs.
3032 // 3145 //
3033 CompilationUnit unit = getRequiredInput(UNIT_INPUT); 3146 CompilationUnit unit = getRequiredInput(UNIT_INPUT);
3034 // 3147 //
3035 // Record outputs. There is no additional work to be done at this time 3148 // Record outputs. There is no additional work to be done at this time
3036 // because the work has implicitly been done by virtue of the task model 3149 // because the work has implicitly been done by virtue of the task model
3037 // preparing all of the inputs. 3150 // preparing all of the inputs.
3038 // 3151 //
3039 outputs[RESOLVED_UNIT7] = unit; 3152 outputs[RESOLVED_UNIT7] = unit;
3153 outputs[CREATED_RESOLVED_UNIT7] = true;
3040 } 3154 }
3041 3155
3042 /** 3156 /**
3043 * Return a map from the names of the inputs of this kind of task to the task 3157 * Return a map from the names of the inputs of this kind of task to the task
3044 * input descriptors describing those inputs for a task with the given 3158 * input descriptors describing those inputs for a task with the given
3045 * [libSource]. 3159 * [libSource].
3046 */ 3160 */
3047 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 3161 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
3048 LibrarySpecificUnit unit = target; 3162 LibrarySpecificUnit unit = target;
3049 return <String, TaskInput>{ 3163 return <String, TaskInput>{
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
3179 .of(variable) 3293 .of(variable)
3180 .toListOf(INFERRED_STATIC_VARIABLE), 3294 .toListOf(INFERRED_STATIC_VARIABLE),
3181 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), 3295 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
3182 UNIT_INPUT: RESOLVED_UNIT6.of(unit), 3296 UNIT_INPUT: RESOLVED_UNIT6.of(unit),
3183 // In strong mode, add additional dependencies to enforce inference 3297 // In strong mode, add additional dependencies to enforce inference
3184 // ordering. 3298 // ordering.
3185 3299
3186 // Require that full inference be complete for all dependencies of the 3300 // Require that full inference be complete for all dependencies of the
3187 // current library cycle. 3301 // current library cycle.
3188 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( 3302 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList(
3189 (CompilationUnitElementImpl unit) => RESOLVED_UNIT9 3303 (CompilationUnitElementImpl unit) => CREATED_RESOLVED_UNIT9
3190 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) 3304 .of(new LibrarySpecificUnit(unit.librarySource, unit.source)))
3191 }; 3305 };
3192 } 3306 }
3193 3307
3194 /** 3308 /**
3195 * Create a [InferStaticVariableTypeTask] based on the given [target] in the 3309 * Create a [InferStaticVariableTypeTask] based on the given [target] in the
3196 * given [context]. 3310 * given [context].
3197 */ 3311 */
3198 static InferStaticVariableTypeTask createTask( 3312 static InferStaticVariableTypeTask createTask(
3199 AnalysisContext context, AnalysisTarget target) { 3313 AnalysisContext context, AnalysisTarget target) {
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
3592 3706
3593 /** 3707 /**
3594 * The task descriptor describing this kind of task. 3708 * The task descriptor describing this kind of task.
3595 */ 3709 */
3596 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 3710 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
3597 'PartiallyResolveUnitReferencesTask', 3711 'PartiallyResolveUnitReferencesTask',
3598 createTask, 3712 createTask,
3599 buildInputs, <ResultDescriptor>[ 3713 buildInputs, <ResultDescriptor>[
3600 INFERABLE_STATIC_VARIABLES_IN_UNIT, 3714 INFERABLE_STATIC_VARIABLES_IN_UNIT,
3601 PROPAGABLE_VARIABLES_IN_UNIT, 3715 PROPAGABLE_VARIABLES_IN_UNIT,
3716 CREATED_RESOLVED_UNIT5,
3602 RESOLVED_UNIT5 3717 RESOLVED_UNIT5
3603 ]); 3718 ]);
3604 3719
3605 PartiallyResolveUnitReferencesTask( 3720 PartiallyResolveUnitReferencesTask(
3606 InternalAnalysisContext context, AnalysisTarget target) 3721 InternalAnalysisContext context, AnalysisTarget target)
3607 : super(context, target); 3722 : super(context, target);
3608 3723
3609 @override 3724 @override
3610 TaskDescriptor get descriptor => DESCRIPTOR; 3725 TaskDescriptor get descriptor => DESCRIPTOR;
3611 3726
(...skipping 15 matching lines...) Expand all
3627 // 3742 //
3628 // Record outputs. 3743 // Record outputs.
3629 // 3744 //
3630 if (context.analysisOptions.strongMode) { 3745 if (context.analysisOptions.strongMode) {
3631 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = visitor.staticVariables; 3746 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = visitor.staticVariables;
3632 } else { 3747 } else {
3633 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = VariableElement.EMPTY_LIST; 3748 outputs[INFERABLE_STATIC_VARIABLES_IN_UNIT] = VariableElement.EMPTY_LIST;
3634 } 3749 }
3635 outputs[PROPAGABLE_VARIABLES_IN_UNIT] = visitor.propagableVariables; 3750 outputs[PROPAGABLE_VARIABLES_IN_UNIT] = visitor.propagableVariables;
3636 outputs[RESOLVED_UNIT5] = unit; 3751 outputs[RESOLVED_UNIT5] = unit;
3752 outputs[CREATED_RESOLVED_UNIT5] = true;
3637 } 3753 }
3638 3754
3639 /** 3755 /**
3640 * Return a map from the names of the inputs of this kind of task to the task 3756 * Return a map from the names of the inputs of this kind of task to the task
3641 * input descriptors describing those inputs for a task with the 3757 * input descriptors describing those inputs for a task with the
3642 * given [target]. 3758 * given [target].
3643 */ 3759 */
3644 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 3760 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
3645 LibrarySpecificUnit unit = target; 3761 LibrarySpecificUnit unit = target;
3646 return <String, TaskInput>{ 3762 return <String, TaskInput>{
3647 'fullyBuiltLibraryElements': READY_LIBRARY_ELEMENT5.of(unit.library), 3763 'fullyBuiltLibraryElements': READY_LIBRARY_ELEMENT5.of(unit.library),
3648 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), 3764 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library),
3649 UNIT_INPUT: RESOLVED_UNIT4.of(unit), 3765 UNIT_INPUT: RESOLVED_UNIT4.of(unit),
3650 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), 3766 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
3651 // In strong mode, add additional dependencies to enforce inference 3767 // In strong mode, add additional dependencies to enforce inference
3652 // ordering. 3768 // ordering.
3653 3769
3654 // Require that full inference be complete for all dependencies of the 3770 // Require that full inference be complete for all dependencies of the
3655 // current library cycle. 3771 // current library cycle.
3656 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( 3772 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList(
3657 (CompilationUnitElementImpl unit) => RESOLVED_UNIT9 3773 (CompilationUnitElementImpl unit) => CREATED_RESOLVED_UNIT9
3658 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) 3774 .of(new LibrarySpecificUnit(unit.librarySource, unit.source)))
3659 }; 3775 };
3660 } 3776 }
3661 3777
3662 /** 3778 /**
3663 * Create a [PartiallyResolveUnitReferencesTask] based on the given [target] 3779 * Create a [PartiallyResolveUnitReferencesTask] based on the given [target]
3664 * in the given [context]. 3780 * in the given [context].
3665 */ 3781 */
3666 static PartiallyResolveUnitReferencesTask createTask( 3782 static PartiallyResolveUnitReferencesTask createTask(
3667 AnalysisContext context, AnalysisTarget target) { 3783 AnalysisContext context, AnalysisTarget target) {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
3792 */ 3908 */
3793 static const String UNIT_INPUT = 'UNIT_INPUT'; 3909 static const String UNIT_INPUT = 'UNIT_INPUT';
3794 3910
3795 /** 3911 /**
3796 * The task descriptor describing this kind of task. 3912 * The task descriptor describing this kind of task.
3797 */ 3913 */
3798 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 3914 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
3799 'PropagateVariableTypesInUnitTask', 3915 'PropagateVariableTypesInUnitTask',
3800 createTask, 3916 createTask,
3801 buildInputs, 3917 buildInputs,
3802 <ResultDescriptor>[RESOLVED_UNIT6]); 3918 <ResultDescriptor>[CREATED_RESOLVED_UNIT6, RESOLVED_UNIT6]);
3803 3919
3804 PropagateVariableTypesInUnitTask( 3920 PropagateVariableTypesInUnitTask(
3805 InternalAnalysisContext context, LibrarySpecificUnit unit) 3921 InternalAnalysisContext context, LibrarySpecificUnit unit)
3806 : super(context, unit); 3922 : super(context, unit);
3807 3923
3808 @override 3924 @override
3809 TaskDescriptor get descriptor => DESCRIPTOR; 3925 TaskDescriptor get descriptor => DESCRIPTOR;
3810 3926
3811 @override 3927 @override
3812 void internalPerform() { 3928 void internalPerform() {
3813 // 3929 //
3814 // Prepare inputs. 3930 // Prepare inputs.
3815 // 3931 //
3816 CompilationUnit unit = getRequiredInput(UNIT_INPUT); 3932 CompilationUnit unit = getRequiredInput(UNIT_INPUT);
3817 // 3933 //
3818 // Record outputs. There is no additional work to be done at this time 3934 // Record outputs. There is no additional work to be done at this time
3819 // because the work has implicitly been done by virtue of the task model 3935 // because the work has implicitly been done by virtue of the task model
3820 // preparing all of the inputs. 3936 // preparing all of the inputs.
3821 // 3937 //
3822 outputs[RESOLVED_UNIT6] = unit; 3938 outputs[RESOLVED_UNIT6] = unit;
3939 outputs[CREATED_RESOLVED_UNIT6] = true;
3823 } 3940 }
3824 3941
3825 /** 3942 /**
3826 * Return a map from the names of the inputs of this kind of task to the task 3943 * Return a map from the names of the inputs of this kind of task to the task
3827 * input descriptors describing those inputs for a task with the given 3944 * input descriptors describing those inputs for a task with the given
3828 * [target]. 3945 * [target].
3829 */ 3946 */
3830 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 3947 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
3831 LibrarySpecificUnit unit = target; 3948 LibrarySpecificUnit unit = target;
3832 return <String, TaskInput>{ 3949 return <String, TaskInput>{
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
4362 */ 4479 */
4363 static const String UNIT_INPUT = 'UNIT_INPUT'; 4480 static const String UNIT_INPUT = 'UNIT_INPUT';
4364 4481
4365 /** 4482 /**
4366 * The task descriptor describing this kind of task. 4483 * The task descriptor describing this kind of task.
4367 */ 4484 */
4368 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 4485 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
4369 'ResolveInstanceFieldsInUnitTask', 4486 'ResolveInstanceFieldsInUnitTask',
4370 createTask, 4487 createTask,
4371 buildInputs, 4488 buildInputs,
4372 <ResultDescriptor>[RESOLVED_UNIT8]); 4489 <ResultDescriptor>[CREATED_RESOLVED_UNIT8, RESOLVED_UNIT8]);
4373 4490
4374 /** 4491 /**
4375 * Initialize a newly created task to build a library element for the given 4492 * Initialize a newly created task to build a library element for the given
4376 * [unit] in the given [context]. 4493 * [unit] in the given [context].
4377 */ 4494 */
4378 ResolveInstanceFieldsInUnitTask( 4495 ResolveInstanceFieldsInUnitTask(
4379 InternalAnalysisContext context, LibrarySpecificUnit unit) 4496 InternalAnalysisContext context, LibrarySpecificUnit unit)
4380 : super(context, unit); 4497 : super(context, unit);
4381 4498
4382 @override 4499 @override
(...skipping 25 matching lines...) Expand all
4408 libraryElement, 4525 libraryElement,
4409 unitElement.source, 4526 unitElement.source,
4410 typeProvider, 4527 typeProvider,
4411 AnalysisErrorListener.NULL_LISTENER); 4528 AnalysisErrorListener.NULL_LISTENER);
4412 unit.accept(visitor); 4529 unit.accept(visitor);
4413 } 4530 }
4414 // 4531 //
4415 // Record outputs. 4532 // Record outputs.
4416 // 4533 //
4417 outputs[RESOLVED_UNIT8] = unit; 4534 outputs[RESOLVED_UNIT8] = unit;
4535 outputs[CREATED_RESOLVED_UNIT8] = true;
4418 } 4536 }
4419 4537
4420 /** 4538 /**
4421 * Return a map from the names of the inputs of this kind of task to the task 4539 * Return a map from the names of the inputs of this kind of task to the task
4422 * input descriptors describing those inputs for a task with the given 4540 * input descriptors describing those inputs for a task with the given
4423 * [libSource]. 4541 * [libSource].
4424 */ 4542 */
4425 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 4543 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
4426 LibrarySpecificUnit unit = target; 4544 LibrarySpecificUnit unit = target;
4427 return <String, TaskInput>{ 4545 return <String, TaskInput>{
4428 UNIT_INPUT: RESOLVED_UNIT7.of(unit), 4546 UNIT_INPUT: RESOLVED_UNIT7.of(unit),
4429 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library), 4547 LIBRARY_INPUT: LIBRARY_ELEMENT5.of(unit.library),
4430 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), 4548 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
4431 // In strong mode, add additional dependencies to enforce inference 4549 // In strong mode, add additional dependencies to enforce inference
4432 // ordering. 4550 // ordering.
4433 4551
4434 // Require that static variable inference be complete for all units in 4552 // Require that static variable inference be complete for all units in
4435 // the current library cycle. 4553 // the current library cycle.
4436 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( 4554 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList(
4437 (CompilationUnitElementImpl unit) => RESOLVED_UNIT7 4555 (CompilationUnitElementImpl unit) => CREATED_RESOLVED_UNIT7
4438 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))), 4556 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))),
4439 // Require that full inference be complete for all dependencies of the 4557 // Require that full inference be complete for all dependencies of the
4440 // current library cycle. 4558 // current library cycle.
4441 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList( 4559 'orderLibraryCycles': LIBRARY_CYCLE_DEPENDENCIES.of(unit).toList(
4442 (CompilationUnitElementImpl unit) => RESOLVED_UNIT9 4560 (CompilationUnitElementImpl unit) => CREATED_RESOLVED_UNIT9
4443 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) 4561 .of(new LibrarySpecificUnit(unit.librarySource, unit.source)))
4444 }; 4562 };
4445 } 4563 }
4446 4564
4447 /** 4565 /**
4448 * Create a [ResolveInstanceFieldsInUnitTask] based on the given [target] in 4566 * Create a [ResolveInstanceFieldsInUnitTask] based on the given [target] in
4449 * the given [context]. 4567 * the given [context].
4450 */ 4568 */
4451 static ResolveInstanceFieldsInUnitTask createTask( 4569 static ResolveInstanceFieldsInUnitTask createTask(
4452 AnalysisContext context, AnalysisTarget target) { 4570 AnalysisContext context, AnalysisTarget target) {
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
4682 4800
4683 /** 4801 /**
4684 * The name of the [RESOLVED_UNIT9] input. 4802 * The name of the [RESOLVED_UNIT9] input.
4685 */ 4803 */
4686 static const String UNIT_INPUT = 'UNIT_INPUT'; 4804 static const String UNIT_INPUT = 'UNIT_INPUT';
4687 4805
4688 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 4806 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
4689 'ResolveUnitTask', createTask, buildInputs, <ResultDescriptor>[ 4807 'ResolveUnitTask', createTask, buildInputs, <ResultDescriptor>[
4690 CONSTANT_EXPRESSIONS_DEPENDENCIES, 4808 CONSTANT_EXPRESSIONS_DEPENDENCIES,
4691 RESOLVE_UNIT_ERRORS, 4809 RESOLVE_UNIT_ERRORS,
4810 CREATED_RESOLVED_UNIT10,
4692 RESOLVED_UNIT10 4811 RESOLVED_UNIT10
4693 ]); 4812 ]);
4694 4813
4695 ResolveUnitTask( 4814 ResolveUnitTask(
4696 InternalAnalysisContext context, LibrarySpecificUnit compilationUnit) 4815 InternalAnalysisContext context, LibrarySpecificUnit compilationUnit)
4697 : super(context, compilationUnit); 4816 : super(context, compilationUnit);
4698 4817
4699 @override 4818 @override
4700 TaskDescriptor get descriptor => DESCRIPTOR; 4819 TaskDescriptor get descriptor => DESCRIPTOR;
4701 4820
(...skipping 27 matching lines...) Expand all
4729 // 4848 //
4730 // Record outputs. 4849 // Record outputs.
4731 // 4850 //
4732 // TODO(brianwilkerson) This task modifies the element model (by copying the 4851 // TODO(brianwilkerson) This task modifies the element model (by copying the
4733 // AST's for constructor initializers into it) but does not produce an 4852 // AST's for constructor initializers into it) but does not produce an
4734 // updated version of the element model. 4853 // updated version of the element model.
4735 // 4854 //
4736 outputs[CONSTANT_EXPRESSIONS_DEPENDENCIES] = constExprDependencies; 4855 outputs[CONSTANT_EXPRESSIONS_DEPENDENCIES] = constExprDependencies;
4737 outputs[RESOLVE_UNIT_ERRORS] = getTargetSourceErrors(errorListener, target); 4856 outputs[RESOLVE_UNIT_ERRORS] = getTargetSourceErrors(errorListener, target);
4738 outputs[RESOLVED_UNIT10] = unit; 4857 outputs[RESOLVED_UNIT10] = unit;
4858 outputs[CREATED_RESOLVED_UNIT10] = true;
4739 } 4859 }
4740 4860
4741 /** 4861 /**
4742 * Return a map from the names of the inputs of this kind of task to the task 4862 * Return a map from the names of the inputs of this kind of task to the task
4743 * input descriptors describing those inputs for a task with the given 4863 * input descriptors describing those inputs for a task with the given
4744 * [target]. 4864 * [target].
4745 */ 4865 */
4746 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 4866 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
4747 LibrarySpecificUnit unit = target; 4867 LibrarySpecificUnit unit = target;
4748 return <String, TaskInput>{ 4868 return <String, TaskInput>{
4749 LIBRARY_INPUT: LIBRARY_ELEMENT7.of(unit.library), 4869 LIBRARY_INPUT: LIBRARY_ELEMENT7.of(unit.library),
4750 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request), 4870 TYPE_PROVIDER_INPUT: TYPE_PROVIDER.of(AnalysisContextTarget.request),
4751 UNIT_INPUT: RESOLVED_UNIT9.of(unit), 4871 UNIT_INPUT: RESOLVED_UNIT9.of(unit),
4752 // In strong mode, add additional dependencies to enforce inference 4872 // In strong mode, add additional dependencies to enforce inference
4753 // ordering. 4873 // ordering.
4754 4874
4755 // Require that inference be complete for all units in the 4875 // Require that inference be complete for all units in the
4756 // current library cycle. 4876 // current library cycle.
4757 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList( 4877 'orderLibraryCycleTasks': LIBRARY_CYCLE_UNITS.of(unit).toList(
4758 (CompilationUnitElementImpl unit) => RESOLVED_UNIT9 4878 (CompilationUnitElementImpl unit) => CREATED_RESOLVED_UNIT9
4759 .of(new LibrarySpecificUnit(unit.librarySource, unit.source))) 4879 .of(new LibrarySpecificUnit(unit.librarySource, unit.source)))
4760 }; 4880 };
4761 } 4881 }
4762 4882
4763 /** 4883 /**
4764 * Create a [ResolveUnitTask] based on the given [target] in 4884 * Create a [ResolveUnitTask] based on the given [target] in
4765 * the given [context]. 4885 * the given [context].
4766 */ 4886 */
4767 static ResolveUnitTask createTask( 4887 static ResolveUnitTask createTask(
4768 AnalysisContext context, AnalysisTarget target) { 4888 AnalysisContext context, AnalysisTarget target) {
(...skipping 17 matching lines...) Expand all
4786 4906
4787 /** 4907 /**
4788 * The name of the [TYPE_PROVIDER] input. 4908 * The name of the [TYPE_PROVIDER] input.
4789 */ 4909 */
4790 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; 4910 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
4791 4911
4792 /** 4912 /**
4793 * The task descriptor describing this kind of task. 4913 * The task descriptor describing this kind of task.
4794 */ 4914 */
4795 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 4915 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
4796 'ResolveUnitTypeNamesTask', 4916 'ResolveUnitTypeNamesTask', createTask, buildInputs, <ResultDescriptor>[
4797 createTask, 4917 RESOLVE_TYPE_NAMES_ERRORS,
4798 buildInputs, 4918 CREATED_RESOLVED_UNIT3,
4799 <ResultDescriptor>[RESOLVE_TYPE_NAMES_ERRORS, RESOLVED_UNIT3]); 4919 RESOLVED_UNIT3
4920 ]);
4800 4921
4801 ResolveUnitTypeNamesTask( 4922 ResolveUnitTypeNamesTask(
4802 InternalAnalysisContext context, AnalysisTarget target) 4923 InternalAnalysisContext context, AnalysisTarget target)
4803 : super(context, target); 4924 : super(context, target);
4804 4925
4805 @override 4926 @override
4806 TaskDescriptor get descriptor => DESCRIPTOR; 4927 TaskDescriptor get descriptor => DESCRIPTOR;
4807 4928
4808 @override 4929 @override
4809 void internalPerform() { 4930 void internalPerform() {
(...skipping 10 matching lines...) Expand all
4820 RecordingErrorListener errorListener = new RecordingErrorListener(); 4941 RecordingErrorListener errorListener = new RecordingErrorListener();
4821 TypeResolverVisitor visitor = new TypeResolverVisitor( 4942 TypeResolverVisitor visitor = new TypeResolverVisitor(
4822 library, unitElement.source, typeProvider, errorListener); 4943 library, unitElement.source, typeProvider, errorListener);
4823 unit.accept(visitor); 4944 unit.accept(visitor);
4824 // 4945 //
4825 // Record outputs. 4946 // Record outputs.
4826 // 4947 //
4827 outputs[RESOLVE_TYPE_NAMES_ERRORS] = 4948 outputs[RESOLVE_TYPE_NAMES_ERRORS] =
4828 getTargetSourceErrors(errorListener, target); 4949 getTargetSourceErrors(errorListener, target);
4829 outputs[RESOLVED_UNIT3] = unit; 4950 outputs[RESOLVED_UNIT3] = unit;
4951 outputs[CREATED_RESOLVED_UNIT3] = true;
4830 } 4952 }
4831 4953
4832 /** 4954 /**
4833 * Return a map from the names of the inputs of this kind of task to the task 4955 * Return a map from the names of the inputs of this kind of task to the task
4834 * input descriptors describing those inputs for a task with the 4956 * input descriptors describing those inputs for a task with the
4835 * given [target]. 4957 * given [target].
4836 */ 4958 */
4837 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 4959 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
4838 // TODO(brianwilkerson) This task updates the element model to have type 4960 // TODO(brianwilkerson) This task updates the element model to have type
4839 // information and updates the class hierarchy. It should produce a new 4961 // information and updates the class hierarchy. It should produce a new
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
4876 * The name of the [TYPE_PROVIDER] input. 4998 * The name of the [TYPE_PROVIDER] input.
4877 */ 4999 */
4878 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; 5000 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
4879 5001
4880 /** 5002 /**
4881 * The task descriptor describing this kind of task. 5003 * The task descriptor describing this kind of task.
4882 */ 5004 */
4883 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 5005 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
4884 'ResolveVariableReferencesTask', 5006 'ResolveVariableReferencesTask',
4885 createTask, 5007 createTask,
4886 buildInputs, 5008 buildInputs, <ResultDescriptor>[
4887 <ResultDescriptor>[RESOLVED_UNIT4, VARIABLE_REFERENCE_ERRORS]); 5009 CREATED_RESOLVED_UNIT4,
5010 RESOLVED_UNIT4,
5011 VARIABLE_REFERENCE_ERRORS
5012 ]);
4888 5013
4889 ResolveVariableReferencesTask( 5014 ResolveVariableReferencesTask(
4890 InternalAnalysisContext context, AnalysisTarget target) 5015 InternalAnalysisContext context, AnalysisTarget target)
4891 : super(context, target); 5016 : super(context, target);
4892 5017
4893 @override 5018 @override
4894 TaskDescriptor get descriptor => DESCRIPTOR; 5019 TaskDescriptor get descriptor => DESCRIPTOR;
4895 5020
4896 @override 5021 @override
4897 void internalPerform() { 5022 void internalPerform() {
(...skipping 10 matching lines...) Expand all
4908 RecordingErrorListener errorListener = new RecordingErrorListener(); 5033 RecordingErrorListener errorListener = new RecordingErrorListener();
4909 Scope nameScope = new LibraryScope(libraryElement, errorListener); 5034 Scope nameScope = new LibraryScope(libraryElement, errorListener);
4910 VariableResolverVisitor visitor = new VariableResolverVisitor( 5035 VariableResolverVisitor visitor = new VariableResolverVisitor(
4911 libraryElement, unitElement.source, typeProvider, errorListener, 5036 libraryElement, unitElement.source, typeProvider, errorListener,
4912 nameScope: nameScope); 5037 nameScope: nameScope);
4913 unit.accept(visitor); 5038 unit.accept(visitor);
4914 // 5039 //
4915 // Record outputs. 5040 // Record outputs.
4916 // 5041 //
4917 outputs[RESOLVED_UNIT4] = unit; 5042 outputs[RESOLVED_UNIT4] = unit;
5043 outputs[CREATED_RESOLVED_UNIT4] = true;
4918 outputs[VARIABLE_REFERENCE_ERRORS] = 5044 outputs[VARIABLE_REFERENCE_ERRORS] =
4919 getTargetSourceErrors(errorListener, target); 5045 getTargetSourceErrors(errorListener, target);
4920 } 5046 }
4921 5047
4922 /** 5048 /**
4923 * Return a map from the names of the inputs of this kind of task to the task 5049 * Return a map from the names of the inputs of this kind of task to the task
4924 * input descriptors describing those inputs for a task with the 5050 * input descriptors describing those inputs for a task with the
4925 * given [target]. 5051 * given [target].
4926 */ 5052 */
4927 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 5053 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
5070 5196
5071 /** 5197 /**
5072 * The name of the [TYPE_PROVIDER] input. 5198 * The name of the [TYPE_PROVIDER] input.
5073 */ 5199 */
5074 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT'; 5200 static const String TYPE_PROVIDER_INPUT = 'TYPE_PROVIDER_INPUT';
5075 5201
5076 /** 5202 /**
5077 * The task descriptor describing this kind of task. 5203 * The task descriptor describing this kind of task.
5078 */ 5204 */
5079 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 5205 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
5080 'StrongModeVerifyUnitTask', 5206 'StrongModeVerifyUnitTask', createTask, buildInputs, <ResultDescriptor>[
5081 createTask, 5207 STRONG_MODE_ERRORS,
5082 buildInputs, 5208 CREATED_RESOLVED_UNIT,
5083 <ResultDescriptor>[STRONG_MODE_ERRORS, RESOLVED_UNIT]); 5209 RESOLVED_UNIT
5210 ]);
5084 5211
5085 StrongModeVerifyUnitTask( 5212 StrongModeVerifyUnitTask(
5086 InternalAnalysisContext context, AnalysisTarget target) 5213 InternalAnalysisContext context, AnalysisTarget target)
5087 : super(context, target); 5214 : super(context, target);
5088 5215
5089 @override 5216 @override
5090 TaskDescriptor get descriptor => DESCRIPTOR; 5217 TaskDescriptor get descriptor => DESCRIPTOR;
5091 5218
5092 @override 5219 @override
5093 void internalPerform() { 5220 void internalPerform() {
5094 RecordingErrorListener errorListener = new RecordingErrorListener(); 5221 RecordingErrorListener errorListener = new RecordingErrorListener();
5095 // 5222 //
5096 // Prepare inputs. 5223 // Prepare inputs.
5097 // 5224 //
5098 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT); 5225 TypeProvider typeProvider = getRequiredInput(TYPE_PROVIDER_INPUT);
5099 CompilationUnit unit = getRequiredInput(UNIT_INPUT); 5226 CompilationUnit unit = getRequiredInput(UNIT_INPUT);
5100 if (context.analysisOptions.strongMode) { 5227 if (context.analysisOptions.strongMode) {
5101 unit.accept(new CodeChecker( 5228 unit.accept(new CodeChecker(
5102 typeProvider, new StrongTypeSystemImpl(), errorListener)); 5229 typeProvider, new StrongTypeSystemImpl(), errorListener));
5103 } 5230 }
5104
5105 // 5231 //
5106 // Record outputs. 5232 // Record outputs.
5107 // 5233 //
5108 outputs[STRONG_MODE_ERRORS] = getUniqueErrors(errorListener.errors); 5234 outputs[STRONG_MODE_ERRORS] = getUniqueErrors(errorListener.errors);
5235 outputs[CREATED_RESOLVED_UNIT] = true;
5109 outputs[RESOLVED_UNIT] = unit; 5236 outputs[RESOLVED_UNIT] = unit;
5110 } 5237 }
5111 5238
5112 /** 5239 /**
5113 * Return a map from the names of the inputs of this kind of task to the task 5240 * Return a map from the names of the inputs of this kind of task to the task
5114 * input descriptors describing those inputs for a task with the 5241 * input descriptors describing those inputs for a task with the
5115 * given [target]. 5242 * given [target].
5116 */ 5243 */
5117 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 5244 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
5118 LibrarySpecificUnit unit = target; 5245 LibrarySpecificUnit unit = target;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
5358 5485
5359 @override 5486 @override
5360 bool moveNext() { 5487 bool moveNext() {
5361 if (_newSources.isEmpty) { 5488 if (_newSources.isEmpty) {
5362 return false; 5489 return false;
5363 } 5490 }
5364 currentTarget = _newSources.removeLast(); 5491 currentTarget = _newSources.removeLast();
5365 return true; 5492 return true;
5366 } 5493 }
5367 } 5494 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698