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

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

Issue 867563004: Improvements to task model (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/model.dart » ('j') | pkg/analyzer/lib/src/task/model.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3ed534653863a9462735738236e963a8c053f40d..3f060344f1f453c9204fa961aacccdf9e053d0a4 100644
--- a/pkg/analyzer/lib/src/task/general.dart
+++ b/pkg/analyzer/lib/src/task/general.dart
@@ -5,26 +5,25 @@
library analyzer.src.task.general;
import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask;
-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';
/**
- * The description of the task used to get the content of a source.
- */
-final TaskDescriptor GET_CONTENT = new TaskDescriptor(
- 'GET_CONTENT',
- GetContentTask.createTask,
- GetContentTask.buildInputs,
- <ResultDescriptor>[CONTENT, MODIFICATION_TIME]);
-
-/**
* A task that gets the contents of the source associated with an analysis
* target.
*/
class GetContentTask extends AnalysisTask {
/**
+ * The task descriptor describing this kind of task.
+ */
+ static final TaskDescriptor DESCRIPTOR = new TaskDescriptor(
+ 'GET_CONTENT',
+ GetContentTask.createTask,
scheglov 2015/01/26 16:10:33 FYI, we don't need GetContentTask qualifier now. J
Brian Wilkerson 2015/01/26 16:14:12 It wasn't. Thanks! I've removed them.
+ GetContentTask.buildInputs,
+ <ResultDescriptor>[CONTENT, MODIFICATION_TIME]);
+
+ /**
* Initialize a newly created task to access the content of the source
* associated with the given [target] in the given [context].
*/
@@ -41,12 +40,12 @@ class GetContentTask extends AnalysisTask {
}
@override
+ TaskDescriptor get descriptor => DESCRIPTOR;
+
+ @override
internalPerform() {
- Source source = target.source;
- if (source == null) {
- throw new AnalysisException(
- "Could not get contents: no source associated with the target");
- }
+ Source source = getRequiredSource();
+
TimestampedData<String> data = context.getContents(source);
outputs[CONTENT] = data.data;
outputs[MODIFICATION_TIME] = data.modificationTime;
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/task/model.dart » ('j') | pkg/analyzer/lib/src/task/model.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698