| 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'; |
| 11 import 'package:analyzer/src/generated/source.dart'; | 11 import 'package:analyzer/src/generated/source.dart'; |
| 12 import 'package:analyzer/src/task/model.dart'; | 12 import 'package:analyzer/src/task/model.dart'; |
| 13 | 13 |
| 14 /** | 14 /** |
| 15 * A function that takes an analysis [context] and an analysis [target] and | 15 * A function that takes an analysis [context] and an analysis [target] and |
| 16 * returns an analysis task. Such functions are passed to a [TaskDescriptor] to | 16 * returns an analysis task. Such functions are passed to a [TaskDescriptor] to |
| 17 * be used to create the described task. | 17 * be used to create the described task. |
| 18 */ | 18 */ |
| 19 typedef AnalysisTask BuildTask(AnalysisContext context, AnalysisTarget target); | 19 typedef AnalysisTask BuildTask(AnalysisContext context, AnalysisTarget target); |
| 20 | 20 |
| 21 /** | 21 /** |
| 22 * A function that takes the target for which a task will produce results and | 22 * A function that takes the target for which a task will produce results and |
| 23 * returns a map from input names to descriptions of the analysis results needed | 23 * returns a map from input names to descriptions of the analysis results needed |
| 24 * by the task in order for the task to be performed. Such functions are passed | 24 * by the task in order for the task to be performed. Such functions are passed |
| 25 * to a [TaskDescriptor] to be used to determine the inputs needed by the task. | 25 * to a [TaskDescriptor] to be used to determine the inputs needed by the task. |
| 26 */ | 26 */ |
| 27 typedef Map<String, TaskInput> CreateTaskInputs(AnalysisTarget target); | 27 typedef Map<String, TaskInput> CreateTaskInputs(AnalysisTarget target); |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * An [AnalysisTarget] wrapper for an [AnalysisContext]. |
| 31 */ |
| 32 class AnalysisContextTarget implements AnalysisTarget { |
| 33 static final AnalysisContextTarget request = new AnalysisContextTarget(null); |
| 34 |
| 35 final AnalysisContext context; |
| 36 |
| 37 AnalysisContextTarget(this.context); |
| 38 |
| 39 @override |
| 40 Source get source => null; |
| 41 } |
| 42 |
| 43 /** |
| 30 * An object with which an analysis result can be associated. | 44 * An object with which an analysis result can be associated. |
| 31 * | 45 * |
| 32 * Clients are allowed to subtype this class when creating new kinds of targets. | 46 * Clients are allowed to subtype this class when creating new kinds of targets. |
| 33 * Instances of this type are used in hashed data structures, so subtypes are | 47 * Instances of this type are used in hashed data structures, so subtypes are |
| 34 * required to correctly implement [==] and [hashCode]. | 48 * required to correctly implement [==] and [hashCode]. |
| 35 */ | 49 */ |
| 36 abstract class AnalysisTarget { | 50 abstract class AnalysisTarget { |
| 37 /** | 51 /** |
| 38 * Return the source associated with this target, or `null` if this target is | 52 * Return the source associated with this target, or `null` if this target is |
| 39 * not associated with a source. | 53 * not associated with a source. |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 * be computed, or `false` if the inputs have been computed. | 373 * be computed, or `false` if the inputs have been computed. |
| 360 * | 374 * |
| 361 * It is safe to invoke [moveNext] after it has returned `false`. In this case | 375 * It is safe to invoke [moveNext] after it has returned `false`. In this case |
| 362 * [moveNext] has no effect and will again return `false`. | 376 * [moveNext] has no effect and will again return `false`. |
| 363 * | 377 * |
| 364 * Throws a [StateError] if the value of the current result has not been | 378 * Throws a [StateError] if the value of the current result has not been |
| 365 * provided using [currentValue]. | 379 * provided using [currentValue]. |
| 366 */ | 380 */ |
| 367 bool moveNext(); | 381 bool moveNext(); |
| 368 } | 382 } |
| OLD | NEW |