| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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_node; | 5 library barback.transform_node; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'asset.dart'; | 9 import 'asset.dart'; |
| 10 import 'asset_id.dart'; | 10 import 'asset_id.dart'; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 TransformNode(this.phase, Transformer transformer, AssetNode primary, | 132 TransformNode(this.phase, Transformer transformer, AssetNode primary, |
| 133 this._location) | 133 this._location) |
| 134 : transformer = transformer, | 134 : transformer = transformer, |
| 135 primary = primary, | 135 primary = primary, |
| 136 deferred = transformer is LazyTransformer || | 136 deferred = transformer is LazyTransformer || |
| 137 (transformer is DeclaringTransformer && primary.deferred) { | 137 (transformer is DeclaringTransformer && primary.deferred) { |
| 138 _awaitingForce = deferred; | 138 _awaitingForce = deferred; |
| 139 | 139 |
| 140 _onLogPool.add(_onLogController.stream); | 140 _onLogPool.add(_onLogController.stream); |
| 141 | 141 |
| 142 if (!deferred) primary.force(); | |
| 143 | |
| 144 _primarySubscription = primary.onStateChange.listen((state) { | 142 _primarySubscription = primary.onStateChange.listen((state) { |
| 145 if (state.isRemoved) { | 143 if (state.isRemoved) { |
| 146 remove(); | 144 remove(); |
| 147 } else { | 145 } else { |
| 148 if (state.isDirty && !deferred) primary.force(); | 146 if (state.isDirty && !deferred) primary.force(); |
| 149 _dirty(); | 147 _dirty(); |
| 150 } | 148 } |
| 151 }); | 149 }); |
| 152 | 150 |
| 153 _phaseSubscription = phase.previous.onAsset.listen((node) { | 151 _phaseSubscription = phase.previous.onAsset.listen((node) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 if (_isRemoved) return false; | 244 if (_isRemoved) return false; |
| 247 | 245 |
| 248 // Catch all transformer errors and pipe them to the results stream. This | 246 // Catch all transformer errors and pipe them to the results stream. This |
| 249 // is so a broken transformer doesn't take down the whole graph. | 247 // is so a broken transformer doesn't take down the whole graph. |
| 250 phase.cascade.reportError(_wrapException(error, stackTrace)); | 248 phase.cascade.reportError(_wrapException(error, stackTrace)); |
| 251 | 249 |
| 252 return false; | 250 return false; |
| 253 }).then((isPrimary) { | 251 }).then((isPrimary) { |
| 254 if (_isRemoved) return null; | 252 if (_isRemoved) return null; |
| 255 if (isPrimary) { | 253 if (isPrimary) { |
| 254 if (!deferred) primary.force(); |
| 256 return _declareOutputs().then((_) { | 255 return _declareOutputs().then((_) { |
| 257 if (_isRemoved) return; | 256 if (_isRemoved) return; |
| 258 if (_awaitingForce) { | 257 if (_awaitingForce) { |
| 259 _state = _State.DECLARED; | 258 _state = _State.DECLARED; |
| 260 _onDoneController.add(null); | 259 _onDoneController.add(null); |
| 261 } else { | 260 } else { |
| 262 _apply(); | 261 _apply(); |
| 263 } | 262 } |
| 264 }); | 263 }); |
| 265 } | 264 } |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 /// | 556 /// |
| 558 /// This will never transition to another state. | 557 /// This will never transition to another state. |
| 559 static final NOT_PRIMARY = const _State._("not primary"); | 558 static final NOT_PRIMARY = const _State._("not primary"); |
| 560 | 559 |
| 561 final String name; | 560 final String name; |
| 562 | 561 |
| 563 const _State._(this.name); | 562 const _State._(this.name); |
| 564 | 563 |
| 565 String toString() => name; | 564 String toString() => name; |
| 566 } | 565 } |
| OLD | NEW |