OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 library barback.declaring_transform; |
| 6 |
| 7 import 'asset_id.dart'; |
| 8 import 'base_transform.dart'; |
| 9 import 'transform_logger.dart'; |
| 10 import 'transform_node.dart'; |
| 11 |
| 12 /// A transform for [DeclaringTransform]ers that allows them to declare the ids |
| 13 /// of the outputs they'll generate without generating the concrete bodies of |
| 14 /// those outputs. |
| 15 class DeclaringTransform extends BaseTransform { |
| 16 final Set<AssetId> _outputIds; |
| 17 |
| 18 DeclaringTransform(TransformNode node, this._outputIds, |
| 19 LogFunction logFunction) |
| 20 : super(node, logFunction); |
| 21 |
| 22 /// Stores [id] as the id of an output that will be created by this |
| 23 /// transformation when it's run. |
| 24 /// |
| 25 /// A transformation can declare as many assets as it wants. If |
| 26 /// [DeclaringTransformer.declareOutputs] declareds a given asset id for a |
| 27 /// given input, [Transformer.apply] should emit the corresponding asset as |
| 28 /// well. |
| 29 void declareOutput(AssetId id) { |
| 30 // TODO(nweiz): This should immediately throw if an output with that ID |
| 31 // has already been declared by this transformer. |
| 32 _outputIds.add(id); |
| 33 } |
| 34 } |
OLD | NEW |