Chromium Code Reviews| 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:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/engine.dart' | 10 import 'package:analyzer/src/generated/engine.dart' |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 502 if (_partition != null) { | 502 if (_partition != null) { |
| 503 _partition.resultStored(thisResult, value); | 503 _partition.resultStored(thisResult, value); |
| 504 } | 504 } |
| 505 ResultData data = getResultData(descriptor); | 505 ResultData data = getResultData(descriptor); |
| 506 _setDependedOnResults(data, thisResult, dependedOn); | 506 _setDependedOnResults(data, thisResult, dependedOn); |
| 507 data.state = CacheState.VALID; | 507 data.state = CacheState.VALID; |
| 508 data.value = value == null ? descriptor.defaultValue : value; | 508 data.value = value == null ? descriptor.defaultValue : value; |
| 509 } | 509 } |
| 510 | 510 |
| 511 /** | 511 /** |
| 512 * Set the value of the result represented by the given [descriptor] to the | 512 * If the result represented by the given [descriptor] is valid, set |
| 513 * given [value], keep its dependency, invalidate all the dependent result. | 513 * it to the given [value], keep its dependency, and if [invalidateDependent] |
| 514 * invalidate all the dependent result. | |
| 514 */ | 515 */ |
| 515 void setValueIncremental( | 516 void setValueIncremental( |
| 516 ResultDescriptor descriptor, dynamic value, bool invalidateDependent) { | 517 ResultDescriptor descriptor, dynamic value, bool invalidateDependent) { |
| 517 ResultData data = getResultData(descriptor); | 518 ResultData data = getResultData(descriptor); |
| 518 data.state = CacheState.VALID; | 519 if (data.state == CacheState.VALID) { |
|
Brian Wilkerson
2015/11/20 19:47:47
I think we want to also set the value if the state
| |
| 519 data.value = value; | 520 data.value = value; |
| 521 } | |
| 520 if (invalidateDependent) { | 522 if (invalidateDependent) { |
| 521 _invalidateDependentResults(nextInvalidateId++, data, null, 0); | 523 _invalidateDependentResults(nextInvalidateId++, data, null, 0); |
| 522 } | 524 } |
| 523 } | 525 } |
| 524 | 526 |
| 525 @override | 527 @override |
| 526 String toString() { | 528 String toString() { |
| 527 StringBuffer buffer = new StringBuffer(); | 529 StringBuffer buffer = new StringBuffer(); |
| 528 _writeOn(buffer); | 530 _writeOn(buffer); |
| 529 return buffer.toString(); | 531 return buffer.toString(); |
| (...skipping 731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1261 void resultAccessed(TargetedResult result) {} | 1263 void resultAccessed(TargetedResult result) {} |
| 1262 | 1264 |
| 1263 @override | 1265 @override |
| 1264 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { | 1266 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { |
| 1265 return TargetedResult.EMPTY_LIST; | 1267 return TargetedResult.EMPTY_LIST; |
| 1266 } | 1268 } |
| 1267 | 1269 |
| 1268 @override | 1270 @override |
| 1269 void targetRemoved(AnalysisTarget target) {} | 1271 void targetRemoved(AnalysisTarget target) {} |
| 1270 } | 1272 } |
| OLD | NEW |