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

Side by Side Diff: sdk/lib/_internal/pub/lib/src/barback/excluding_transformer.dart

Issue 223553008: Only pass an AssetId to isPrimary and declareOutputs. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix script_compactor Created 6 years, 8 months 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
OLDNEW
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 pub.excluding_transformer; 5 library pub.excluding_transformer;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:barback/barback.dart'; 9 import 'package:barback/barback.dart';
10 10
(...skipping 19 matching lines...) Expand all
30 /// assets are allowed. 30 /// assets are allowed.
31 final Set<String> _includes; 31 final Set<String> _includes;
32 32
33 /// The set of assets which should be excluded. 33 /// The set of assets which should be excluded.
34 /// 34 ///
35 /// Exclusions are applied after inclusions. 35 /// Exclusions are applied after inclusions.
36 final Set<String> _excludes; 36 final Set<String> _excludes;
37 37
38 ExcludingTransformer._(this._inner, this._includes, this._excludes); 38 ExcludingTransformer._(this._inner, this._includes, this._excludes);
39 39
40 Future<bool> isPrimary(Asset asset) { 40 Future<bool> isPrimary(AssetId id) {
41 // TODO(rnystrom): Support globs in addition to paths. See #17093. 41 // TODO(rnystrom): Support globs in addition to paths. See #17093.
42 if (_includes != null) { 42 if (_includes != null) {
43 // If there are any includes, it must match one of them. 43 // If there are any includes, it must match one of them.
44 if (!_includes.contains(asset.id.path)) return new Future.value(false); 44 if (!_includes.contains(id.path)) return new Future.value(false);
45 } 45 }
46 46
47 // It must not be excluded. 47 // It must not be excluded.
48 if (_excludes != null && _excludes.contains(asset.id.path)) { 48 if (_excludes != null && _excludes.contains(id.path)) {
49 return new Future.value(false); 49 return new Future.value(false);
50 } 50 }
51 51
52 return _inner.isPrimary(asset); 52 return _inner.isPrimary(id);
53 } 53 }
54 54
55 Future apply(Transform transform) => _inner.apply(transform); 55 Future apply(Transform transform) => _inner.apply(transform);
56 56
57 String toString() => _inner.toString(); 57 String toString() => _inner.toString();
58 } 58 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698