| 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:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/engine.dart' | 9 import 'package:analyzer/src/generated/engine.dart' |
| 10 show AnalysisEngine, CacheState, InternalAnalysisContext, RetentionPriority; | 10 show AnalysisEngine, CacheState, InternalAnalysisContext, RetentionPriority; |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 ResultData data = _partition._getDataFor(dependedOnResult, orNull: true); | 446 ResultData data = _partition._getDataFor(dependedOnResult, orNull: true); |
| 447 if (data != null) { | 447 if (data != null) { |
| 448 data.dependentResults.remove(thisResult); | 448 data.dependentResults.remove(thisResult); |
| 449 } | 449 } |
| 450 }); | 450 }); |
| 451 // Invalidate results that depend on this result. | 451 // Invalidate results that depend on this result. |
| 452 List<TargetedResult> dependentResults = thisData.dependentResults; | 452 List<TargetedResult> dependentResults = thisData.dependentResults; |
| 453 thisData.dependentResults = <TargetedResult>[]; | 453 thisData.dependentResults = <TargetedResult>[]; |
| 454 dependentResults.forEach((TargetedResult dependentResult) { | 454 dependentResults.forEach((TargetedResult dependentResult) { |
| 455 CacheEntry entry = _partition.get(dependentResult.target); | 455 CacheEntry entry = _partition.get(dependentResult.target); |
| 456 entry._invalidate(dependentResult.result, true); | 456 if (entry != null) { |
| 457 entry._invalidate(dependentResult.result, true); |
| 458 } |
| 457 }); | 459 }); |
| 458 // If empty, remove the entry altogether. | 460 // If empty, remove the entry altogether. |
| 459 if (_resultMap.isEmpty) { | 461 if (_resultMap.isEmpty) { |
| 460 _partition._targetMap.remove(target); | 462 _partition._targetMap.remove(target); |
| 461 } | 463 } |
| 462 } | 464 } |
| 463 | 465 |
| 464 /** | 466 /** |
| 465 * Invalidates all the results of this entry, with propagation. | 467 * Invalidates all the results of this entry, with propagation. |
| 466 */ | 468 */ |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 932 class UniversalCachePartition extends CachePartition { | 934 class UniversalCachePartition extends CachePartition { |
| 933 /** | 935 /** |
| 934 * Initialize a newly created cache partition, belonging to the given | 936 * Initialize a newly created cache partition, belonging to the given |
| 935 * [context]. | 937 * [context]. |
| 936 */ | 938 */ |
| 937 UniversalCachePartition(InternalAnalysisContext context) : super(context); | 939 UniversalCachePartition(InternalAnalysisContext context) : super(context); |
| 938 | 940 |
| 939 @override | 941 @override |
| 940 bool isResponsibleFor(AnalysisTarget target) => true; | 942 bool isResponsibleFor(AnalysisTarget target) => true; |
| 941 } | 943 } |
| OLD | NEW |