| 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.dart; | 5 library analyzer.task.dart; |
| 6 | 6 |
| 7 import 'package:analyzer/src/generated/ast.dart'; | 7 import 'package:analyzer/src/generated/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/src/generated/element.dart'; |
| 9 import 'package:analyzer/src/generated/error.dart'; | 9 import 'package:analyzer/src/generated/error.dart'; |
| 10 import 'package:analyzer/src/generated/scanner.dart'; | 10 import 'package:analyzer/src/generated/scanner.dart'; |
| 11 import 'package:analyzer/src/generated/source.dart'; | 11 import 'package:analyzer/src/generated/source.dart'; |
| 12 import 'package:analyzer/src/generated/utilities_general.dart'; | 12 import 'package:analyzer/src/generated/utilities_general.dart'; |
| 13 import 'package:analyzer/src/task/dart.dart'; | 13 import 'package:analyzer/src/task/dart.dart'; |
| 14 import 'package:analyzer/task/model.dart'; | 14 import 'package:analyzer/task/model.dart'; |
| 15 | 15 |
| 16 /** | 16 /** |
| 17 * The analysis errors associated with a target. | 17 * The analysis errors associated with a [Source] representing a compilation |
| 18 * | 18 * unit. |
| 19 * The result is only available for targets representing a Dart compilation unit
. | |
| 20 */ | 19 */ |
| 21 final ListResultDescriptor<AnalysisError> DART_ERRORS = | 20 final ListResultDescriptor<AnalysisError> DART_ERRORS = |
| 22 new ListResultDescriptor<AnalysisError>( | 21 new ListResultDescriptor<AnalysisError>( |
| 23 'DART_ERRORS', AnalysisError.NO_ERRORS); | 22 'DART_ERRORS', AnalysisError.NO_ERRORS); |
| 24 | 23 |
| 25 /** | 24 /** |
| 26 * The sources of the libraries that are explicitly imported into a library. | 25 * The sources of the libraries that are explicitly imported into a library. |
| 27 * | 26 * |
| 28 * The list will be empty if there are no explicit imports, but will not be | 27 * The list will be empty if there are no explicit imports, but will not be |
| 29 * `null`. | 28 * `null`. |
| 30 * | 29 * |
| 31 * The result is only available for targets representing a Dart library. | 30 * The result is only available for [Source]s representing a library. |
| 32 */ | 31 */ |
| 33 final ListResultDescriptor<Source> EXPLICITLY_IMPORTED_LIBRARIES = | 32 final ListResultDescriptor<Source> EXPLICITLY_IMPORTED_LIBRARIES = |
| 34 new ListResultDescriptor<Source>( | 33 new ListResultDescriptor<Source>( |
| 35 'EXPLICITLY_IMPORTED_LIBRARIES', Source.EMPTY_LIST); | 34 'EXPLICITLY_IMPORTED_LIBRARIES', Source.EMPTY_LIST); |
| 36 | 35 |
| 37 /** | 36 /** |
| 38 * The sources of the libraries that are exported from a library. | 37 * The sources of the libraries that are exported from a library. |
| 39 * | 38 * |
| 40 * The list will be empty if there are no exported libraries, but will not be | 39 * The list will be empty if there are no exported libraries, but will not be |
| 41 * `null`. | 40 * `null`. |
| 42 * | 41 * |
| 43 * The result is only available for targets representing a Dart library. | 42 * The result is only available for [Source]s representing a library. |
| 44 */ | 43 */ |
| 45 final ListResultDescriptor<Source> EXPORTED_LIBRARIES = | 44 final ListResultDescriptor<Source> EXPORTED_LIBRARIES = |
| 46 new ListResultDescriptor<Source>('EXPORTED_LIBRARIES', Source.EMPTY_LIST); | 45 new ListResultDescriptor<Source>('EXPORTED_LIBRARIES', Source.EMPTY_LIST); |
| 47 | 46 |
| 48 /** | 47 /** |
| 49 * The sources of the libraries that are implicitly or explicitly imported into | 48 * The sources of the libraries that are implicitly or explicitly imported into |
| 50 * a library. | 49 * a library. |
| 51 * | 50 * |
| 52 * The list will minimally contain the source for `dart:core` because it is | 51 * The list will minimally contain the source for `dart:core` because it is |
| 53 * implicitly imported into every library, and therefore will never be `null`. | 52 * implicitly imported into every library, and therefore will never be `null`. |
| 54 * | 53 * |
| 55 * The result is only available for targets representing a Dart library. | 54 * The result is only available for [Source]s representing a library. |
| 56 */ | 55 */ |
| 57 final ListResultDescriptor<Source> IMPORTED_LIBRARIES = | 56 final ListResultDescriptor<Source> IMPORTED_LIBRARIES = |
| 58 new ListResultDescriptor<Source>('IMPORTED_LIBRARIES', Source.EMPTY_LIST); | 57 new ListResultDescriptor<Source>('IMPORTED_LIBRARIES', Source.EMPTY_LIST); |
| 59 | 58 |
| 60 /** | 59 /** |
| 61 * The sources of the parts that are included in a library. | 60 * The sources of the parts that are included in a library. |
| 62 * | 61 * |
| 63 * The list will be empty if there are no parts, but will not be `null`. The | 62 * The list will be empty if there are no parts, but will not be `null`. The |
| 64 * list does *not* include the source for the defining compilation unit. | 63 * list does *not* include the source for the defining compilation unit. |
| 65 * | 64 * |
| 66 * The result is only available for targets representing a Dart library. | 65 * The result is only available for [Source]s representing a library. |
| 67 */ | 66 */ |
| 68 final ListResultDescriptor<Source> INCLUDED_PARTS = | 67 final ListResultDescriptor<Source> INCLUDED_PARTS = |
| 69 new ListResultDescriptor<Source>('INCLUDED_PARTS', Source.EMPTY_LIST); | 68 new ListResultDescriptor<Source>('INCLUDED_PARTS', Source.EMPTY_LIST); |
| 70 | 69 |
| 71 /** | 70 /** |
| 72 * A flag specifying whether a library is dependent on code that is only | 71 * A flag specifying whether a library is dependent on code that is only |
| 73 * available in a client. | 72 * available in a client. |
| 74 * | 73 * |
| 75 * The result is only available for targets representing a Dart library. | 74 * The result is only available for [Source]s representing a library. |
| 76 */ | 75 */ |
| 77 final ResultDescriptor<bool> IS_CLIENT = | 76 final ResultDescriptor<bool> IS_CLIENT = |
| 78 new ResultDescriptor<bool>('IS_CLIENT', false); | 77 new ResultDescriptor<bool>('IS_CLIENT', false); |
| 79 | 78 |
| 80 /** | 79 /** |
| 81 * A flag specifying whether a library is launchable. | 80 * A flag specifying whether a library is launchable. |
| 82 * | 81 * |
| 83 * The result is only available for targets representing a Dart library. | 82 * The result is only available for [Source]s representing a library. |
| 84 */ | 83 */ |
| 85 final ResultDescriptor<bool> IS_LAUNCHABLE = | 84 final ResultDescriptor<bool> IS_LAUNCHABLE = |
| 86 new ResultDescriptor<bool>('IS_LAUNCHABLE', false); | 85 new ResultDescriptor<bool>('IS_LAUNCHABLE', false); |
| 87 | 86 |
| 88 /** | 87 /** |
| 89 * The fully built [LibraryElement] associated with a library. | 88 * The fully built [LibraryElement] associated with a library. |
| 90 * | 89 * |
| 91 * The result is only available for targets representing a Dart library. | 90 * The result is only available for [Source]s representing a library. |
| 92 */ | 91 */ |
| 93 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT = | 92 final ResultDescriptor<LibraryElement> LIBRARY_ELEMENT = |
| 94 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT', null); | 93 new ResultDescriptor<LibraryElement>('LIBRARY_ELEMENT', null); |
| 95 | 94 |
| 96 /** | 95 /** |
| 97 * The compilation unit AST produced while parsing a compilation unit. | 96 * The compilation unit AST produced while parsing a compilation unit. |
| 98 * | 97 * |
| 99 * The AST structure will not have resolution information associated with it. | 98 * The AST structure will not have resolution information associated with it. |
| 100 * | 99 * |
| 101 * The result is only available for targets representing a Dart compilation unit
. | 100 * The result is only available for [Source]s representing a compilation unit. |
| 102 */ | 101 */ |
| 103 final ResultDescriptor<CompilationUnit> PARSED_UNIT = | 102 final ResultDescriptor<CompilationUnit> PARSED_UNIT = |
| 104 new ResultDescriptor<CompilationUnit>('PARSED_UNIT', null, | 103 new ResultDescriptor<CompilationUnit>('PARSED_UNIT', null, |
| 105 cachingPolicy: AST_CACHING_POLICY); | 104 cachingPolicy: AST_CACHING_POLICY); |
| 106 | 105 |
| 107 /** | 106 /** |
| 108 * The resolved [CompilationUnit] associated with a unit. | 107 * The resolved [CompilationUnit] associated with a compilation unit. |
| 109 * | 108 * |
| 110 * The result is only available for targets representing a unit. | 109 * The result is only available for [LibrarySpecificUnit]s. |
| 111 */ | 110 */ |
| 112 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT = | 111 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT = |
| 113 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT', null, | 112 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT', null, |
| 114 cachingPolicy: AST_CACHING_POLICY); | 113 cachingPolicy: AST_CACHING_POLICY); |
| 115 | 114 |
| 116 /** | 115 /** |
| 116 * The kind of a [Source]. |
| 117 */ |
| 118 final ResultDescriptor<SourceKind> SOURCE_KIND = |
| 119 new ResultDescriptor<SourceKind>('SOURCE_KIND', SourceKind.UNKNOWN); |
| 120 |
| 121 /** |
| 117 * The token stream produced while scanning a compilation unit. | 122 * The token stream produced while scanning a compilation unit. |
| 118 * | 123 * |
| 119 * The value is the first token in the file, or the special end-of-file marker | 124 * The value is the first token in the file, or the special end-of-file marker |
| 120 * at the end of the stream if the file does not contain any tokens. | 125 * at the end of the stream if the file does not contain any tokens. |
| 121 * | 126 * |
| 122 * The result is only available for targets representing a Dart compilation unit
. | 127 * The result is only available for [Source]s representing a compilation unit. |
| 123 */ | 128 */ |
| 124 final ResultDescriptor<Token> TOKEN_STREAM = new ResultDescriptor<Token>( | 129 final ResultDescriptor<Token> TOKEN_STREAM = new ResultDescriptor<Token>( |
| 125 'TOKEN_STREAM', null, cachingPolicy: TOKEN_STREAM_CACHING_POLICY); | 130 'TOKEN_STREAM', null, cachingPolicy: TOKEN_STREAM_CACHING_POLICY); |
| 126 | 131 |
| 127 /** | 132 /** |
| 128 * The sources of the Dart files that a library consists of. | 133 * The sources of the Dart files that a library consists of. |
| 129 * | 134 * |
| 130 * The list will include the source of the defining unit and [INCLUDED_PARTS]. | 135 * The list will include the source of the defining unit and [INCLUDED_PARTS]. |
| 131 * So, it is never empty or `null`. | 136 * So, it is never empty or `null`. |
| 132 * | 137 * |
| 133 * The result is only available for targets representing a Dart library. | 138 * The result is only available for [Source]s representing a library. |
| 134 */ | 139 */ |
| 135 final ListResultDescriptor<Source> UNITS = | 140 final ListResultDescriptor<Source> UNITS = |
| 136 new ListResultDescriptor<Source>('UNITS', Source.EMPTY_LIST); | 141 new ListResultDescriptor<Source>('UNITS', Source.EMPTY_LIST); |
| 137 | 142 |
| 138 /** | 143 /** |
| 139 * A specific compilation unit in a specific library. | 144 * A specific compilation unit in a specific library. |
| 140 * | 145 * |
| 141 * This kind of target is associated with information about a compilation unit | 146 * This kind of target is associated with information about a compilation unit |
| 142 * that differs based on the library that the unit is a part of. For example, | 147 * that differs based on the library that the unit is a part of. For example, |
| 143 * the result of resolving a compilation unit depends on the imports, which can | 148 * the result of resolving a compilation unit depends on the imports, which can |
| (...skipping 27 matching lines...) Expand all Loading... |
| 171 @override | 176 @override |
| 172 bool operator ==(other) { | 177 bool operator ==(other) { |
| 173 return other is LibrarySpecificUnit && | 178 return other is LibrarySpecificUnit && |
| 174 other.library == library && | 179 other.library == library && |
| 175 other.unit == unit; | 180 other.unit == unit; |
| 176 } | 181 } |
| 177 | 182 |
| 178 @override | 183 @override |
| 179 String toString() => '$unit in $library'; | 184 String toString() => '$unit in $library'; |
| 180 } | 185 } |
| OLD | NEW |