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

Unified Diff: third_party/pkg/barback-0.13.0/lib/src/base_transform.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/base_transform.dart
diff --git a/pkg/barback/lib/src/transformer/base_transform.dart b/third_party/pkg/barback-0.13.0/lib/src/base_transform.dart
similarity index 60%
copy from pkg/barback/lib/src/transformer/base_transform.dart
copy to third_party/pkg/barback-0.13.0/lib/src/base_transform.dart
index f76a6a481f9e3e436a23a6cdee2ff36af3b9a0ca..bb0183c5d74be119b6a0358a6fc70774dda9b3b8 100644
--- a/pkg/barback/lib/src/transformer/base_transform.dart
+++ b/third_party/pkg/barback-0.13.0/lib/src/base_transform.dart
@@ -2,14 +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.base_transform;
+library barback.base_transform;
import 'dart:async';
-import '../asset/asset_id.dart';
-import '../graph/transform_node.dart';
-import '../log.dart';
+import 'log.dart';
import 'transform_logger.dart';
+import 'transform_node.dart';
/// The base class for the ephemeral transform objects that are passed to
/// transformers.
@@ -19,10 +18,10 @@ import 'transform_logger.dart';
abstract class BaseTransform {
final TransformNode _node;
- /// The ids of primary inputs that should be consumed.
+ /// Whether the primary input should be consumed.
///
- /// This is exposed by [BaseTransformController].
- final _consumedPrimaries = new Set<AssetId>();
+ /// This is exposed via [BaseTransformController].
+ bool _consumePrimary = false;
/// Whether the transformer logged an error.
///
@@ -47,23 +46,21 @@ abstract class BaseTransform {
if (level == LogLevel.ERROR) _loggedError = true;
// If the log isn't already associated with an asset, use the primary.
- if (asset == null) asset = _node.info.primaryId;
+ if (asset == null) asset = _node.primary.id;
var entry = new LogEntry(_node.info, asset, level, message, span);
_onLogController.add(entry);
});
}
- /// Consume a primary input so that it doesn't get processed by future
+ /// Consume the primary input so that it doesn't get processed by future
/// phases or emitted once processing has finished.
///
- /// Normally each primary input will automatically be forwarded unless the
+ /// Normally the primary input will automatically be forwarded unless the
/// transformer overwrites it by emitting an input with the same id. This
- /// allows the transformer to tell barback not to forward a primary input
+ /// allows the transformer to tell barback not to forward the primary input
/// even if it's not overwritten.
- void consumePrimary(AssetId id) {
- // TODO(nweiz): throw an error if an id is consumed that wasn't listed as a
- // primary input.
- _consumedPrimaries.add(id);
+ void consumePrimary() {
+ _consumePrimary = true;
}
}
@@ -75,8 +72,8 @@ abstract class BaseTransformController {
/// The [BaseTransform] controlled by this controller.
final BaseTransform transform;
- /// The ids of primary inputs that should be consumed.
- Set<AssetId> get consumedPrimaries => transform._consumedPrimaries;
+ /// Whether the primary input should be consumed.
+ bool get consumePrimary => transform._consumePrimary;
/// Whether the transform logged an error.
bool get loggedError => transform._loggedError;
@@ -84,29 +81,14 @@ abstract class BaseTransformController {
/// The stream of log entries emitted by the transformer during a run.
Stream<LogEntry> get onLog => transform._onLogController.stream;
- /// Whether the transform's input or id stream has been closed.
- ///
- /// See also [done].
- bool get isDone;
-
BaseTransformController(this.transform);
- /// Mark this transform as finished emitting new inputs or input ids.
- ///
- /// This is distinct from [cancel] in that it *doesn't* indicate that the
- /// transform is finished being used entirely. The transformer may still log
- /// messages and load secondary inputs. This just indicates that all the
- /// primary inputs are accounted for.
- void done();
-
- /// Mark this transform as canceled.
+ /// Notifies the [BaseTransform] that the transformation has finished being
+ /// applied.
///
/// This will close any streams and release any resources that were allocated
- /// for the duration of the transformation. Unlike [done], this indicates that
- /// the transformation is no longer relevant; either it has returned, or
- /// something external has preemptively invalidated its results.
- void cancel() {
- done();
+ /// for the duration of the transformation.
+ void close() {
transform._onLogController.close();
}
}
« no previous file with comments | « third_party/pkg/barback-0.13.0/lib/src/barback_settings.dart ('k') | third_party/pkg/barback-0.13.0/lib/src/build_result.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698