| Index: pkg/analyzer/lib/src/context/cache.dart
|
| diff --git a/pkg/analyzer/lib/src/context/cache.dart b/pkg/analyzer/lib/src/context/cache.dart
|
| index ce0bf990244d4f386e2d98a65123220aeed6d2cd..bac4894ec933c28691f40269a65afae4a2d8ed5c 100644
|
| --- a/pkg/analyzer/lib/src/context/cache.dart
|
| +++ b/pkg/analyzer/lib/src/context/cache.dart
|
| @@ -302,6 +302,14 @@ class CacheEntry {
|
| }
|
|
|
| /**
|
| + * Look up the [ResultData] of [descriptor], or add a new one if it isn't
|
| + * there.
|
| + */
|
| + ResultData getResultData(ResultDescriptor descriptor) {
|
| + return _resultMap.putIfAbsent(descriptor, () => new ResultData(descriptor));
|
| + }
|
| +
|
| + /**
|
| * Return the state of the result represented by the given [descriptor].
|
| */
|
| CacheState getState(ResultDescriptor descriptor) {
|
| @@ -398,7 +406,7 @@ class CacheEntry {
|
| _invalidate(descriptor);
|
| }
|
| } else {
|
| - ResultData data = _getResultData(descriptor);
|
| + ResultData data = getResultData(descriptor);
|
| data.state = state;
|
| if (state != CacheState.IN_PROCESS) {
|
| //
|
| @@ -422,12 +430,23 @@ class CacheEntry {
|
| if (_partition != null) {
|
| _partition.resultStored(thisResult, value);
|
| }
|
| - ResultData data = _getResultData(descriptor);
|
| + ResultData data = getResultData(descriptor);
|
| _setDependedOnResults(data, thisResult, dependedOn);
|
| data.state = CacheState.VALID;
|
| data.value = value == null ? descriptor.defaultValue : value;
|
| }
|
|
|
| + /**
|
| + * Set the value of the result represented by the given [descriptor] to the
|
| + * given [value], keep its dependency, invalidate all the dependent result.
|
| + */
|
| + void setValueIncremental(ResultDescriptor descriptor, dynamic value) {
|
| + ResultData data = getResultData(descriptor);
|
| + List<TargetedResult> dependedOn = data.dependedOnResults;
|
| + _invalidate(descriptor);
|
| + setValue(descriptor, value, dependedOn);
|
| + }
|
| +
|
| @override
|
| String toString() {
|
| StringBuffer buffer = new StringBuffer();
|
| @@ -441,14 +460,6 @@ class CacheEntry {
|
| bool _getFlag(int index) => BooleanArray.get(_flags, index);
|
|
|
| /**
|
| - * Look up the [ResultData] of [descriptor], or add a new one if it isn't
|
| - * there.
|
| - */
|
| - ResultData _getResultData(ResultDescriptor descriptor) {
|
| - return _resultMap.putIfAbsent(descriptor, () => new ResultData(descriptor));
|
| - }
|
| -
|
| - /**
|
| * Invalidate the result represented by the given [descriptor] and propagate
|
| * invalidation to other results that depend on it.
|
| */
|
| @@ -517,7 +528,7 @@ class CacheEntry {
|
| * their values to the corresponding default values
|
| */
|
| void _setErrorState(ResultDescriptor descriptor, CaughtException exception) {
|
| - ResultData thisData = _getResultData(descriptor);
|
| + ResultData thisData = getResultData(descriptor);
|
| // Set the error state.
|
| _exception = exception;
|
| thisData.state = CacheState.ERROR;
|
| @@ -861,7 +872,7 @@ abstract class CachePartition {
|
| if (orNull) {
|
| return entry != null ? entry._resultMap[result.result] : null;
|
| } else {
|
| - return entry._getResultData(result.result);
|
| + return entry.getResultData(result.result);
|
| }
|
| }
|
|
|
|
|