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

Side by Side Diff: pkg/analyzer/test/src/task/test_support.dart

Issue 1120313004: Get memento objects from tasks, remember in cache and pass back to tasks. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.src.task.test_support; 5 library test.src.task.test_support;
6 6
7 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; 7 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask;
8 import 'package:analyzer/src/generated/java_engine.dart'; 8 import 'package:analyzer/src/generated/java_engine.dart';
9 import 'package:analyzer/task/model.dart'; 9 import 'package:analyzer/task/model.dart';
10 10
11 /** 11 /**
12 * A configurable analysis task that can be used by tests. 12 * A configurable analysis task that can be used by tests.
13 */ 13 */
14 class TestAnalysisTask extends AnalysisTask { 14 class TestAnalysisTask extends AnalysisTask {
15 /** 15 /**
16 * The descriptor describing this task. 16 * The descriptor describing this task.
17 */ 17 */
18 TaskDescriptor descriptor; 18 TaskDescriptor descriptor;
19 19
20 /** 20 /**
21 * The exception that is to be "thrown" by this task. 21 * The exception that is to be "thrown" by this task.
22 */ 22 */
23 CaughtException exception; 23 CaughtException exception;
24 24
25 /** 25 /**
26 * The memento to associate with the result.
27 */
28 dynamic memento;
29
30 /**
26 * The results whose values are to be provided as outputs from this task. 31 * The results whose values are to be provided as outputs from this task.
27 */ 32 */
28 List<ResultDescriptor> results; 33 List<ResultDescriptor> results;
29 34
30 /** 35 /**
31 * The next value that is to be used for a result. 36 * The next value that is to be used for a result.
32 */ 37 */
33 int value; 38 int value;
34 39
35 TestAnalysisTask(AnalysisContext context, AnalysisTarget target, 40 TestAnalysisTask(AnalysisContext context, AnalysisTarget target,
36 {this.descriptor, this.exception, this.results, this.value: 1}) 41 {this.descriptor, this.exception, this.memento, this.results,
42 this.value: 1})
37 : super(context, target); 43 : super(context, target);
38 44
39 @override 45 @override
40 String get description => 'Test task'; 46 String get description => 'Test task';
41 47
42 @override 48 @override
43 internalPerform() { 49 internalPerform() {
44 if (exception != null) { 50 if (exception != null) {
45 caughtException = exception; 51 caughtException = exception;
46 } else if (results != null) { 52 } else if (results != null) {
47 for (ResultDescriptor result in results) { 53 for (ResultDescriptor result in results) {
48 outputs[result] = value++; 54 outputs[result] = value++;
49 } 55 }
56 outputMemento = memento;
50 } else if (descriptor != null) { 57 } else if (descriptor != null) {
51 for (ResultDescriptor result in descriptor.results) { 58 for (ResultDescriptor result in descriptor.results) {
52 outputs[result] = value++; 59 outputs[result] = value++;
53 } 60 }
61 outputMemento = memento;
54 } 62 }
55 } 63 }
56 } 64 }
OLDNEW
« pkg/analyzer/lib/src/task/driver.dart ('K') | « pkg/analyzer/test/src/task/model_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698