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

Unified Diff: pkg/analyzer/test/src/task/test_support.dart

Issue 913483002: First cut at analysis driver (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/test/src/task/test_support.dart
diff --git a/pkg/analyzer/test/src/task/test_support.dart b/pkg/analyzer/test/src/task/test_support.dart
index 85297f6576e70a72143cad838aeb5fdfb36a099e..cafd4b9022f20620250ac6a8307c203670f95e9c 100644
--- a/pkg/analyzer/test/src/task/test_support.dart
+++ b/pkg/analyzer/test/src/task/test_support.dart
@@ -5,19 +5,52 @@
library test.src.task.test_support;
import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask;
+import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/task/model.dart';
+/**
+ * A configurable analysis task that can be used by tests.
+ */
class TestAnalysisTask extends AnalysisTask {
- TestAnalysisTask(AnalysisContext context, AnalysisTarget target)
+ /**
+ * The descriptor describing this task.
+ */
+ TaskDescriptor descriptor;
+
+ /**
+ * The exception that is to be "thrown" by this task.
+ */
+ CaughtException exception;
+
+ /**
+ * The results whose values are to be provided as outputs from this task.
+ */
+ List<ResultDescriptor> results;
+
+ /**
+ * The next value that is to be used for a result.
+ */
+ int value = 1;
+
+ TestAnalysisTask(AnalysisContext context, AnalysisTarget target,
+ {this.descriptor, this.exception, this.results})
: super(context, target);
@override
String get description => 'Test task';
@override
- TaskDescriptor get descriptor => null;
-
- @override
internalPerform() {
+ if (exception != null) {
+ caughtException = exception;
+ } else if (results != null) {
+ for (ResultDescriptor result in results) {
+ outputs[result] = value++;
+ }
+ } else if (descriptor != null) {
+ for (ResultDescriptor result in descriptor.results) {
+ outputs[result] = value++;
+ }
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698