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

Side by Side Diff: packages/analyzer/lib/src/task/model.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 4 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.model; 5 library analyzer.src.task.model;
6 6
7 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; 7 import 'package:analyzer/src/generated/engine.dart';
8 import 'package:analyzer/src/task/inputs.dart'; 8 import 'package:analyzer/src/task/inputs.dart';
9 import 'package:analyzer/task/model.dart'; 9 import 'package:analyzer/task/model.dart';
10 10
11 /** 11 /**
12 * The default [ResultCachingPolicy], results are never flushed. 12 * The default [ResultCachingPolicy], results are never flushed.
13 */ 13 */
14 const ResultCachingPolicy DEFAULT_CACHING_POLICY = 14 const ResultCachingPolicy<Object> DEFAULT_CACHING_POLICY =
15 const SimpleResultCachingPolicy(-1, -1); 15 const SimpleResultCachingPolicy(-1, -1);
16 16
17 /** 17 /**
18 * A concrete implementation of a [ListResultDescriptor]. 18 * A concrete implementation of a [ListResultDescriptor].
19 */ 19 */
20 class ListResultDescriptorImpl<E> extends ResultDescriptorImpl<List<E>> 20 class ListResultDescriptorImpl<E> extends ResultDescriptorImpl<List<E>>
21 implements ListResultDescriptor<E> { 21 implements ListResultDescriptor<E> {
22 /** 22 /**
23 * Initialize a newly created analysis result to have the given [name] and 23 * Initialize a newly created analysis result to have the given [name] and
24 * [defaultValue]. If a [cachingPolicy] is provided, it will control how long 24 * [defaultValue]. If a [cachingPolicy] is provided, it will control how long
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 @override 119 @override
120 final CreateTaskInputs createTaskInputs; 120 final CreateTaskInputs createTaskInputs;
121 121
122 /** 122 /**
123 * A list of the analysis results that will be computed by the described task. 123 * A list of the analysis results that will be computed by the described task.
124 */ 124 */
125 @override 125 @override
126 final List<ResultDescriptor> results; 126 final List<ResultDescriptor> results;
127 127
128 /** 128 /**
129 * The function used to determine whether the described task is suitable for
130 * a given target.
131 */
132 final SuitabilityFor _suitabilityFor;
133
134 /**
129 * Initialize a newly created task descriptor to have the given [name] and to 135 * Initialize a newly created task descriptor to have the given [name] and to
130 * describe a task that takes the inputs built using the given [createTaskInpu ts], 136 * describe a task that takes the inputs built using the given [inputBuilder],
131 * and produces the given [results]. The [buildTask] will be used to create 137 * and produces the given [results]. The [buildTask] function will be used to
132 * the instance of [AnalysisTask] thusly described. 138 * create the instance of [AnalysisTask] being described. If provided, the
139 * [isAppropriateFor] function will be used to determine whether the task can
140 * be used on a specific target.
133 */ 141 */
134 TaskDescriptorImpl( 142 TaskDescriptorImpl(
135 this.name, this.buildTask, this.createTaskInputs, this.results); 143 this.name, this.buildTask, this.createTaskInputs, this.results,
144 {SuitabilityFor suitabilityFor})
145 : _suitabilityFor = suitabilityFor ?? _defaultSuitability;
136 146
137 @override 147 @override
138 AnalysisTask createTask(AnalysisContext context, AnalysisTarget target, 148 AnalysisTask createTask(AnalysisContext context, AnalysisTarget target,
139 Map<String, dynamic> inputs) { 149 Map<String, dynamic> inputs) {
140 AnalysisTask task = buildTask(context, target); 150 AnalysisTask task = buildTask(context, target);
141 task.inputs = inputs; 151 task.inputs = inputs;
142 return task; 152 return task;
143 } 153 }
144 154
145 @override 155 @override
156 TaskSuitability suitabilityFor(AnalysisTarget target) =>
157 _suitabilityFor(target);
158
159 @override
146 String toString() => name; 160 String toString() => name;
161
162 /**
163 * The function that will be used to determine the suitability of a task if no
164 * other function is provided.
165 */
166 static TaskSuitability _defaultSuitability(AnalysisTarget target) =>
167 TaskSuitability.LOWEST;
147 } 168 }
OLDNEW
« no previous file with comments | « packages/analyzer/lib/src/task/manager.dart ('k') | packages/analyzer/lib/src/task/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698