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

Unified Diff: third_party/pkg/barback-0.13.0/lib/src/transformer.dart

Issue 291843011: Run pub tests against older versions of barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review 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 side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/barback-0.13.0/lib/src/transformer.dart
diff --git a/pkg/barback/lib/src/transformer/transformer.dart b/third_party/pkg/barback-0.13.0/lib/src/transformer.dart
similarity index 85%
copy from pkg/barback/lib/src/transformer/transformer.dart
copy to third_party/pkg/barback-0.13.0/lib/src/transformer.dart
index b40d61de37c07c2d78925e5ecdccf80df6cb6905..2b9499af2b8fa85bdd97f75f93d0eda202598384 100644
--- a/pkg/barback/lib/src/transformer/transformer.dart
+++ b/third_party/pkg/barback-0.13.0/lib/src/transformer.dart
@@ -2,13 +2,13 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library barback.transformer.transformer;
+library barback.transformer;
import 'dart:async';
-import '../asset/asset_id.dart';
-import '../utils.dart';
+import 'asset_id.dart';
import 'transform.dart';
+import 'utils.dart';
/// A [Transformer] represents a processor that takes in one or more input
/// assets and uses them to generate one or more output assets.
@@ -59,21 +59,18 @@ 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.
- ///
- /// This may return a `Future<bool>` or, if it's entirely synchronous, a
- /// `bool`.
- isPrimary(AssetId id) {
+ Future<bool> isPrimary(AssetId id) {
// Allow all files if [primaryExtensions] is not overridden.
- if (allowedExtensions == null) return true;
+ if (allowedExtensions == null) return new Future.value(true);
for (var extension in allowedExtensions.split(" ")) {
- if (id.path.endsWith(extension)) return true;
+ if (id.path.endsWith(extension)) return new Future.value(true);
}
- return false;
+ return new Future.value(false);
}
- /// Run this transformer on the primary input specified by [transform].
+ /// Run this transformer on on the primary input specified by [transform].
///
/// The [transform] is used by the [Transformer] for two purposes (in
/// addition to accessing the primary input). It can call `getInput()` to
@@ -84,10 +81,7 @@ 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.
- ///
- /// If this does asynchronous work, it should return a [Future] that completes
- /// once it's finished.
- apply(Transform transform);
+ Future apply(Transform transform);
String toString() => runtimeType.toString().replaceAll("Transformer", "");
}

Powered by Google App Engine
This is Rietveld 408576698