| 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/dart/element/element.dart' | 10 import 'package:analyzer/src/dart/element/element.dart' |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 } | 166 } |
| 167 return entry.getState(result); | 167 return entry.getState(result); |
| 168 } | 168 } |
| 169 | 169 |
| 170 /** | 170 /** |
| 171 * Return the value of the given [result] for the given [target]. | 171 * Return the value of the given [result] for the given [target]. |
| 172 * | 172 * |
| 173 * It does not update the cache, if the corresponding [CacheEntry] does not | 173 * It does not update the cache, if the corresponding [CacheEntry] does not |
| 174 * exist, then the default value is returned. | 174 * exist, then the default value is returned. |
| 175 */ | 175 */ |
| 176 Object getValue(AnalysisTarget target, ResultDescriptor result) { | 176 Object/*=V*/ getValue/*<V>*/( |
| 177 AnalysisTarget target, ResultDescriptor/*<V>*/ result) { |
| 177 CacheEntry entry = get(target); | 178 CacheEntry entry = get(target); |
| 178 if (entry == null) { | 179 if (entry == null) { |
| 179 return result.defaultValue; | 180 return result.defaultValue; |
| 180 } | 181 } |
| 181 return entry.getValue(result); | 182 return entry.getValue(result) as Object/*=V*/; |
| 182 } | 183 } |
| 183 | 184 |
| 184 /** | 185 /** |
| 185 * Return an iterator returning all of the map entries mapping targets to | 186 * Return an iterator returning all of the map entries mapping targets to |
| 186 * cache entries. If the [context] is not `null`, then only entries that are | 187 * cache entries. If the [context] is not `null`, then only entries that are |
| 187 * owned by the given context will be returned. | 188 * owned by the given context will be returned. |
| 188 */ | 189 */ |
| 189 MapIterator<AnalysisTarget, CacheEntry> iterator( | 190 MapIterator<AnalysisTarget, CacheEntry> iterator( |
| 190 {InternalAnalysisContext context: null}) { | 191 {InternalAnalysisContext context: null}) { |
| 191 List<Map<AnalysisTarget, CacheEntry>> maps = | 192 List<Map<AnalysisTarget, CacheEntry>> maps = |
| (...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 void resultAccessed(TargetedResult result) {} | 1271 void resultAccessed(TargetedResult result) {} |
| 1271 | 1272 |
| 1272 @override | 1273 @override |
| 1273 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { | 1274 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { |
| 1274 return TargetedResult.EMPTY_LIST; | 1275 return TargetedResult.EMPTY_LIST; |
| 1275 } | 1276 } |
| 1276 | 1277 |
| 1277 @override | 1278 @override |
| 1278 void targetRemoved(AnalysisTarget target) {} | 1279 void targetRemoved(AnalysisTarget target) {} |
| 1279 } | 1280 } |
| OLD | NEW |