| 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 'package:source_maps/span.dart'; | 9 import 'package:source_maps/span.dart'; |
| 10 | 10 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // re-subscribe. | 123 // re-subscribe. |
| 124 for (var subscription in _inputSubscriptions.values) { | 124 for (var subscription in _inputSubscriptions.values) { |
| 125 subscription.cancel(); | 125 subscription.cancel(); |
| 126 } | 126 } |
| 127 _inputSubscriptions.clear(); | 127 _inputSubscriptions.clear(); |
| 128 | 128 |
| 129 _isDirty = false; | 129 _isDirty = false; |
| 130 | 130 |
| 131 return phase.cascade.graph.transformPool | 131 return phase.cascade.graph.transformPool |
| 132 .withResource(() => transformer.apply(transform)) | 132 .withResource(() => transformer.apply(transform)) |
| 133 .catchError((error) { | 133 .catchError((error, stack) { |
| 134 // If the transform became dirty while processing, ignore any errors from | 134 // If the transform became dirty while processing, ignore any errors from |
| 135 // it. | 135 // it. |
| 136 if (_isDirty) return; | 136 if (_isDirty) return; |
| 137 | 137 |
| 138 if (error is! MissingInputException) { | 138 if (error is! MissingInputException) { |
| 139 error = new TransformerException(info, error); | 139 error = new TransformerException(info, error, stack); |
| 140 } | 140 } |
| 141 | 141 |
| 142 // Catch all transformer errors and pipe them to the results stream. | 142 // Catch all transformer errors and pipe them to the results stream. |
| 143 // This is so a broken transformer doesn't take down the whole graph. | 143 // This is so a broken transformer doesn't take down the whole graph. |
| 144 phase.cascade.reportError(error); | 144 phase.cascade.reportError(error); |
| 145 | 145 |
| 146 // Don't allow partial results from a failed transform. | 146 // Don't allow partial results from a failed transform. |
| 147 newOutputs.clear(); | 147 newOutputs.clear(); |
| 148 }).then((_) { | 148 }).then((_) { |
| 149 if (_isDirty) return new Set(); | 149 if (_isDirty) return new Set(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 return brandNewOutputs; | 215 return brandNewOutputs; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void _log(AssetId asset, LogLevel level, String message, Span span) { | 218 void _log(AssetId asset, LogLevel level, String message, Span span) { |
| 219 // If the log isn't already associated with an asset, use the primary. | 219 // If the log isn't already associated with an asset, use the primary. |
| 220 if (asset == null) asset = primary.id; | 220 if (asset == null) asset = primary.id; |
| 221 var entry = new LogEntry(info, asset, level, message, span); | 221 var entry = new LogEntry(info, asset, level, message, span); |
| 222 _onLogController.add(entry); | 222 _onLogController.add(entry); |
| 223 } | 223 } |
| 224 } | 224 } |
| OLD | NEW |