| 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 } | 460 } |
| 461 // Stop depending on other results. | 461 // Stop depending on other results. |
| 462 TargetedResult thisResult = new TargetedResult(target, descriptor); | 462 TargetedResult thisResult = new TargetedResult(target, descriptor); |
| 463 thisData.dependedOnResults.forEach((TargetedResult dependedOnResult) { | 463 thisData.dependedOnResults.forEach((TargetedResult dependedOnResult) { |
| 464 ResultData data = _partition._getDataFor(dependedOnResult, orNull: true); | 464 ResultData data = _partition._getDataFor(dependedOnResult, orNull: true); |
| 465 if (data != null) { | 465 if (data != null) { |
| 466 data.dependentResults.remove(thisResult); | 466 data.dependentResults.remove(thisResult); |
| 467 } | 467 } |
| 468 }); | 468 }); |
| 469 // Invalidate results that depend on this result. | 469 // Invalidate results that depend on this result. |
| 470 List<TargetedResult> dependentResults = thisData.dependentResults; | 470 Set<TargetedResult> dependentResults = thisData.dependentResults; |
| 471 thisData.dependentResults = <TargetedResult>[]; | 471 thisData.dependentResults = new Set<TargetedResult>(); |
| 472 dependentResults.forEach((TargetedResult dependentResult) { | 472 dependentResults.forEach((TargetedResult dependentResult) { |
| 473 CacheEntry entry = _partition.get(dependentResult.target); | 473 CacheEntry entry = _partition.get(dependentResult.target); |
| 474 if (entry != null) { | 474 if (entry != null) { |
| 475 entry._invalidate(dependentResult.result); | 475 entry._invalidate(dependentResult.result); |
| 476 } | 476 } |
| 477 }); | 477 }); |
| 478 // If empty, remove the entry altogether. | 478 // If empty, remove the entry altogether. |
| 479 if (_resultMap.isEmpty) { | 479 if (_resultMap.isEmpty) { |
| 480 _partition._targetMap.remove(target); | 480 _partition._targetMap.remove(target); |
| 481 _partition._removeIfSource(target); | 481 _partition._removeIfSource(target); |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 Object value; | 928 Object value; |
| 929 | 929 |
| 930 /** | 930 /** |
| 931 * A list of the results on which this result depends. | 931 * A list of the results on which this result depends. |
| 932 */ | 932 */ |
| 933 List<TargetedResult> dependedOnResults = <TargetedResult>[]; | 933 List<TargetedResult> dependedOnResults = <TargetedResult>[]; |
| 934 | 934 |
| 935 /** | 935 /** |
| 936 * A list of the results that depend on this result. | 936 * A list of the results that depend on this result. |
| 937 */ | 937 */ |
| 938 List<TargetedResult> dependentResults = <TargetedResult>[]; | 938 Set<TargetedResult> dependentResults = new Set<TargetedResult>(); |
| 939 | 939 |
| 940 /** | 940 /** |
| 941 * Initialize a newly created result holder to represent the value of data | 941 * Initialize a newly created result holder to represent the value of data |
| 942 * described by the given [descriptor]. | 942 * described by the given [descriptor]. |
| 943 */ | 943 */ |
| 944 ResultData(this.descriptor) { | 944 ResultData(this.descriptor) { |
| 945 state = CacheState.INVALID; | 945 state = CacheState.INVALID; |
| 946 value = descriptor.defaultValue; | 946 value = descriptor.defaultValue; |
| 947 } | 947 } |
| 948 | 948 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1041 void resultAccessed(TargetedResult result) {} | 1041 void resultAccessed(TargetedResult result) {} |
| 1042 | 1042 |
| 1043 @override | 1043 @override |
| 1044 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { | 1044 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { |
| 1045 return TargetedResult.EMPTY_LIST; | 1045 return TargetedResult.EMPTY_LIST; |
| 1046 } | 1046 } |
| 1047 | 1047 |
| 1048 @override | 1048 @override |
| 1049 void targetRemoved(AnalysisTarget target) {} | 1049 void targetRemoved(AnalysisTarget target) {} |
| 1050 } | 1050 } |
| OLD | NEW |