| 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 import 'dart:developer'; | 8 import 'dart:developer'; |
| 9 | 9 |
| 10 import 'package:analyzer/error/error.dart' show AnalysisError; | 10 import 'package:analyzer/error/error.dart' show AnalysisError; |
| 11 import 'package:analyzer/exception/exception.dart'; | 11 import 'package:analyzer/exception/exception.dart'; |
| 12 import 'package:analyzer/src/generated/engine.dart'; | 12 import 'package:analyzer/src/generated/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_general.dart'; | 14 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 15 import 'package:analyzer/src/task/driver.dart'; | 15 import 'package:analyzer/src/task/driver.dart'; |
| 16 import 'package:analyzer/src/task/model.dart'; | 16 import 'package:analyzer/src/task/model.dart'; |
| 17 import 'package:front_end/src/base/analysis_target.dart'; |
| 18 |
| 19 export 'package:front_end/src/base/analysis_target.dart' show AnalysisTarget; |
| 17 | 20 |
| 18 /** | 21 /** |
| 19 * A function that converts the given [key] and [value] into a [TaskInput]. | 22 * A function that converts the given [key] and [value] into a [TaskInput]. |
| 20 */ | 23 */ |
| 21 typedef TaskInput<E> BinaryFunction<K, V, E>(K key, V value); | 24 typedef TaskInput<E> BinaryFunction<K, V, E>(K key, V value); |
| 22 | 25 |
| 23 /** | 26 /** |
| 24 * A function that takes an analysis [context] and an analysis [target] and | 27 * A function that takes an analysis [context] and an analysis [target] and |
| 25 * returns an analysis task. Such functions are passed to a [TaskDescriptor] to | 28 * returns an analysis task. Such functions are passed to a [TaskDescriptor] to |
| 26 * be used to create the described task. | 29 * be used to create the described task. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 AnalysisContextTarget(this.context); | 64 AnalysisContextTarget(this.context); |
| 62 | 65 |
| 63 @override | 66 @override |
| 64 Source get librarySource => null; | 67 Source get librarySource => null; |
| 65 | 68 |
| 66 @override | 69 @override |
| 67 Source get source => null; | 70 Source get source => null; |
| 68 } | 71 } |
| 69 | 72 |
| 70 /** | 73 /** |
| 71 * An object with which an analysis result can be associated. | |
| 72 * | |
| 73 * Clients may implement this class when creating new kinds of targets. | |
| 74 * Instances of this type are used in hashed data structures, so subtypes are | |
| 75 * required to correctly implement [==] and [hashCode]. | |
| 76 */ | |
| 77 abstract class AnalysisTarget { | |
| 78 /** | |
| 79 * If this target is associated with a library, return the source of the | |
| 80 * library's defining compilation unit; otherwise return `null`. | |
| 81 */ | |
| 82 Source get librarySource; | |
| 83 | |
| 84 /** | |
| 85 * Return the source associated with this target, or `null` if this target is | |
| 86 * not associated with a source. | |
| 87 */ | |
| 88 Source get source; | |
| 89 } | |
| 90 | |
| 91 /** | |
| 92 * An object used to compute one or more analysis results associated with a | 74 * An object used to compute one or more analysis results associated with a |
| 93 * single target. | 75 * single target. |
| 94 * | 76 * |
| 95 * Clients must extend this class when creating new tasks. | 77 * Clients must extend this class when creating new tasks. |
| 96 */ | 78 */ |
| 97 abstract class AnalysisTask { | 79 abstract class AnalysisTask { |
| 98 /** | 80 /** |
| 99 * A queue storing the last 10 task descriptions for diagnostic purposes. | 81 * A queue storing the last 10 task descriptions for diagnostic purposes. |
| 100 */ | 82 */ |
| 101 static final LimitedQueue<String> LAST_TASKS = new LimitedQueue<String>(10); | 83 static final LimitedQueue<String> LAST_TASKS = new LimitedQueue<String>(10); |
| (...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 /** | 777 /** |
| 796 * A work should be done, but without any special urgency. | 778 * A work should be done, but without any special urgency. |
| 797 */ | 779 */ |
| 798 NORMAL, | 780 NORMAL, |
| 799 | 781 |
| 800 /** | 782 /** |
| 801 * Nothing to do. | 783 * Nothing to do. |
| 802 */ | 784 */ |
| 803 NONE | 785 NONE |
| 804 } | 786 } |
| OLD | NEW |