| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 } | 417 } |
| 418 } | 418 } |
| 419 } | 419 } |
| 420 | 420 |
| 421 /** | 421 /** |
| 422 * Set the value of the result represented by the given [descriptor] to the | 422 * Set the value of the result represented by the given [descriptor] to the |
| 423 * given [value]. | 423 * given [value]. |
| 424 */ | 424 */ |
| 425 /*<V>*/ void setValue(ResultDescriptor /*<V>*/ descriptor, dynamic /*V*/ | 425 /*<V>*/ void setValue(ResultDescriptor /*<V>*/ descriptor, dynamic /*V*/ |
| 426 value, List<TargetedResult> dependedOn) { | 426 value, List<TargetedResult> dependedOn) { |
| 427 // print(' setValue: $descriptor for $target dependedOn=$dependedOn'); | |
| 428 _validateStateChange(descriptor, CacheState.VALID); | 427 _validateStateChange(descriptor, CacheState.VALID); |
| 429 TargetedResult thisResult = new TargetedResult(target, descriptor); | 428 TargetedResult thisResult = new TargetedResult(target, descriptor); |
| 430 if (_partition != null) { | 429 if (_partition != null) { |
| 431 _partition.resultStored(thisResult, value); | 430 _partition.resultStored(thisResult, value); |
| 432 } | 431 } |
| 433 ResultData data = getResultData(descriptor); | 432 ResultData data = getResultData(descriptor); |
| 434 _setDependedOnResults(data, thisResult, dependedOn); | 433 _setDependedOnResults(data, thisResult, dependedOn); |
| 435 data.state = CacheState.VALID; | 434 data.state = CacheState.VALID; |
| 436 data.value = value == null ? descriptor.defaultValue : value; | 435 data.value = value == null ? descriptor.defaultValue : value; |
| 437 } | 436 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 458 * Return the value of the flag with the given [index]. | 457 * Return the value of the flag with the given [index]. |
| 459 */ | 458 */ |
| 460 bool _getFlag(int index) => BooleanArray.get(_flags, index); | 459 bool _getFlag(int index) => BooleanArray.get(_flags, index); |
| 461 | 460 |
| 462 /** | 461 /** |
| 463 * Invalidate the result represented by the given [descriptor] and propagate | 462 * Invalidate the result represented by the given [descriptor] and propagate |
| 464 * invalidation to other results that depend on it. | 463 * invalidation to other results that depend on it. |
| 465 */ | 464 */ |
| 466 void _invalidate(ResultDescriptor descriptor) { | 465 void _invalidate(ResultDescriptor descriptor) { |
| 467 ResultData thisData = _resultMap.remove(descriptor); | 466 ResultData thisData = _resultMap.remove(descriptor); |
| 468 // print('invalidate: $descriptor for $target'); | |
| 469 if (thisData == null) { | 467 if (thisData == null) { |
| 470 return; | 468 return; |
| 471 } | 469 } |
| 472 // Stop depending on other results. | 470 // Stop depending on other results. |
| 473 TargetedResult thisResult = new TargetedResult(target, descriptor); | 471 TargetedResult thisResult = new TargetedResult(target, descriptor); |
| 474 thisData.dependedOnResults.forEach((TargetedResult dependedOnResult) { | 472 thisData.dependedOnResults.forEach((TargetedResult dependedOnResult) { |
| 475 ResultData data = _partition._getDataFor(dependedOnResult, orNull: true); | 473 ResultData data = _partition._getDataFor(dependedOnResult, orNull: true); |
| 476 if (data != null) { | 474 if (data != null) { |
| 477 data.dependentResults.remove(thisResult); | 475 data.dependentResults.remove(thisResult); |
| 478 } | 476 } |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1052 void resultAccessed(TargetedResult result) {} | 1050 void resultAccessed(TargetedResult result) {} |
| 1053 | 1051 |
| 1054 @override | 1052 @override |
| 1055 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { | 1053 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { |
| 1056 return TargetedResult.EMPTY_LIST; | 1054 return TargetedResult.EMPTY_LIST; |
| 1057 } | 1055 } |
| 1058 | 1056 |
| 1059 @override | 1057 @override |
| 1060 void targetRemoved(AnalysisTarget target) {} | 1058 void targetRemoved(AnalysisTarget target) {} |
| 1061 } | 1059 } |
| OLD | NEW |