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

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

Issue 1370323003: Fix computation of errors to not run extra tasks (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
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/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 2786 matching lines...) Expand 10 before | Expand all | Expand 10 after
2797 return new LibraryErrorsReadyTask(context, target); 2797 return new LibraryErrorsReadyTask(context, target);
2798 } 2798 }
2799 } 2799 }
2800 2800
2801 /** 2801 /**
2802 * A task that merges all of the errors for a single source into a single list 2802 * A task that merges all of the errors for a single source into a single list
2803 * of errors. 2803 * of errors.
2804 */ 2804 */
2805 class LibraryUnitErrorsTask extends SourceBasedAnalysisTask { 2805 class LibraryUnitErrorsTask extends SourceBasedAnalysisTask {
2806 /** 2806 /**
2807 * The name of the [BUILD_DIRECTIVES_ERRORS] input.
2808 */
2809 static const String BUILD_DIRECTIVES_ERRORS_INPUT = 'BUILD_DIRECTIVES_ERRORS';
2810
2811 /**
2812 * The name of the [BUILD_LIBRARY_ERRORS] input.
2813 */
2814 static const String BUILD_LIBRARY_ERRORS_INPUT = 'BUILD_LIBRARY_ERRORS';
2815
2816 /**
2807 * The name of the [HINTS] input. 2817 * The name of the [HINTS] input.
2808 */ 2818 */
2809 static const String HINTS_INPUT = 'HINTS'; 2819 static const String HINTS_INPUT = 'HINTS';
2810 2820
2811 /** 2821 /**
2812 * The name of the [INFER_STATIC_VARIABLE_TYPES_ERRORS] input. 2822 * The name of the [INFER_STATIC_VARIABLE_TYPES_ERRORS] input.
2813 */ 2823 */
2814 static const String INFER_STATIC_VARIABLE_TYPES_ERRORS_INPUT = 2824 static const String INFER_STATIC_VARIABLE_TYPES_ERRORS_INPUT =
2815 'INFER_STATIC_VARIABLE_TYPES_ERRORS'; 2825 'INFER_STATIC_VARIABLE_TYPES_ERRORS';
2816 2826
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
2857 2867
2858 @override 2868 @override
2859 TaskDescriptor get descriptor => DESCRIPTOR; 2869 TaskDescriptor get descriptor => DESCRIPTOR;
2860 2870
2861 @override 2871 @override
2862 void internalPerform() { 2872 void internalPerform() {
2863 // 2873 //
2864 // Prepare inputs. 2874 // Prepare inputs.
2865 // 2875 //
2866 List<List<AnalysisError>> errorLists = <List<AnalysisError>>[]; 2876 List<List<AnalysisError>> errorLists = <List<AnalysisError>>[];
2877 errorLists.add(getRequiredInput(BUILD_DIRECTIVES_ERRORS_INPUT));
2878 errorLists.add(getRequiredInput(BUILD_LIBRARY_ERRORS_INPUT));
2867 errorLists.add(getRequiredInput(HINTS_INPUT)); 2879 errorLists.add(getRequiredInput(HINTS_INPUT));
2868 errorLists.add(getRequiredInput(INFER_STATIC_VARIABLE_TYPES_ERRORS_INPUT)); 2880 errorLists.add(getRequiredInput(INFER_STATIC_VARIABLE_TYPES_ERRORS_INPUT));
2869 errorLists.add(getRequiredInput(PARTIALLY_RESOLVE_REFERENCES_ERRORS_INPUT)); 2881 errorLists.add(getRequiredInput(PARTIALLY_RESOLVE_REFERENCES_ERRORS_INPUT));
2870 errorLists.add(getRequiredInput(RESOLVE_FUNCTION_BODIES_ERRORS_INPUT)); 2882 errorLists.add(getRequiredInput(RESOLVE_FUNCTION_BODIES_ERRORS_INPUT));
2871 errorLists.add(getRequiredInput(RESOLVE_TYPE_NAMES_ERRORS_INPUT)); 2883 errorLists.add(getRequiredInput(RESOLVE_TYPE_NAMES_ERRORS_INPUT));
2872 errorLists.add(getRequiredInput(VARIABLE_REFERENCE_ERRORS_INPUT)); 2884 errorLists.add(getRequiredInput(VARIABLE_REFERENCE_ERRORS_INPUT));
2873 errorLists.add(getRequiredInput(VERIFY_ERRORS_INPUT)); 2885 errorLists.add(getRequiredInput(VERIFY_ERRORS_INPUT));
2874 // 2886 //
2875 // Record outputs. 2887 // Record outputs.
2876 // 2888 //
2877 outputs[LIBRARY_UNIT_ERRORS] = AnalysisError.mergeLists(errorLists); 2889 outputs[LIBRARY_UNIT_ERRORS] = AnalysisError.mergeLists(errorLists);
2878 } 2890 }
2879 2891
2880 /** 2892 /**
2881 * Return a map from the names of the inputs of this kind of task to the task 2893 * Return a map from the names of the inputs of this kind of task to the task
2882 * input descriptors describing those inputs for a task with the 2894 * input descriptors describing those inputs for a task with the
2883 * given [unit]. 2895 * given [unit].
2884 */ 2896 */
2885 static Map<String, TaskInput> buildInputs(AnalysisTarget target) { 2897 static Map<String, TaskInput> buildInputs(AnalysisTarget target) {
2886 LibrarySpecificUnit unit = target; 2898 LibrarySpecificUnit unit = target;
2887 return <String, TaskInput>{ 2899 Map<String, TaskInput> inputs = <String, TaskInput>{
2888 HINTS_INPUT: HINTS.of(unit), 2900 HINTS_INPUT: HINTS.of(unit),
2889 INFER_STATIC_VARIABLE_TYPES_ERRORS_INPUT: 2901 INFER_STATIC_VARIABLE_TYPES_ERRORS_INPUT:
2890 INFER_STATIC_VARIABLE_TYPES_ERRORS.of(unit), 2902 INFER_STATIC_VARIABLE_TYPES_ERRORS.of(unit),
2891 PARTIALLY_RESOLVE_REFERENCES_ERRORS_INPUT: 2903 PARTIALLY_RESOLVE_REFERENCES_ERRORS_INPUT:
2892 PARTIALLY_RESOLVE_REFERENCES_ERRORS.of(unit), 2904 PARTIALLY_RESOLVE_REFERENCES_ERRORS.of(unit),
2893 RESOLVE_FUNCTION_BODIES_ERRORS_INPUT: 2905 RESOLVE_FUNCTION_BODIES_ERRORS_INPUT:
2894 RESOLVE_FUNCTION_BODIES_ERRORS.of(unit), 2906 RESOLVE_FUNCTION_BODIES_ERRORS.of(unit),
2895 RESOLVE_TYPE_NAMES_ERRORS_INPUT: RESOLVE_TYPE_NAMES_ERRORS.of(unit), 2907 RESOLVE_TYPE_NAMES_ERRORS_INPUT: RESOLVE_TYPE_NAMES_ERRORS.of(unit),
2896 VARIABLE_REFERENCE_ERRORS_INPUT: VARIABLE_REFERENCE_ERRORS.of(unit), 2908 VARIABLE_REFERENCE_ERRORS_INPUT: VARIABLE_REFERENCE_ERRORS.of(unit),
2897 VERIFY_ERRORS_INPUT: VERIFY_ERRORS.of(unit) 2909 VERIFY_ERRORS_INPUT: VERIFY_ERRORS.of(unit)
2898 }; 2910 };
2911 Source source = unit.source;
2912 if (unit.library == source) {
2913 inputs[BUILD_DIRECTIVES_ERRORS_INPUT] =
2914 BUILD_DIRECTIVES_ERRORS.of(source);
2915 inputs[BUILD_LIBRARY_ERRORS_INPUT] = BUILD_LIBRARY_ERRORS.of(source);
2916 } else {
2917 inputs[BUILD_DIRECTIVES_ERRORS_INPUT] =
2918 new ConstantTaskInput(AnalysisError.NO_ERRORS);
2919 inputs[BUILD_LIBRARY_ERRORS_INPUT] =
2920 new ConstantTaskInput(AnalysisError.NO_ERRORS);
2921 }
2922 return inputs;
2899 } 2923 }
2900 2924
2901 /** 2925 /**
2902 * Create a [LibraryUnitErrorsTask] based on the given [target] in the given 2926 * Create a [LibraryUnitErrorsTask] based on the given [target] in the given
2903 * [context]. 2927 * [context].
2904 */ 2928 */
2905 static LibraryUnitErrorsTask createTask( 2929 static LibraryUnitErrorsTask createTask(
2906 AnalysisContext context, AnalysisTarget target) { 2930 AnalysisContext context, AnalysisTarget target) {
2907 return new LibraryUnitErrorsTask(context, target); 2931 return new LibraryUnitErrorsTask(context, target);
2908 } 2932 }
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after
4099 4123
4100 @override 4124 @override
4101 bool moveNext() { 4125 bool moveNext() {
4102 if (_newSources.isEmpty) { 4126 if (_newSources.isEmpty) {
4103 return false; 4127 return false;
4104 } 4128 }
4105 currentTarget = _newSources.removeLast(); 4129 currentTarget = _newSources.removeLast();
4106 return true; 4130 return true;
4107 } 4131 }
4108 } 4132 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698