| Index: pkg/analyzer/lib/task/model.dart
|
| diff --git a/pkg/analyzer/lib/task/model.dart b/pkg/analyzer/lib/task/model.dart
|
| index 118c66deceb61129f3d88a42b66a12bc5aaa0ec6..f4dfc789c407156bed8785c3fb22620a408b1937 100644
|
| --- a/pkg/analyzer/lib/task/model.dart
|
| +++ b/pkg/analyzer/lib/task/model.dart
|
| @@ -95,6 +95,34 @@ abstract class AnalysisTask {
|
| String get description;
|
|
|
| /**
|
| + * Return the descriptor that describes this task.
|
| + */
|
| + TaskDescriptor get descriptor;
|
| +
|
| + /**
|
| + * Return the value of the input with the given [name]. Throw an exception if
|
| + * the input value is not defined.
|
| + */
|
| + Object getRequiredInput(String name) {
|
| + if (inputs == null || !inputs.containsKey(name)) {
|
| + throw new AnalysisException("Could not $description: missing $name");
|
| + }
|
| + return inputs[name];
|
| + }
|
| +
|
| + /**
|
| + * Return the source associated with the target. Throw an exception if
|
| + * the target is not associated with a source.
|
| + */
|
| + Source getRequiredSource() {
|
| + Source source = target.source;
|
| + if (source == null) {
|
| + throw new AnalysisException("Could not $description: missing source");
|
| + }
|
| + return source;
|
| + }
|
| +
|
| + /**
|
| * Perform this analysis task, protected by an exception handler.
|
| *
|
| * This method should throw an [AnalysisException] if an exception occurs
|
| @@ -167,7 +195,8 @@ abstract class ContributionPoint<V> extends ResultDescriptor<V> {
|
| /**
|
| * Initialize a newly created contribution point to have the given [name].
|
| */
|
| - factory ContributionPoint(String name) = ContributionPointImpl;
|
| + factory ContributionPoint(String name, V defaultValue) =
|
| + ContributionPointImpl;
|
|
|
| /**
|
| * Return a list containing the descriptors of the results that are unioned
|
| @@ -188,8 +217,13 @@ abstract class ResultDescriptor<V> {
|
| * Initialize a newly created analysis result to have the given [name]. If a
|
| * contribution point is specified, then this result will contribute to it.
|
| */
|
| - factory ResultDescriptor(String name, {ContributionPoint<V> contributesTo}) =
|
| - ResultDescriptorImpl;
|
| + factory ResultDescriptor(String name, V defaultValue,
|
| + {ContributionPoint<V> contributesTo}) = ResultDescriptorImpl;
|
| +
|
| + /**
|
| + * Return the default value for results described by this descriptor.
|
| + */
|
| + V get defaultValue;
|
|
|
| /**
|
| * Return a task input that can be used to compute this result for the given
|
|
|