| 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.task.model; | 5 library analyzer.task.model; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; | 9 import 'package:analyzer/src/generated/engine.dart' hide AnalysisTask; |
| 10 import 'package:analyzer/src/generated/java_engine.dart'; | 10 import 'package:analyzer/src/generated/java_engine.dart'; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 rethrow; | 239 rethrow; |
| 240 } catch (exception, stackTrace) { | 240 } catch (exception, stackTrace) { |
| 241 throw new AnalysisException( | 241 throw new AnalysisException( |
| 242 'Unexpected exception while performing $description', | 242 'Unexpected exception while performing $description', |
| 243 new CaughtException(exception, stackTrace)); | 243 new CaughtException(exception, stackTrace)); |
| 244 } | 244 } |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 /** | 248 /** |
| 249 * A [ResultDescriptor] that denotes an analysis result that is a union of | |
| 250 * one or more other results. | |
| 251 * | |
| 252 * Clients are not expected to subtype this class. | |
| 253 */ | |
| 254 abstract class CompositeResultDescriptor<V> extends ResultDescriptor<V> { | |
| 255 /** | |
| 256 * Initialize a newly created composite result to have the given [name]. | |
| 257 */ | |
| 258 factory CompositeResultDescriptor( | |
| 259 String name) = CompositeResultDescriptorImpl; | |
| 260 | |
| 261 /** | |
| 262 * Return a list containing the descriptors of the results that are unioned | |
| 263 * together to compose the value of this result. | |
| 264 * | |
| 265 * Clients must not modify the returned list. | |
| 266 */ | |
| 267 List<ResultDescriptor<V>> get contributors; | |
| 268 } | |
| 269 | |
| 270 /** | |
| 271 * A description of a [List]-based analysis result that can be computed by an | 249 * A description of a [List]-based analysis result that can be computed by an |
| 272 * [AnalysisTask]. | 250 * [AnalysisTask]. |
| 273 * | 251 * |
| 274 * Clients are not expected to subtype this class. | 252 * Clients are not expected to subtype this class. |
| 275 */ | 253 */ |
| 276 abstract class ListResultDescriptor<E> implements ResultDescriptor<List<E>> { | 254 abstract class ListResultDescriptor<E> implements ResultDescriptor<List<E>> { |
| 277 /** | 255 /** |
| 278 * Initialize a newly created analysis result to have the given [name]. If a | 256 * Initialize a newly created analysis result to have the given [name] and |
| 279 * composite result is specified, then this result will contribute to it. | 257 * [defaultValue]. If a [cachingPolicy] is provided, it will control how long |
| 258 * values associated with this result will remain in the cache. |
| 280 */ | 259 */ |
| 281 factory ListResultDescriptor(String name, List<E> defaultValue, | 260 factory ListResultDescriptor(String name, List<E> defaultValue, |
| 282 {CompositeResultDescriptor<List<E>> contributesTo, | 261 {ResultCachingPolicy<List<E>> cachingPolicy}) = ListResultDescriptorImpl<E
>; |
| 283 ResultCachingPolicy<List<E>> cachingPolicy}) = ListResultDescriptorImpl<E>
; | |
| 284 | 262 |
| 285 @override | 263 @override |
| 286 ListTaskInput<E> of(AnalysisTarget target); | 264 ListTaskInput<E> of(AnalysisTarget target); |
| 287 } | 265 } |
| 288 | 266 |
| 289 /** | 267 /** |
| 290 * A description of an input to an [AnalysisTask] that can be used to compute | 268 * A description of an input to an [AnalysisTask] that can be used to compute |
| 291 * that input. | 269 * that input. |
| 292 * | 270 * |
| 293 * Clients are not expected to subtype this class. | 271 * Clients are not expected to subtype this class. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 int measure(T object); | 342 int measure(T object); |
| 365 } | 343 } |
| 366 | 344 |
| 367 /** | 345 /** |
| 368 * A description of an analysis result that can be computed by an [AnalysisTask]
. | 346 * A description of an analysis result that can be computed by an [AnalysisTask]
. |
| 369 * | 347 * |
| 370 * Clients are not expected to subtype this class. | 348 * Clients are not expected to subtype this class. |
| 371 */ | 349 */ |
| 372 abstract class ResultDescriptor<V> { | 350 abstract class ResultDescriptor<V> { |
| 373 /** | 351 /** |
| 374 * Initialize a newly created analysis result to have the given [name]. If a | 352 * Initialize a newly created analysis result to have the given [name] and |
| 375 * composite result is specified, then this result will contribute to it. | 353 * [defaultValue]. |
| 376 * | 354 * |
| 377 * The given [cachingPolicy] is used to limit the total size of results | 355 * The given [cachingPolicy] is used to limit the total size of results |
| 378 * described by this descriptor. If no policy is specified, the results are | 356 * described by this descriptor. If no policy is specified, the results are |
| 379 * never evicted from the cache, and removed only when they are invalidated. | 357 * never evicted from the cache, and removed only when they are invalidated. |
| 380 */ | 358 */ |
| 381 factory ResultDescriptor(String name, V defaultValue, | 359 factory ResultDescriptor(String name, V defaultValue, |
| 382 {CompositeResultDescriptor<V> contributesTo, | 360 {ResultCachingPolicy<V> cachingPolicy}) = ResultDescriptorImpl; |
| 383 ResultCachingPolicy<V> cachingPolicy}) = ResultDescriptorImpl; | |
| 384 | 361 |
| 385 /** | 362 /** |
| 386 * Return the caching policy for results described by this descriptor. | 363 * Return the caching policy for results described by this descriptor. |
| 387 */ | 364 */ |
| 388 ResultCachingPolicy<V> get cachingPolicy; | 365 ResultCachingPolicy<V> get cachingPolicy; |
| 389 | 366 |
| 390 /** | 367 /** |
| 391 * Return the default value for results described by this descriptor. | 368 * Return the default value for results described by this descriptor. |
| 392 */ | 369 */ |
| 393 V get defaultValue; | 370 V get defaultValue; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 * be computed, or `false` if the inputs have been computed. | 482 * be computed, or `false` if the inputs have been computed. |
| 506 * | 483 * |
| 507 * It is safe to invoke [moveNext] after it has returned `false`. In this case | 484 * It is safe to invoke [moveNext] after it has returned `false`. In this case |
| 508 * [moveNext] has no effect and will again return `false`. | 485 * [moveNext] has no effect and will again return `false`. |
| 509 * | 486 * |
| 510 * Throws a [StateError] if the value of the current result has not been | 487 * Throws a [StateError] if the value of the current result has not been |
| 511 * provided using [currentValue]. | 488 * provided using [currentValue]. |
| 512 */ | 489 */ |
| 513 bool moveNext(); | 490 bool moveNext(); |
| 514 } | 491 } |
| OLD | NEW |