Chromium Code Reviews| 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 69a808ee386bb7f1a377e5617f286c72f5284764..f49bb32d5f0f8f1168325a7ab2714d17154626b9 100644 |
| --- a/pkg/analyzer/lib/src/task/general.dart |
| +++ b/pkg/analyzer/lib/src/task/general.dart |
| @@ -9,6 +9,7 @@ import 'package:analyzer/src/generated/java_engine.dart'; |
| import 'package:analyzer/src/generated/source.dart'; |
| import 'package:analyzer/task/general.dart'; |
| import 'package:analyzer/task/model.dart'; |
| +import 'package:analyzer/src/generated/element.dart'; |
| /** |
| * A task that gets the contents of the source associated with an analysis |
| @@ -63,6 +64,25 @@ class GetContentTask extends SourceBasedAnalysisTask { |
| } |
| /** |
| + * A base class for analysis tasks whose target is expected to be an element. |
| + */ |
| +abstract class ElementBasedAnalysisTask extends AnalysisTask { |
|
scheglov
2015/05/08 18:46:08
I'm not sure that this is a right place for this t
Brian Wilkerson
2015/05/08 19:22:38
Agreed.
Paul Berry
2015/05/08 19:44:22
Done.
|
| + /** |
| + * Initialize a newly created task to perform analysis within the given |
| + * [context] in order to produce results for the given [element]. |
| + */ |
| + ElementBasedAnalysisTask(AnalysisContext context, Element element) |
| + : super(context, element); |
| + |
| + @override |
| + String get description { |
| + Source source = target.source; |
| + String sourceName = source == null ? '<unknown source>' : source.fullName; |
| + return '${descriptor.name} for element $target in source $sourceName'; |
| + } |
| +} |
| + |
| +/** |
| * A base class for analysis tasks whose target is expected to be a source. |
| */ |
| abstract class SourceBasedAnalysisTask extends AnalysisTask { |