OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.test.transformer.declaring_rewrite; | 5 library barback.test.transformer.declaring_rewrite; |
6 | 6 |
7 import 'dart:async'; | |
8 | |
9 import 'package:barback/barback.dart'; | 7 import 'package:barback/barback.dart'; |
10 | 8 |
11 import 'rewrite.dart'; | 9 import 'rewrite.dart'; |
12 | 10 |
13 /// Like [RewriteTransformer], but declares its assets ahead of time. | 11 /// Like [RewriteTransformer], but declares its assets ahead of time. |
14 class DeclaringRewriteTransformer extends RewriteTransformer | 12 class DeclaringRewriteTransformer extends RewriteTransformer |
15 implements DeclaringTransformer { | 13 implements DeclaringTransformer { |
16 DeclaringRewriteTransformer(String from, String to) | 14 DeclaringRewriteTransformer(String from, String to) |
17 : super(from, to); | 15 : super(from, to); |
18 | 16 |
19 Future declareOutputs(DeclaringTransform transform) { | 17 void declareOutputs(DeclaringTransform transform) { |
20 if (consumePrimary) transform.consumePrimary(); | 18 if (consumePrimary) transform.consumePrimary(); |
21 for (var extension in to.split(" ")) { | 19 for (var extension in to.split(" ")) { |
22 var id = transform.primaryId.changeExtension(".$extension"); | 20 var id = transform.primaryId.changeExtension(".$extension"); |
23 transform.declareOutput(id); | 21 transform.declareOutput(id); |
24 } | 22 } |
25 } | 23 } |
26 } | 24 } |
OLD | NEW |