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

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

Issue 1121963002: Record dependencies and invalidate results. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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/driver.dart
diff --git a/pkg/analyzer/lib/src/task/driver.dart b/pkg/analyzer/lib/src/task/driver.dart
index 8f9641bcbc759ebc780b94cad4a7ae3bdb1fa958..ab5887234a8d0f46e776df4cfa8db22c5afe893c 100644
--- a/pkg/analyzer/lib/src/task/driver.dart
+++ b/pkg/analyzer/lib/src/task/driver.dart
@@ -210,11 +210,12 @@ class AnalysisDriver {
task.perform();
CacheEntry entry = context.getCacheEntry(task.target);
if (task.caughtException == null) {
+ List<TargetedResult> dependedOn = item.inputTargetedResults.toList();
Map<ResultDescriptor, dynamic> outputs = task.outputs;
for (ResultDescriptor result in task.descriptor.results) {
// TODO(brianwilkerson) We could check here that a value was produced
// and throw an exception if not (unless we want to allow null values).
- entry.setValue(result, outputs[result]);
+ entry.setValue(result, outputs[result], dependedOn);
}
} else {
entry.setErrorState(task.caughtException, item.descriptor.results);
@@ -286,6 +287,12 @@ class WorkItem {
TaskInputBuilder builder;
/**
+ * The [TargetedResult]s outputs of this task depends on.
+ */
+ final HashSet<TargetedResult> inputTargetedResults =
+ new HashSet<TargetedResult>();
+
+ /**
* The inputs to the task that have been computed.
*/
Map<String, dynamic> inputs;
@@ -344,14 +351,9 @@ class WorkItem {
*/
WorkItem gatherInputs(TaskManager taskManager) {
while (builder != null) {
- //
- // TODO(brianwilkerson) Capture information about which inputs were used
- // to compute the results. This information can later be used to compute
- // which results depend on a given result, and hence which results need to
- // be invalidated when one result is invalidated.
- //
AnalysisTarget inputTarget = builder.currentTarget;
ResultDescriptor inputResult = builder.currentResult;
+ inputTargetedResults.add(new TargetedResult(inputTarget, inputResult));
CacheEntry inputEntry = context.getCacheEntry(inputTarget);
CacheState inputState = inputEntry.getState(inputResult);
if (inputState == CacheState.ERROR) {

Powered by Google App Engine
This is Rietveld 408576698