Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: pkg/barback/lib/src/declaring_transform.dart

Issue 261823008: Reorganize barback's source files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: re-add barback/lib/src/internal_asset.dart Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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_node.dart';
10
11 /// A transform for [DeclaringTransform]ers that allows them to declare the ids
12 /// of the outputs they'll generate without generating the concrete bodies of
13 /// those outputs.
14 class DeclaringTransform extends BaseTransform {
15 final _outputIds = new Set<AssetId>();
16
17 final AssetId primaryId;
18
19 DeclaringTransform._(TransformNode node)
20 : primaryId = node.primary.id,
21 super(node);
22
23 /// Stores [id] as the id of an output that will be created by this
24 /// transformation when it's run.
25 ///
26 /// A transformation can declare as many assets as it wants. If
27 /// [DeclaringTransformer.declareOutputs] declareds a given asset id for a
28 /// given input, [Transformer.apply] should emit the corresponding asset as
29 /// well.
30 void declareOutput(AssetId id) {
31 // TODO(nweiz): This should immediately throw if an output with that ID
32 // has already been declared by this transformer.
33 _outputIds.add(id);
34 }
35 }
36
37 /// The controller for [DeclaringTransform].
38 class DeclaringTransformController extends BaseTransformController {
39 DeclaringTransform get transform => super.transform;
40
41 /// The set of ids that the transformer declares it will emit for the given
42 /// primary input.
43 Set<AssetId> get outputIds => transform._outputIds;
44
45 DeclaringTransformController(TransformNode node)
46 : super(new DeclaringTransform._(node));
47 }
OLDNEW
« no previous file with comments | « pkg/barback/lib/src/cancelable_future.dart ('k') | pkg/barback/lib/src/declaring_transformer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698