Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 } |
| OLD | NEW |