Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: pkg/analyzer/lib/src/context/cache.dart

Issue 1140943005: Fix for invalidating results of a target being removed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698