Chromium Code Reviews| 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/task/model.dart'; | 13 import 'package:analyzer/task/model.dart'; |
| 13 | 14 |
| 14 /** | 15 /** |
| 15 * The analysis errors associated with a target. | 16 * The analysis errors associated with a target. |
| 16 * | 17 * |
| 17 * The value combines errors represented by multiple other results. | 18 * The value combines errors represented by multiple other results. |
| 18 */ | 19 */ |
| 19 // TODO(brianwilkerson) If we want to associate errors with targets smaller than | 20 // TODO(brianwilkerson) If we want to associate errors with targets smaller than |
| 20 // a file, we will need other contribution points to collect them. In which case | 21 // a file, we will need other contribution points to collect them. In which case |
| 21 // we might want to rename this and/or document that it applies to files. | 22 // we might want to rename this and/or document that it applies to files. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 113 /** | 114 /** |
| 114 * The sources of the Dart files that a library consists of. | 115 * The sources of the Dart files that a library consists of. |
| 115 * | 116 * |
| 116 * The list will include the source of the defining unit and [INCLUDED_PARTS]. | 117 * The list will include the source of the defining unit and [INCLUDED_PARTS]. |
| 117 * So, it is never empty or `null`. | 118 * So, it is never empty or `null`. |
| 118 * | 119 * |
| 119 * The result is only available for targets representing a Dart library. | 120 * The result is only available for targets representing a Dart library. |
| 120 */ | 121 */ |
| 121 final ListResultDescriptor<Source> UNITS = | 122 final ListResultDescriptor<Source> UNITS = |
| 122 new ListResultDescriptor<Source>('UNITS', Source.EMPTY_ARRAY); | 123 new ListResultDescriptor<Source>('UNITS', Source.EMPTY_ARRAY); |
| 124 | |
| 125 /** | |
| 126 * A pair of a library [Source] and a unit [Source] in this library. | |
|
Brian Wilkerson
2015/04/15 21:41:37
Perhaps:
A specific compilation unit in a specifi
scheglov
2015/04/15 23:27:51
Done.
| |
| 127 */ | |
| 128 class LibraryUnitTarget implements AnalysisTarget { | |
|
Brian Wilkerson
2015/04/15 21:41:37
I'd prefer a more meaningful name, but I'm having
scheglov
2015/04/15 23:27:51
Done.
| |
| 129 final Source library; | |
|
Brian Wilkerson
2015/04/15 21:41:37
This needs a comment. Even something as simple as
scheglov
2015/04/15 23:27:51
Done.
| |
| 130 final Source unit; | |
|
Brian Wilkerson
2015/04/15 21:41:37
This needs a comment.
scheglov
2015/04/15 23:27:51
Done.
| |
| 131 | |
| 132 LibraryUnitTarget(this.library, this.unit); | |
|
Brian Wilkerson
2015/04/15 21:41:37
This needs a comment.
scheglov
2015/04/15 23:27:51
Done.
| |
| 133 | |
| 134 @override | |
| 135 int get hashCode { | |
| 136 return JenkinsSmiHash.combine(library.hashCode, unit.hashCode); | |
| 137 } | |
| 138 | |
| 139 @override | |
| 140 Source get source => unit; | |
| 141 | |
| 142 @override | |
| 143 bool operator ==(other) { | |
| 144 return other is LibraryUnitTarget && | |
| 145 other.library == library && | |
| 146 other.unit == unit; | |
| 147 } | |
| 148 } | |
| OLD | NEW |