| 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 afe021626062dab159e58d4ebd91a185f7e631e1..636d2ad5f89d3e984b02f6085f2bd38dd1fbe77c 100644
|
| --- a/pkg/analyzer/lib/src/context/cache.dart
|
| +++ b/pkg/analyzer/lib/src/context/cache.dart
|
| @@ -14,6 +14,8 @@ import 'package:analyzer/src/generated/utilities_collection.dart';
|
| import 'package:analyzer/src/task/model.dart';
|
| import 'package:analyzer/task/model.dart';
|
|
|
| +import 'package:analyzer/src/dart/element/element.dart' show ElementImpl;
|
| +
|
| /**
|
| * Return `true` if the given [target] is a priority one.
|
| */
|
| @@ -384,7 +386,7 @@ class CacheEntry {
|
| * Return the value of the result represented by the given [descriptor], or
|
| * the default value for the result if this entry does not have a valid value.
|
| */
|
| - dynamic /*=V*/ getValue /*<V>*/ (ResultDescriptor /*<V>*/ descriptor) {
|
| + dynamic/*=V*/ getValue/*<V>*/(ResultDescriptor/*<V>*/ descriptor) {
|
| ResultData data = _resultMap[descriptor];
|
| if (data == null) {
|
| return descriptor.defaultValue;
|
| @@ -482,8 +484,8 @@ class CacheEntry {
|
| * Set the value of the result represented by the given [descriptor] to the
|
| * given [value].
|
| */
|
| - void setValue /*<V>*/ (ResultDescriptor /*<V>*/ descriptor,
|
| - dynamic /*=V*/ value, List<TargetedResult> dependedOn) {
|
| + void setValue/*<V>*/(ResultDescriptor/*<V>*/ descriptor, dynamic/*=V*/ value,
|
| + List<TargetedResult> dependedOn) {
|
| // {
|
| // String valueStr = '$value';
|
| // if (valueStr.length > 20) {
|
| @@ -582,6 +584,10 @@ class CacheEntry {
|
| // If empty and not explicitly added, remove the entry altogether.
|
| if (_resultMap.isEmpty && !explicitlyAdded) {
|
| _partition.entryMap.remove(target);
|
| + if (target is ElementImpl) {
|
| + // Allow mutations now that it's no longer a map key.
|
| + (target as ElementImpl).frozen = false;
|
| + }
|
| _partition._removeIfSource(target);
|
| }
|
| // Notify controller.
|
| @@ -922,6 +928,10 @@ abstract class CachePartition {
|
| }
|
| entry._partition = this;
|
| entry.fixExceptionState();
|
| + if (target is ElementImpl) {
|
| + // Detect attempts to mutate the map key.
|
| + target.frozen = true;
|
| + }
|
| entryMap[target] = entry;
|
| _addIfSource(target);
|
| }
|
|
|