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

Unified Diff: pkg/barback/lib/src/transform_node.dart

Issue 195993005: Don't pass an asset through a transformer that produces an error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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: pkg/barback/lib/src/transform_node.dart
diff --git a/pkg/barback/lib/src/transform_node.dart b/pkg/barback/lib/src/transform_node.dart
index 0d1e5f2342941f8f735d02df1777c8a4c1c1ad89..e3e122c7dbc9e17bf6be6cabab8190c19a90e2ca 100644
--- a/pkg/barback/lib/src/transform_node.dart
+++ b/pkg/barback/lib/src/transform_node.dart
@@ -128,9 +128,7 @@ class TransformNode {
_onDoneController.close();
_primarySubscription.cancel();
_clearInputSubscriptions();
- for (var controller in _outputControllers.values) {
- controller.setRemoved();
- }
+ _clearOutputs();
if (_passThroughController != null) {
_passThroughController.setRemoved();
_passThroughController = null;
@@ -204,7 +202,8 @@ class TransformNode {
} else if (isPrimary) {
_apply();
} else {
- _doesNotApply();
+ _clearOutputs();
+ _emitPassThrough();
_state = _TransformNodeState.NOT_PRIMARY;
_onDoneController.add(null);
}
@@ -240,7 +239,8 @@ class TransformNode {
// is so a broken transformer doesn't take down the whole graph.
phase.cascade.reportError(error);
- _doesNotApply();
+ _clearOutputs();
+ _dontEmitPassThrough();
}).then((_) {
if (_isRemoved) return;
@@ -385,17 +385,13 @@ class TransformNode {
_inputSubscriptions.clear();
}
- /// Marks this transformer as not applying to [primary].
- ///
- /// This might be because [primary] isn't primary for [transformer], or
- /// because [transformer] threw an error during [transformer.apply].
- void _doesNotApply() {
+ /// Removes all output assets.
+ void _clearOutputs() {
// Remove all the previously-emitted assets.
for (var controller in _outputControllers.values) {
controller.setRemoved();
}
_outputControllers.clear();
- _emitPassThrough();
}
/// Emit the pass-through asset if it's not being emitted already.

Powered by Google App Engine
This is Rietveld 408576698