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

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: Replace LIBRARY_ERRORS with the LIBRARY_ERRORS_READY flag. 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 flag specifying whether all analysis errors are computed in a specific
230 * library.
231 *
232 * The result is only available for [Source]s representing a library.
233 */
234 final ResultDescriptor<bool> LIBRARY_ERRORS_READY =
235 new ResultDescriptor<bool>('LIBRARY_ERRORS_READY', false);
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 computes all of the errors of all of the units for a single
2266 * library source and sets the [LIBRARY_ERRORS_READY] flag.
2267 */
2268 class LibraryErrorsReadyTask extends SourceBasedAnalysisTask {
2269 /**
2270 * The task descriptor describing this kind of task.
2271 */
2272 static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
2273 'LibraryErrorsReadyTask', createTask, buildInputs,
2274 <ResultDescriptor>[LIBRARY_ERRORS_READY]);
2275
2276 LibraryErrorsReadyTask(InternalAnalysisContext context, AnalysisTarget target)
2277 : super(context, target);
2278
2279 @override
2280 TaskDescriptor get descriptor => DESCRIPTOR;
2281
2282 @override
2283 void internalPerform() {
2284 outputs[LIBRARY_ERRORS_READY] = true;
2285 }
2286
2287 /**
2288 * Return a map from the names of the inputs of this kind of task to the task
2289 * input descriptors describing those inputs for a task with the
2290 * given [library].
2291 */
2292 static Map<String, TaskInput> buildInputs(Source library) {
2293 return <String, TaskInput>{
2294 'allErrors': UNITS.of(library).toListOf(DART_ERRORS)
2295 };
2296 }
2297
2298 /**
2299 * Create a [LibraryErrorsReadyTask] based on the given [target] in the given
2300 * [context].
2301 */
2302 static LibraryErrorsReadyTask createTask(
2303 AnalysisContext context, AnalysisTarget target) {
2304 return new LibraryErrorsReadyTask(context, target);
2305 }
2306 }
2307
2308 /**
2259 * A task that merges all of the errors for a single source into a single list 2309 * A task that merges all of the errors for a single source into a single list
2260 * of errors. 2310 * of errors.
2261 */ 2311 */
2262 class LibraryUnitErrorsTask extends SourceBasedAnalysisTask { 2312 class LibraryUnitErrorsTask extends SourceBasedAnalysisTask {
2263 /** 2313 /**
2264 * The name of the [BUILD_FUNCTION_TYPE_ALIASES_ERRORS] input. 2314 * The name of the [BUILD_FUNCTION_TYPE_ALIASES_ERRORS] input.
2265 */ 2315 */
2266 static const String BUILD_FUNCTION_TYPE_ALIASES_ERRORS_INPUT = 2316 static const String BUILD_FUNCTION_TYPE_ALIASES_ERRORS_INPUT =
2267 'BUILD_FUNCTION_TYPE_ALIASES_ERRORS'; 2317 'BUILD_FUNCTION_TYPE_ALIASES_ERRORS';
2268 2318
(...skipping 794 matching lines...) Expand 10 before | Expand all | Expand 10 after
3063 @override 3113 @override
3064 bool moveNext() { 3114 bool moveNext() {
3065 if (_newSources.isEmpty) { 3115 if (_newSources.isEmpty) {
3066 return false; 3116 return false;
3067 } 3117 }
3068 currentTarget = _newSources.first; 3118 currentTarget = _newSources.first;
3069 _newSources.remove(currentTarget); 3119 _newSources.remove(currentTarget);
3070 return true; 3120 return true;
3071 } 3121 }
3072 } 3122 }
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