OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 barback.errors; | 5 library barback.errors; |
6 | 6 |
7 import 'package:stack_trace/stack_trace.dart'; | 7 import 'package:stack_trace/stack_trace.dart'; |
8 | 8 |
9 import 'asset/asset_id.dart'; | 9 import 'asset_id.dart'; |
10 import 'transformer/wrapping_aggregate_transformer.dart'; | 10 import 'transformer.dart'; |
11 import 'utils.dart'; | 11 import 'utils.dart'; |
12 | 12 |
13 /// Error thrown when an asset with [id] cannot be found. | 13 /// Error thrown when an asset with [id] cannot be found. |
14 class AssetNotFoundException implements Exception { | 14 class AssetNotFoundException implements Exception { |
15 final AssetId id; | 15 final AssetId id; |
16 | 16 |
17 AssetNotFoundException(this.id); | 17 AssetNotFoundException(this.id); |
18 | 18 |
19 String toString() => "Could not find asset $id."; | 19 String toString() => "Could not find asset $id."; |
20 } | 20 } |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 } | 160 } |
161 | 161 |
162 /// Information about a single transform in the barback graph. | 162 /// Information about a single transform in the barback graph. |
163 /// | 163 /// |
164 /// Identifies a single transformation in the barback graph. | 164 /// Identifies a single transformation in the barback graph. |
165 /// | 165 /// |
166 /// A transformation is uniquely identified by the ID of its primary input, and | 166 /// A transformation is uniquely identified by the ID of its primary input, and |
167 /// the transformer that is applied to it. | 167 /// the transformer that is applied to it. |
168 class TransformInfo { | 168 class TransformInfo { |
169 /// The transformer that's run for this transform. | 169 /// The transformer that's run for this transform. |
170 /// | 170 final Transformer transformer; |
171 /// This may be a [Transformer] or a [WrappingAggregateTransformer]. It may | |
172 /// also return additional types in the future. | |
173 final transformer; | |
174 | 171 |
175 /// The id of this transform's primary asset. | 172 /// The id of this transform's primary asset. |
176 final AssetId primaryId; | 173 final AssetId primaryId; |
177 | 174 |
178 TransformInfo(transformer, this.primaryId) | 175 TransformInfo(this.transformer, this.primaryId); |
179 : transformer = transformer is WrappingAggregateTransformer ? | |
180 transformer.transformer : transformer; | |
181 | 176 |
182 bool operator==(other) => | 177 bool operator==(other) => |
183 other is TransformInfo && | 178 other is TransformInfo && |
184 other.transformer == transformer && | 179 other.transformer == transformer && |
185 other.primaryId == primaryId; | 180 other.primaryId == primaryId; |
186 | 181 |
187 int get hashCode => transformer.hashCode ^ primaryId.hashCode; | 182 int get hashCode => transformer.hashCode ^ primaryId.hashCode; |
188 | 183 |
189 String toString() => "$transformer on $primaryId"; | 184 String toString() => "$transformer on $primaryId"; |
190 } | 185 } |
OLD | NEW |