| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'dart:isolate'; | 6 import 'dart:isolate'; |
| 7 | 7 |
| 8 import 'package:barback/barback.dart'; | 8 import 'package:barback/barback.dart'; |
| 9 | 9 |
| 10 import '../asset/dart/serialize.dart'; | 10 import '../asset/dart/serialize.dart'; |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 /// A wrapper for a transformer group that's in a different isolate. | 118 /// A wrapper for a transformer group that's in a different isolate. |
| 119 class _ForeignGroup implements TransformerGroup { | 119 class _ForeignGroup implements TransformerGroup { |
| 120 final Iterable<Iterable> phases; | 120 final Iterable<Iterable> phases; |
| 121 | 121 |
| 122 /// The result of calling [toString] on the transformer group in the isolate. | 122 /// The result of calling [toString] on the transformer group in the isolate. |
| 123 final String _toString; | 123 final String _toString; |
| 124 | 124 |
| 125 _ForeignGroup(TransformerConfig config, Map map) | 125 _ForeignGroup(TransformerConfig config, Map map) |
| 126 : phases = map['phases'].map((phase) { | 126 : phases = (map['phases'] as List).map((phase) { |
| 127 return phase.map((transformer) => deserializeTransformerLike( | 127 return (phase as List) |
| 128 transformer, config)).toList(); | 128 .map((transformer) => |
| 129 deserializeTransformerLike(transformer, config)) |
| 130 .toList(); |
| 129 }).toList(), | 131 }).toList(), |
| 130 _toString = map['toString']; | 132 _toString = map['toString']; |
| 131 | 133 |
| 132 String toString() => _toString; | 134 String toString() => _toString; |
| 133 } | 135 } |
| 134 | 136 |
| 135 /// Converts a serializable map into a [Transformer], an [AggregateTransformer], | 137 /// Converts a serializable map into a [Transformer], an [AggregateTransformer], |
| 136 /// or a [TransformerGroup]. | 138 /// or a [TransformerGroup]. |
| 137 deserializeTransformerLike(Map map, TransformerConfig config) { | 139 deserializeTransformerLike(Map map, TransformerConfig config) { |
| 138 var transformer; | 140 var transformer; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 159 default: assert(false); | 161 default: assert(false); |
| 160 } | 162 } |
| 161 | 163 |
| 162 if (transformer is Transformer) { | 164 if (transformer is Transformer) { |
| 163 return ExcludingTransformer.wrap(transformer, config); | 165 return ExcludingTransformer.wrap(transformer, config); |
| 164 } else { | 166 } else { |
| 165 assert(transformer is AggregateTransformer); | 167 assert(transformer is AggregateTransformer); |
| 166 return ExcludingAggregateTransformer.wrap(transformer, config); | 168 return ExcludingAggregateTransformer.wrap(transformer, config); |
| 167 } | 169 } |
| 168 } | 170 } |
| OLD | NEW |