| Index: pkg/analyzer/lib/src/dart/analysis/byte_store.dart
|
| diff --git a/pkg/analyzer/lib/src/dart/analysis/byte_store.dart b/pkg/analyzer/lib/src/dart/analysis/byte_store.dart
|
| index e8079ee98b1a21c0576f53075a08c81dd0d7ed6c..3f3f5dbf16ea9c3307dced03c29e3912cb392da9 100644
|
| --- a/pkg/analyzer/lib/src/dart/analysis/byte_store.dart
|
| +++ b/pkg/analyzer/lib/src/dart/analysis/byte_store.dart
|
| @@ -63,9 +63,11 @@ class MemoryCachingByteStore implements ByteStore {
|
| List<int> bytes = _map.remove(key);
|
| if (bytes == null) {
|
| bytes = _store.get(key);
|
| - _map[key] = bytes;
|
| - _currentSizeBytes += bytes?.length ?? 0;
|
| - _evict();
|
| + if (bytes != null) {
|
| + _map[key] = bytes;
|
| + _currentSizeBytes += bytes.length;
|
| + _evict();
|
| + }
|
| } else {
|
| _map[key] = bytes;
|
| }
|
| @@ -84,6 +86,10 @@ class MemoryCachingByteStore implements ByteStore {
|
| void _evict() {
|
| while (_currentSizeBytes > _maxSizeBytes) {
|
| if (_map.isEmpty) {
|
| + // Should be impossible, since _currentSizeBytes should always match
|
| + // _map. But recover anyway.
|
| + assert(false);
|
| + _currentSizeBytes = 0;
|
| break;
|
| }
|
| String key = _map.keys.first;
|
|
|