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

Side by Side Diff: pkg/barback/test/transformer/sync_rewrite.dart

Issue 808713003: Remove barback from the repo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/barback/test/transformer/rewrite.dart ('k') | pkg/barback/test/transformer_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library barback.test.transformer.sync_rewrite;
6
7 import 'dart:async';
8
9 import 'package:barback/barback.dart';
10
11 /// Like [DeclaringRewriteTransformer], but with no methods returning Futures.
12 class SyncRewriteTransformer extends Transformer
13 implements DeclaringTransformer {
14 final String from;
15 final String to;
16
17 SyncRewriteTransformer(this.from, this.to);
18
19 bool isPrimary(AssetId id) => id.extension == ".$from";
20
21 void apply(Transform transform) {
22 for (var extension in to.split(" ")) {
23 var id = transform.primaryInput.id.changeExtension(".$extension");
24 transform.addOutput(new Asset.fromString(id, "new.$extension"));
25 }
26 }
27
28 void declareOutputs(DeclaringTransform transform) {
29 for (var extension in to.split(" ")) {
30 var id = transform.primaryId.changeExtension(".$extension");
31 transform.declareOutput(id);
32 }
33 }
34
35 String toString() => "$from->$to";
36 }
OLDNEW
« no previous file with comments | « pkg/barback/test/transformer/rewrite.dart ('k') | pkg/barback/test/transformer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698