| 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/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/src/generated/element.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/src/generated/error.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/src/generated/scanner.dart'; | 10 import 'package:analyzer/error/error.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 [Source] representing a compilation | 17 * The analysis errors associated with a [Source] representing a compilation |
| 18 * unit. | 18 * unit. |
| 19 */ | 19 */ |
| 20 final ListResultDescriptor<AnalysisError> DART_ERRORS = | 20 final ListResultDescriptor<AnalysisError> DART_ERRORS = |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 * | 61 * |
| 62 * 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 |
| 63 * list does *not* include the source for the defining compilation unit. | 63 * list does *not* include the source for the defining compilation unit. |
| 64 * | 64 * |
| 65 * The result is only available for [Source]s representing a library. | 65 * The result is only available for [Source]s representing a library. |
| 66 */ | 66 */ |
| 67 final ListResultDescriptor<Source> INCLUDED_PARTS = | 67 final ListResultDescriptor<Source> INCLUDED_PARTS = |
| 68 new ListResultDescriptor<Source>('INCLUDED_PARTS', Source.EMPTY_LIST); | 68 new ListResultDescriptor<Source>('INCLUDED_PARTS', Source.EMPTY_LIST); |
| 69 | 69 |
| 70 /** | 70 /** |
| 71 * A flag specifying whether a library is dependent on code that is only | |
| 72 * available in a client. | |
| 73 * | |
| 74 * The result is only available for [Source]s representing a library. | |
| 75 */ | |
| 76 final ResultDescriptor<bool> IS_CLIENT = | |
| 77 new ResultDescriptor<bool>('IS_CLIENT', false); | |
| 78 | |
| 79 /** | |
| 80 * A flag specifying whether a library is launchable. | 71 * A flag specifying whether a library is launchable. |
| 81 * | 72 * |
| 82 * The result is only available for [Source]s representing a library. | 73 * The result is only available for [Source]s representing a library. |
| 83 */ | 74 */ |
| 84 final ResultDescriptor<bool> IS_LAUNCHABLE = | 75 final ResultDescriptor<bool> IS_LAUNCHABLE = |
| 85 new ResultDescriptor<bool>('IS_LAUNCHABLE', false); | 76 new ResultDescriptor<bool>('IS_LAUNCHABLE', false); |
| 86 | 77 |
| 87 /** | 78 /** |
| 88 * The fully built [LibraryElement] associated with a library. | 79 * The fully built [LibraryElement] associated with a library. |
| 89 * | 80 * |
| (...skipping 14 matching lines...) Expand all Loading... |
| 104 cachingPolicy: AST_CACHING_POLICY); | 95 cachingPolicy: AST_CACHING_POLICY); |
| 105 | 96 |
| 106 /** | 97 /** |
| 107 * The resolved [CompilationUnit] associated with a compilation unit, with | 98 * The resolved [CompilationUnit] associated with a compilation unit, with |
| 108 * constants resolved. | 99 * constants resolved. |
| 109 * | 100 * |
| 110 * The result is only available for [LibrarySpecificUnit]s. | 101 * The result is only available for [LibrarySpecificUnit]s. |
| 111 */ | 102 */ |
| 112 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT = | 103 final ResultDescriptor<CompilationUnit> RESOLVED_UNIT = |
| 113 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT', null, | 104 new ResultDescriptor<CompilationUnit>('RESOLVED_UNIT', null, |
| 114 cachingPolicy: AST_CACHING_POLICY); | 105 cachingPolicy: AST_RESOLVED_CACHING_POLICY); |
| 115 | 106 |
| 116 /** | 107 /** |
| 117 * The kind of a [Source]. | 108 * The kind of a [Source]. |
| 118 */ | 109 */ |
| 119 final ResultDescriptor<SourceKind> SOURCE_KIND = | 110 final ResultDescriptor<SourceKind> SOURCE_KIND = |
| 120 new ResultDescriptor<SourceKind>('SOURCE_KIND', SourceKind.UNKNOWN); | 111 new ResultDescriptor<SourceKind>('SOURCE_KIND', SourceKind.UNKNOWN); |
| 121 | 112 |
| 122 /** | 113 /** |
| 123 * The token stream produced while scanning a compilation unit. | 114 * The token stream produced while scanning a compilation unit. |
| 124 * | 115 * |
| (...skipping 19 matching lines...) Expand all Loading... |
| 144 | 135 |
| 145 /** | 136 /** |
| 146 * A specific compilation unit in a specific library. | 137 * A specific compilation unit in a specific library. |
| 147 * | 138 * |
| 148 * This kind of target is associated with information about a compilation unit | 139 * This kind of target is associated with information about a compilation unit |
| 149 * that differs based on the library that the unit is a part of. For example, | 140 * that differs based on the library that the unit is a part of. For example, |
| 150 * the result of resolving a compilation unit depends on the imports, which can | 141 * the result of resolving a compilation unit depends on the imports, which can |
| 151 * change if a single part is included in more than one library. | 142 * change if a single part is included in more than one library. |
| 152 */ | 143 */ |
| 153 class LibrarySpecificUnit implements AnalysisTarget { | 144 class LibrarySpecificUnit implements AnalysisTarget { |
| 145 static const List<LibrarySpecificUnit> EMPTY_LIST = |
| 146 const <LibrarySpecificUnit>[]; |
| 147 |
| 154 /** | 148 /** |
| 155 * The defining compilation unit of the library in which the [unit] | 149 * The defining compilation unit of the library in which the [unit] |
| 156 * is analyzed. | 150 * is analyzed. |
| 157 */ | 151 */ |
| 158 final Source library; | 152 final Source library; |
| 159 | 153 |
| 160 /** | 154 /** |
| 161 * The compilation unit which belongs to the [library]. | 155 * The compilation unit which belongs to the [library]. |
| 162 */ | 156 */ |
| 163 final Source unit; | 157 final Source unit; |
| 164 | 158 |
| 165 /** | 159 /** |
| 166 * Initialize a newly created target for the [unit] in the [library]. | 160 * Initialize a newly created target for the [unit] in the [library]. |
| 167 */ | 161 */ |
| 168 LibrarySpecificUnit(this.library, this.unit); | 162 LibrarySpecificUnit(this.library, this.unit); |
| 169 | 163 |
| 170 @override | 164 @override |
| 171 int get hashCode { | 165 int get hashCode { |
| 172 return JenkinsSmiHash.combine(library.hashCode, unit.hashCode); | 166 return JenkinsSmiHash.combine(library.hashCode, unit.hashCode); |
| 173 } | 167 } |
| 174 | 168 |
| 175 @override | 169 @override |
| 170 Source get librarySource => library; |
| 171 |
| 172 @override |
| 176 Source get source => unit; | 173 Source get source => unit; |
| 177 | 174 |
| 178 @override | 175 @override |
| 179 bool operator ==(other) { | 176 bool operator ==(other) { |
| 180 return other is LibrarySpecificUnit && | 177 return other is LibrarySpecificUnit && |
| 181 other.library == library && | 178 other.library == library && |
| 182 other.unit == unit; | 179 other.unit == unit; |
| 183 } | 180 } |
| 184 | 181 |
| 185 @override | 182 @override |
| 186 String toString() => '$unit in $library'; | 183 String toString() => '$unit in $library'; |
| 187 } | 184 } |
| OLD | NEW |