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

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

Issue 2948393002: Clean up type parameters in comments (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « pkg/analyzer/lib/src/cancelable_future.dart ('k') | 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:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/exception/exception.dart'; 10 import 'package:analyzer/exception/exception.dart';
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 189 }
190 return entry.getState(result); 190 return entry.getState(result);
191 } 191 }
192 192
193 /** 193 /**
194 * Return the value of the given [result] for the given [target]. 194 * Return the value of the given [result] for the given [target].
195 * 195 *
196 * It does not update the cache, if the corresponding [CacheEntry] does not 196 * It does not update the cache, if the corresponding [CacheEntry] does not
197 * exist, then the default value is returned. 197 * exist, then the default value is returned.
198 */ 198 */
199 Object/*=V*/ getValue/*<V>*/( 199 V getValue<V>(AnalysisTarget target, ResultDescriptor<V> result) {
200 AnalysisTarget target, ResultDescriptor/*<V>*/ result) {
201 CacheEntry entry = get(target); 200 CacheEntry entry = get(target);
202 if (entry == null) { 201 if (entry == null) {
203 return result.defaultValue; 202 return result.defaultValue;
204 } 203 }
205 return entry.getValue(result); 204 return entry.getValue(result);
206 } 205 }
207 206
208 /** 207 /**
209 * Return an iterator returning all of the map entries mapping targets to 208 * Return an iterator returning all of the map entries mapping targets to
210 * cache entries. If the [context] is not `null`, then only entries that are 209 * cache entries. If the [context] is not `null`, then only entries that are
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 if (data == null) { 437 if (data == null) {
439 return CacheState.INVALID; 438 return CacheState.INVALID;
440 } 439 }
441 return data.state; 440 return data.state;
442 } 441 }
443 442
444 /** 443 /**
445 * Return the value of the result represented by the given [descriptor], or 444 * Return the value of the result represented by the given [descriptor], or
446 * the default value for the result if this entry does not have a valid value. 445 * the default value for the result if this entry does not have a valid value.
447 */ 446 */
448 dynamic/*=V*/ getValue/*<V>*/(ResultDescriptor/*<V>*/ descriptor) { 447 V getValue<V>(ResultDescriptor<V> descriptor) {
449 ResultData data = _resultMap[descriptor]; 448 ResultData data = _resultMap[descriptor];
450 if (data == null) { 449 if (data == null) {
451 return descriptor.defaultValue; 450 return descriptor.defaultValue;
452 } 451 }
453 if (_partition != null) { 452 if (_partition != null) {
454 _partition.resultAccessed(target, descriptor); 453 _partition.resultAccessed(target, descriptor);
455 } 454 }
456 return data.value as Object/*=V*/; 455 return data.value as V;
457 } 456 }
458 457
459 /** 458 /**
460 * Return `true` if the state of any data value is [CacheState.ERROR]. 459 * Return `true` if the state of any data value is [CacheState.ERROR].
461 */ 460 */
462 bool hasErrorState() { 461 bool hasErrorState() {
463 for (ResultData data in _resultMap.values) { 462 for (ResultData data in _resultMap.values) {
464 if (data.state == CacheState.ERROR) { 463 if (data.state == CacheState.ERROR) {
465 return true; 464 return true;
466 } 465 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 // 540 //
542 data.value = descriptor.defaultValue; 541 data.value = descriptor.defaultValue;
543 } 542 }
544 } 543 }
545 } 544 }
546 545
547 /** 546 /**
548 * Set the value of the result represented by the given [descriptor] to the 547 * Set the value of the result represented by the given [descriptor] to the
549 * given [value]. 548 * given [value].
550 */ 549 */
551 void setValue/*<V>*/(ResultDescriptor/*<V>*/ descriptor, dynamic/*=V*/ value, 550 void setValue<V>(ResultDescriptor<V> descriptor, V value,
552 List<TargetedResult> dependedOn) { 551 List<TargetedResult> dependedOn) {
553 // { 552 // {
554 // String valueStr = '$value'; 553 // String valueStr = '$value';
555 // if (valueStr.length > 20) { 554 // if (valueStr.length > 20) {
556 // valueStr = valueStr.substring(0, 20) + '...'; 555 // valueStr = valueStr.substring(0, 20) + '...';
557 // } 556 // }
558 // valueStr = valueStr.replaceAll('\n', '\\n'); 557 // valueStr = valueStr.replaceAll('\n', '\\n');
559 // print( 558 // print(
560 // 'setValue $descriptor for $target value=$valueStr dependedOn=$depend edOn'); 559 // 'setValue $descriptor for $target value=$valueStr dependedOn=$depend edOn');
561 // } 560 // }
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 void resultAccessed(TargetedResult result) {} 1539 void resultAccessed(TargetedResult result) {}
1541 1540
1542 @override 1541 @override
1543 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { 1542 List<TargetedResult> resultStored(TargetedResult newResult, newValue) {
1544 return TargetedResult.EMPTY_LIST; 1543 return TargetedResult.EMPTY_LIST;
1545 } 1544 }
1546 1545
1547 @override 1546 @override
1548 void targetRemoved(AnalysisTarget target) {} 1547 void targetRemoved(AnalysisTarget target) {}
1549 } 1548 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/cancelable_future.dart ('k') | pkg/analyzer/lib/src/context/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698