| 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' |
| 11 show AnalysisEngine, CacheState, InternalAnalysisContext, RetentionPriority; | 11 show AnalysisEngine, CacheState, InternalAnalysisContext, RetentionPriority; |
| 12 import 'package:analyzer/src/generated/java_engine.dart'; | 12 import 'package:analyzer/src/generated/java_engine.dart'; |
| 13 import 'package:analyzer/src/generated/source.dart'; | 13 import 'package:analyzer/src/generated/source.dart'; |
| 14 import 'package:analyzer/src/generated/utilities_collection.dart'; | 14 import 'package:analyzer/src/generated/utilities_collection.dart'; |
| 15 import 'package:analyzer/src/generated/utilities_general.dart'; | |
| 16 import 'package:analyzer/src/task/model.dart'; | 15 import 'package:analyzer/src/task/model.dart'; |
| 17 import 'package:analyzer/task/model.dart'; | 16 import 'package:analyzer/task/model.dart'; |
| 18 | 17 |
| 19 /** | 18 /** |
| 20 * Return `true` if the given [target] is a priority one. | 19 * Return `true` if the given [target] is a priority one. |
| 21 */ | 20 */ |
| 22 typedef bool IsPriorityAnalysisTarget(AnalysisTarget target); | 21 typedef bool IsPriorityAnalysisTarget(AnalysisTarget target); |
| 23 | 22 |
| 24 /** | 23 /** |
| 25 * An LRU cache of results produced by analysis. | 24 * An LRU cache of results produced by analysis. |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1110 bool isResponsibleFor(AnalysisTarget target) { | 1109 bool isResponsibleFor(AnalysisTarget target) { |
| 1111 if (target is AnalysisContextTarget) { | 1110 if (target is AnalysisContextTarget) { |
| 1112 return true; | 1111 return true; |
| 1113 } | 1112 } |
| 1114 Source source = target.source; | 1113 Source source = target.source; |
| 1115 return source != null && source.isInSystemLibrary; | 1114 return source != null && source.isInSystemLibrary; |
| 1116 } | 1115 } |
| 1117 } | 1116 } |
| 1118 | 1117 |
| 1119 /** | 1118 /** |
| 1120 * A specification of a specific result computed for a specific target. | |
| 1121 */ | |
| 1122 class TargetedResult { | |
| 1123 /** | |
| 1124 * An empty list of results. | |
| 1125 */ | |
| 1126 static final List<TargetedResult> EMPTY_LIST = const <TargetedResult>[]; | |
| 1127 | |
| 1128 /** | |
| 1129 * The target with which the result is associated. | |
| 1130 */ | |
| 1131 final AnalysisTarget target; | |
| 1132 | |
| 1133 /** | |
| 1134 * The result associated with the target. | |
| 1135 */ | |
| 1136 final ResultDescriptor result; | |
| 1137 | |
| 1138 /** | |
| 1139 * Initialize a new targeted result. | |
| 1140 */ | |
| 1141 TargetedResult(this.target, this.result); | |
| 1142 | |
| 1143 @override | |
| 1144 int get hashCode { | |
| 1145 return JenkinsSmiHash.combine(target.hashCode, result.hashCode); | |
| 1146 } | |
| 1147 | |
| 1148 @override | |
| 1149 bool operator ==(other) { | |
| 1150 return other is TargetedResult && | |
| 1151 other.target == target && | |
| 1152 other.result == result; | |
| 1153 } | |
| 1154 | |
| 1155 @override | |
| 1156 String toString() => '$result for $target'; | |
| 1157 } | |
| 1158 | |
| 1159 /** | |
| 1160 * A cache partition that contains all targets not contained in other partitions
. | 1119 * A cache partition that contains all targets not contained in other partitions
. |
| 1161 */ | 1120 */ |
| 1162 class UniversalCachePartition extends CachePartition { | 1121 class UniversalCachePartition extends CachePartition { |
| 1163 /** | 1122 /** |
| 1164 * Initialize a newly created cache partition, belonging to the given | 1123 * Initialize a newly created cache partition, belonging to the given |
| 1165 * [context]. | 1124 * [context]. |
| 1166 */ | 1125 */ |
| 1167 UniversalCachePartition(InternalAnalysisContext context) : super(context); | 1126 UniversalCachePartition(InternalAnalysisContext context) : super(context); |
| 1168 | 1127 |
| 1169 @override | 1128 @override |
| (...skipping 12 matching lines...) Expand all Loading... |
| 1182 void resultAccessed(TargetedResult result) {} | 1141 void resultAccessed(TargetedResult result) {} |
| 1183 | 1142 |
| 1184 @override | 1143 @override |
| 1185 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { | 1144 List<TargetedResult> resultStored(TargetedResult newResult, newValue) { |
| 1186 return TargetedResult.EMPTY_LIST; | 1145 return TargetedResult.EMPTY_LIST; |
| 1187 } | 1146 } |
| 1188 | 1147 |
| 1189 @override | 1148 @override |
| 1190 void targetRemoved(AnalysisTarget target) {} | 1149 void targetRemoved(AnalysisTarget target) {} |
| 1191 } | 1150 } |
| OLD | NEW |