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 code_transformers.test.resolver_test; | 5 library code_transformers.test.resolver_test; |
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 import 'package:code_transformers/resolver.dart'; | 10 import 'package:code_transformers/resolver.dart'; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 } | 347 } |
348 | 348 |
349 class TestTransformer extends Transformer with ResolverTransformer { | 349 class TestTransformer extends Transformer with ResolverTransformer { |
350 final AssetId primary; | 350 final AssetId primary; |
351 final Function validator; | 351 final Function validator; |
352 | 352 |
353 TestTransformer(Resolvers resolvers, this.primary, this.validator) { | 353 TestTransformer(Resolvers resolvers, this.primary, this.validator) { |
354 this.resolvers = resolvers; | 354 this.resolvers = resolvers; |
355 } | 355 } |
356 | 356 |
357 Future<bool> isPrimary(Asset input) => | 357 // TODO(nweiz): This should just take an AssetId when barback <0.13.0 support |
358 new Future.value(input.id == primary); | 358 // is dropped. |
| 359 Future<bool> isPrimary(idOrAsset) { |
| 360 var id = idOrAsset is AssetId ? idOrAsset : idOrAsset.id; |
| 361 return new Future.value(id == primary); |
| 362 } |
359 | 363 |
360 applyResolver(Transform transform, Resolver resolver) => validator(resolver); | 364 applyResolver(Transform transform, Resolver resolver) => validator(resolver); |
361 } | 365 } |
OLD | NEW |