Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 analyzer.src.context.cache; | 5 library analyzer.src.context.cache; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/dart/element/element.dart' | 10 import 'package:analyzer/src/dart/element/element.dart' |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 558 // Stop if already validated. | 558 // Stop if already validated. |
| 559 if (delta != null) { | 559 if (delta != null) { |
| 560 if (thisData.invalidateId == id) { | 560 if (thisData.invalidateId == id) { |
| 561 return; | 561 return; |
| 562 } | 562 } |
| 563 thisData.invalidateId = id; | 563 thisData.invalidateId = id; |
| 564 } | 564 } |
| 565 // Ask the delta to validate. | 565 // Ask the delta to validate. |
| 566 DeltaResult deltaResult = null; | 566 DeltaResult deltaResult = null; |
| 567 if (delta != null) { | 567 if (delta != null) { |
| 568 deltaResult = delta.validate(_partition.context, target, descriptor); | 568 deltaResult = delta.validate(_partition.context, target, descriptor, |
| 569 thisData.state, thisData.value); | |
| 569 if (deltaResult == DeltaResult.STOP) { | 570 if (deltaResult == DeltaResult.STOP) { |
| 570 return; | 571 return; |
| 571 } | 572 } |
| 572 } | 573 } |
| 573 if (deltaResult == DeltaResult.INVALIDATE_NO_DELTA) { | 574 if (deltaResult == DeltaResult.INVALIDATE_NO_DELTA) { |
| 574 delta = null; | 575 delta = null; |
| 575 } | 576 } |
| 576 if (deltaResult == null || | 577 if (deltaResult == null || |
| 577 deltaResult == DeltaResult.INVALIDATE || | 578 deltaResult == DeltaResult.INVALIDATE || |
| 578 deltaResult == DeltaResult.INVALIDATE_NO_DELTA) { | 579 deltaResult == DeltaResult.INVALIDATE_NO_DELTA) { |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1049 /** | 1050 /** |
| 1050 * The description for a change. | 1051 * The description for a change. |
| 1051 */ | 1052 */ |
| 1052 class Delta { | 1053 class Delta { |
| 1053 final Source source; | 1054 final Source source; |
| 1054 | 1055 |
| 1055 Delta(this.source); | 1056 Delta(this.source); |
| 1056 | 1057 |
| 1057 /** | 1058 /** |
| 1058 * Check whether this delta affects the result described by the given | 1059 * Check whether this delta affects the result described by the given |
| 1059 * [descriptor] and [target]. | 1060 * [descriptor] and [target]. The current [state] and [value] of the result |
| 1061 * are provided. | |
| 1060 */ | 1062 */ |
| 1061 DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target, | 1063 DeltaResult validate(InternalAnalysisContext context, AnalysisTarget target, |
| 1062 ResultDescriptor descriptor) { | 1064 ResultDescriptor descriptor, CacheState state, Object value) { |
|
Brian Wilkerson
2016/03/20 21:26:29
I'm not seeing where the state is used, but maybe
scheglov
2016/03/20 22:16:46
No, you're not missing.
I thought that maybe it wo
| |
| 1063 return DeltaResult.INVALIDATE; | 1065 return DeltaResult.INVALIDATE; |
| 1064 } | 1066 } |
| 1065 } | 1067 } |
| 1066 | 1068 |
| 1067 /** | 1069 /** |
| 1068 * The possible results of validating analysis results against a [Delta]. | 1070 * The possible results of validating analysis results against a [Delta]. |
| 1069 */ | 1071 */ |
| 1070 enum DeltaResult { | 1072 enum DeltaResult { |
| 1071 /** | 1073 /** |
| 1072 * Invalidate this result and continue visiting dependent results | 1074 * Invalidate this result and continue visiting dependent results |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1269 void resultAccessed(TargetedResult result) {} | 1271 void resultAccessed(TargetedResult result) {} |
| 1270 | 1272 |
| 1271 @override | 1273 @override |
| 1272 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { | 1274 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { |
| 1273 return TargetedResult.EMPTY_LIST; | 1275 return TargetedResult.EMPTY_LIST; |
| 1274 } | 1276 } |
| 1275 | 1277 |
| 1276 @override | 1278 @override |
| 1277 void targetRemoved(AnalysisTarget target) {} | 1279 void targetRemoved(AnalysisTarget target) {} |
| 1278 } | 1280 } |
| OLD | NEW |