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

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

Issue 1133703003: Add LIBRARY_ERRORS result. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 months 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 | Annotate | Revision Log
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 import 'dart:math' as math; 8 import 'dart:math' as math;
9 9
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 * 219 *
220 * [LIBRARY_ELEMENT4] plus [RESOLVED_UNIT4] for every unit. 220 * [LIBRARY_ELEMENT4] plus [RESOLVED_UNIT4] for every unit.
221 * 221 *
222 * The result is only available for [Source]s representing a library. 222 * The result is only available for [Source]s representing a library.
223 */ 223 */
224 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT5 = 224 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT5 =
225 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT5', null, 225 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT5', null,
226 cachingPolicy: ELEMENT_CACHING_POLICY); 226 cachingPolicy: ELEMENT_CACHING_POLICY);
227 227
228 /** 228 /**
229 * The list of analysis errors in compilation units in a specific library.
230 *
231 * The result is only available for [Source]s representing a library.
232 */
233 final ListResultDescriptor<AnalysisError> LIBRARY_ERRORS =
234 new ListResultDescriptor<AnalysisError>(
235 'LIBRARY_ERRORS', AnalysisError.NO_ERRORS);
236
237 /**
229 * The analysis errors associated with a compilation unit in a specific library. 238 * The analysis errors associated with a compilation unit in a specific library.
230 * 239 *
231 * The result is only available for [LibrarySpecificUnit]s. 240 * The result is only available for [LibrarySpecificUnit]s.
232 */ 241 */
233 final ListResultDescriptor<AnalysisError> LIBRARY_UNIT_ERRORS = 242 final ListResultDescriptor<AnalysisError> LIBRARY_UNIT_ERRORS =
234 new ListResultDescriptor<AnalysisError>( 243 new ListResultDescriptor<AnalysisError>(
235 'LIBRARY_UNIT_ERRORS', AnalysisError.NO_ERRORS); 244 'LIBRARY_UNIT_ERRORS', AnalysisError.NO_ERRORS);
236 245
237 /** 246 /**
238 * The errors produced while parsing a compilation unit. 247 * The errors produced while parsing a compilation unit.
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 /** 611 /**
603 * The name of the input whose value is the AST for the compilation unit. 612 * The name of the input whose value is the AST for the compilation unit.
604 */ 613 */
605 static const String PARSED_UNIT_INPUT_NAME = 'PARSED_UNIT_INPUT_NAME'; 614 static const String PARSED_UNIT_INPUT_NAME = 'PARSED_UNIT_INPUT_NAME';
606 615
607 /** 616 /**
608 * The task descriptor describing this kind of task. 617 * The task descriptor describing this kind of task.
609 */ 618 */
610 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor( 619 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
611 'BuildCompilationUnitElementTask', createTask, buildInputs, 620 'BuildCompilationUnitElementTask', createTask, buildInputs,
612 <ResultDescriptor>[ 621 <ResultDescriptor>[COMPILATION_UNIT_ELEMENT, RESOLVED_UNIT1]);
613 COMPILATION_UNIT_ELEMENT,
614 RESOLVED_UNIT1
615 ]);
616 622
617 /** 623 /**
618 * Initialize a newly created task to build a compilation unit element for 624 * Initialize a newly created task to build a compilation unit element for
619 * the given [target] in the given [context]. 625 * the given [target] in the given [context].
620 */ 626 */
621 BuildCompilationUnitElementTask( 627 BuildCompilationUnitElementTask(
622 InternalAnalysisContext context, AnalysisTarget target) 628 InternalAnalysisContext context, AnalysisTarget target)
623 : super(context, target); 629 : super(context, target);
624 630
625 @override 631 @override
(...skipping 1623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2249 * Create a [GenerateHintsTask] based on the given [target] in 2255 * Create a [GenerateHintsTask] based on the given [target] in
2250 * the given [context]. 2256 * the given [context].
2251 */ 2257 */
2252 static GenerateHintsTask createTask( 2258 static GenerateHintsTask createTask(
2253 AnalysisContext context, AnalysisTarget target) { 2259 AnalysisContext context, AnalysisTarget target) {
2254 return new GenerateHintsTask(context, target); 2260 return new GenerateHintsTask(context, target);
2255 } 2261 }
2256 } 2262 }
2257 2263
2258 /** 2264 /**
2265 * A task that merges all of the errors of all of the units for a single
2266 * library source into a single list of errors.
2267 */
2268 class LibraryErrorsTask extends SourceBasedAnalysisTask {
2269 /**
2270 * The name of the [DART_ERRORS] input.
2271 */
2272 static const String DART_ERRORS_INPUT = 'ERRORS_INPUT';
2273
2274 /**
2275 * The task descriptor describing this kind of task.
2276 */
2277 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
2278 'LibraryErrorsTask', createTask, buildInputs,
2279 <ResultDescriptor>[LIBRARY_ERRORS]);
2280
2281 LibraryErrorsTask(InternalAnalysisContext context, AnalysisTarget target)
2282 : super(context, target);
2283
2284 @override
2285 TaskDescriptor get descriptor => DESCRIPTOR;
2286
2287 @override
2288 void internalPerform() {
2289 //
2290 // Prepare inputs.
2291 //
2292 List<List<AnalysisError>> errorLists = getRequiredInput(DART_ERRORS_INPUT);
2293 //
2294 // Record outputs.
2295 //
2296 outputs[LIBRARY_ERRORS] = AnalysisError.mergeLists(errorLists);
Brian Wilkerson 2015/05/08 22:15:20 I don't think this result is useful for anyone. Pe
scheglov 2015/05/08 23:10:55 Done.
2297 }
2298
2299 /**
2300 * Return a map from the names of the inputs of this kind of task to the task
2301 * input descriptors describing those inputs for a task with the
2302 * given [library].
2303 */
2304 static Map<String, TaskInput> buildInputs(Source library) {
2305 return <String, TaskInput>{
2306 DART_ERRORS_INPUT: UNITS.of(library).toListOf(DART_ERRORS)
2307 };
2308 }
2309
2310 /**
2311 * Create a [LibraryErrorsTask] based on the given [target] in the given
2312 * [context].
2313 */
2314 static LibraryErrorsTask createTask(
2315 AnalysisContext context, AnalysisTarget target) {
2316 return new LibraryErrorsTask(context, target);
2317 }
2318 }
2319
2320 /**
2259 * A task that merges all of the errors for a single source into a single list 2321 * A task that merges all of the errors for a single source into a single list
2260 * of errors. 2322 * of errors.
2261 */ 2323 */
2262 class LibraryUnitErrorsTask extends SourceBasedAnalysisTask { 2324 class LibraryUnitErrorsTask extends SourceBasedAnalysisTask {
2263 /** 2325 /**
2264 * The name of the [BUILD_FUNCTION_TYPE_ALIASES_ERRORS] input. 2326 * The name of the [BUILD_FUNCTION_TYPE_ALIASES_ERRORS] input.
2265 */ 2327 */
2266 static const String BUILD_FUNCTION_TYPE_ALIASES_ERRORS_INPUT = 2328 static const String BUILD_FUNCTION_TYPE_ALIASES_ERRORS_INPUT =
2267 'BUILD_FUNCTION_TYPE_ALIASES_ERRORS'; 2329 'BUILD_FUNCTION_TYPE_ALIASES_ERRORS';
2268 2330
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
3063 @override 3125 @override
3064 bool moveNext() { 3126 bool moveNext() {
3065 if (_newSources.isEmpty) { 3127 if (_newSources.isEmpty) {
3066 return false; 3128 return false;
3067 } 3129 }
3068 currentTarget = _newSources.first; 3130 currentTarget = _newSources.first;
3069 _newSources.remove(currentTarget); 3131 _newSources.remove(currentTarget);
3070 return true; 3132 return true;
3071 } 3133 }
3072 } 3134 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/plugin/engine_plugin.dart ('k') | pkg/analyzer/test/src/task/dart_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698