| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 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 | 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.transform; | 5 library barback.transform; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 | 9 |
| 10 import 'asset.dart'; | 10 import 'asset.dart'; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return _node.primary.asset; | 50 return _node.primary.asset; |
| 51 } | 51 } |
| 52 | 52 |
| 53 Transform._(TransformNode node) | 53 Transform._(TransformNode node) |
| 54 : _node = node, | 54 : _node = node, |
| 55 super(node); | 55 super(node); |
| 56 | 56 |
| 57 /// Gets the asset for an input [id]. | 57 /// Gets the asset for an input [id]. |
| 58 /// | 58 /// |
| 59 /// If an input with [id] cannot be found, throws an [AssetNotFoundException]. | 59 /// If an input with [id] cannot be found, throws an [AssetNotFoundException]. |
| 60 Future<Asset> getInput(AssetId id) => _node.getInput(id); | 60 Future<Asset> getInput(AssetId id) { |
| 61 if (id == _node.primary.id) return syncFuture(() => primaryInput); |
| 62 return _node.getInput(id); |
| 63 } |
| 61 | 64 |
| 62 /// A convenience method to the contents of the input with [id] as a string. | 65 /// A convenience method to the contents of the input with [id] as a string. |
| 63 /// | 66 /// |
| 64 /// This is equivalent to calling [getInput] followed by [Asset.readAsString]. | 67 /// This is equivalent to calling [getInput] followed by [Asset.readAsString]. |
| 65 /// | 68 /// |
| 66 /// If the asset was created from a [String] the original string is always | 69 /// If the asset was created from a [String] the original string is always |
| 67 /// returned and [encoding] is ignored. Otherwise, the binary data of the | 70 /// returned and [encoding] is ignored. Otherwise, the binary data of the |
| 68 /// asset is decoded using [encoding], which defaults to [UTF8]. | 71 /// asset is decoded using [encoding], which defaults to [UTF8]. |
| 69 /// | 72 /// |
| 70 /// If an input with [id] cannot be found, throws an [AssetNotFoundException]. | 73 /// If an input with [id] cannot be found, throws an [AssetNotFoundException]. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 /// The controller for [Transform]. | 110 /// The controller for [Transform]. |
| 108 class TransformController extends BaseTransformController { | 111 class TransformController extends BaseTransformController { |
| 109 Transform get transform => super.transform; | 112 Transform get transform => super.transform; |
| 110 | 113 |
| 111 /// The set of assets that the transformer has emitted. | 114 /// The set of assets that the transformer has emitted. |
| 112 AssetSet get outputs => transform._outputs; | 115 AssetSet get outputs => transform._outputs; |
| 113 | 116 |
| 114 TransformController(TransformNode node) | 117 TransformController(TransformNode node) |
| 115 : super(new Transform._(node)); | 118 : super(new Transform._(node)); |
| 116 } | 119 } |
| OLD | NEW |