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

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

Issue 1633823002: Add support for tasks to determine whether they are appropriate for a given target (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/task/model.dart » ('j') | pkg/analyzer/lib/task/model.dart » ('J')
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.model; 5 library analyzer.src.task.model;
6 6
7 import 'package:analyzer/src/generated/engine.dart'; 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
(...skipping 108 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 appropriate
130 * for a given target.
131 */
132 final IsAppropriateFor _isAppropriateFor;
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 [createTaskInpu ts],
131 * and produces the given [results]. The [buildTask] will be used to create 137 * and produces the given [results]. The [buildTask] will be used to create
132 * the instance of [AnalysisTask] thusly described. 138 * the instance of [AnalysisTask] thusly described.
133 */ 139 */
134 TaskDescriptorImpl( 140 TaskDescriptorImpl(
135 this.name, this.buildTask, this.createTaskInputs, this.results); 141 this.name, this.buildTask, this.createTaskInputs, this.results,
142 {IsAppropriateFor isAppropriateFor})
Paul Berry 2016/01/25 20:12:40 Suggestion: make the default value of isAppropriat
Brian Wilkerson 2016/01/25 20:27:36 Good suggestion, but I modified it somewhat. Inste
143 : _isAppropriateFor = isAppropriateFor;
136 144
137 @override 145 @override
138 AnalysisTask createTask(AnalysisContext context, AnalysisTarget target, 146 AnalysisTask createTask(AnalysisContext context, AnalysisTarget target,
139 Map<String, dynamic> inputs) { 147 Map<String, dynamic> inputs) {
140 AnalysisTask task = buildTask(context, target); 148 AnalysisTask task = buildTask(context, target);
141 task.inputs = inputs; 149 task.inputs = inputs;
142 return task; 150 return task;
143 } 151 }
144 152
145 @override 153 @override
154 bool isAppropriateFor(AnalysisTarget target) {
155 if (_isAppropriateFor == null) {
156 return true;
157 }
158 return _isAppropriateFor(target);
159 }
160
161 @override
146 String toString() => name; 162 String toString() => name;
147 } 163 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/task/model.dart » ('j') | pkg/analyzer/lib/task/model.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698