Chromium Code Reviews| Index: pkg/barback/lib/src/transformer.dart |
| diff --git a/pkg/barback/lib/src/transformer.dart b/pkg/barback/lib/src/transformer.dart |
| index 2b9499af2b8fa85bdd97f75f93d0eda202598384..acac1fda8ff872410222ead77a0886c3b7903877 100644 |
| --- a/pkg/barback/lib/src/transformer.dart |
| +++ b/pkg/barback/lib/src/transformer.dart |
| @@ -59,15 +59,17 @@ abstract class Transformer { |
| /// If this is not overridden, defaults to allow any asset whose extension |
| /// matches one of the ones returned by [allowedExtensions]. If *that* is |
| /// not overridden, allows all assets. |
| - Future<bool> isPrimary(AssetId id) { |
| + /// |
| + /// This may return either a `bool` or a `Future<bool>`. |
|
Bob Nystrom
2014/04/21 22:32:23
Here too. Make it clear that not returning a futur
nweiz
2014/04/21 22:46:24
Done.
|
| + isPrimary(AssetId id) { |
| // Allow all files if [primaryExtensions] is not overridden. |
| - if (allowedExtensions == null) return new Future.value(true); |
| + if (allowedExtensions == null) return true; |
| for (var extension in allowedExtensions.split(" ")) { |
| - if (id.path.endsWith(extension)) return new Future.value(true); |
| + if (id.path.endsWith(extension)) return true; |
| } |
| - return new Future.value(false); |
| + return false; |
| } |
| /// Run this transformer on on the primary input specified by [transform]. |
| @@ -81,7 +83,10 @@ abstract class Transformer { |
| /// In other words, a Transformer's job is to find all inputs for a |
| /// transform, starting at the primary input, then generate all output assets |
| /// and yield them back to the transform. |
| - Future apply(Transform transform); |
| + /// |
| + /// This may return a [Future]. If it does, it won't be considered finished |
| + /// until that [Future] completes. |
|
Bob Nystrom
2014/04/21 22:32:23
Ditto.
nweiz
2014/04/21 22:46:24
Done.
|
| + apply(Transform transform); |
| String toString() => runtimeType.toString().replaceAll("Transformer", ""); |
| } |