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

Unified Diff: pkg/analyzer/lib/src/task/general.dart

Issue 1125423004: Add a task to the new task model for computing constant values. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 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 side-by-side diff with in-line comments
Download patch
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 {

Powered by Google App Engine
This is Rietveld 408576698