| Index: pkg/analyzer/lib/src/task/general.dart
|
| diff --git a/pkg/analyzer/lib/src/task/general.dart b/pkg/analyzer/lib/src/task/general.dart
|
| index 25feb6f6d320ce397fd92636cbb085fd2d089647..5cb31ed699b0a0a3bfb9af9389ad44d9ad5d51bf 100644
|
| --- a/pkg/analyzer/lib/src/task/general.dart
|
| +++ b/pkg/analyzer/lib/src/task/general.dart
|
| @@ -13,7 +13,7 @@ import 'package:analyzer/task/model.dart';
|
| * A task that gets the contents of the source associated with an analysis
|
| * target.
|
| */
|
| -class GetContentTask extends AnalysisTask {
|
| +class GetContentTask extends SourceBasedAnalysisTask {
|
| /**
|
| * The task descriptor describing this kind of task.
|
| */
|
| @@ -31,15 +31,6 @@ class GetContentTask extends AnalysisTask {
|
| : super(context, target);
|
|
|
| @override
|
| - String get description {
|
| - Source source = target.source;
|
| - if (source == null) {
|
| - return "get contents of <unknown source>";
|
| - }
|
| - return "get contents of ${source.fullName}";
|
| - }
|
| -
|
| - @override
|
| TaskDescriptor get descriptor => DESCRIPTOR;
|
|
|
| @override
|
| @@ -68,3 +59,23 @@ class GetContentTask extends AnalysisTask {
|
| return new GetContentTask(context, target);
|
| }
|
| }
|
| +
|
| +/**
|
| + * A base class for analysis tasks whose target is expected to be a source.
|
| + */
|
| +abstract class SourceBasedAnalysisTask extends AnalysisTask {
|
| + /**
|
| + * Initialize a newly created task to perform analysis within the given
|
| + * [context] in order to produce results for the given [target].
|
| + */
|
| + SourceBasedAnalysisTask(AnalysisContext context, AnalysisTarget target)
|
| + : super(context, target);
|
| +
|
| + @override
|
| + String get description {
|
| + Source source = target.source;
|
| + String sourceName =
|
| + target.source == null ? '<unknown source>' : source.fullName;
|
| + return '${descriptor.name} for source $sourceName';
|
| + }
|
| +}
|
|
|