| 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.src.resolvers; | 5 library code_transformers.src.resolvers; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'package:barback/barback.dart'; | 8 import 'package:barback/barback.dart'; |
| 9 | 9 |
| 10 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; | 10 import 'package:analyzer/src/generated/sdk.dart' show DartSdk; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 factory Resolvers(dartSdkDirectory) { | 33 factory Resolvers(dartSdkDirectory) { |
| 34 var sdk = new DirectoryBasedDartSdkProxy(dartSdkDirectory); | 34 var sdk = new DirectoryBasedDartSdkProxy(dartSdkDirectory); |
| 35 var uriResolver = new DartUriResolverProxy(sdk); | 35 var uriResolver = new DartUriResolverProxy(sdk); |
| 36 return new Resolvers.fromSdk(sdk, uriResolver); | 36 return new Resolvers.fromSdk(sdk, uriResolver); |
| 37 } | 37 } |
| 38 | 38 |
| 39 factory Resolvers.fromMock(Map<String, String> sources, | 39 factory Resolvers.fromMock(Map<String, String> sources, |
| 40 {bool reportMissing: false}) { | 40 {bool reportMissing: false}) { |
| 41 var sdk = new MockDartSdk(sources, reportMissing: reportMissing); | 41 var sdk = new MockDartSdk(sources, reportMissing: reportMissing); |
| 42 return new Resolvers.fromSdk(sdk, new DartUriResolver(sdk)); | 42 return new Resolvers.fromSdk(sdk, sdk.resolver); |
| 43 } | 43 } |
| 44 | 44 |
| 45 /// Get a resolver for [transform]. If provided, this resolves the code | 45 /// Get a resolver for [transform]. If provided, this resolves the code |
| 46 /// starting from each of the assets in [entryPoints]. If not, this resolves | 46 /// starting from each of the assets in [entryPoints]. If not, this resolves |
| 47 /// the code starting from `transform.primaryInput.id` by default. | 47 /// the code starting from `transform.primaryInput.id` by default. |
| 48 /// | 48 /// |
| 49 /// [Resolver.release] must be called once it's done being used, or | 49 /// [Resolver.release] must be called once it's done being used, or |
| 50 /// [ResolverTransformer] should be used to automatically release the | 50 /// [ResolverTransformer] should be used to automatically release the |
| 51 /// resolver. | 51 /// resolver. |
| 52 Future<Resolver> get(Transform transform, [List<AssetId> entryPoints]) { | 52 Future<Resolver> get(Transform transform, [List<AssetId> entryPoints]) { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 resolver.release(); | 113 resolver.release(); |
| 114 }); | 114 }); |
| 115 }); | 115 }); |
| 116 } | 116 } |
| 117 | 117 |
| 118 /// Invoked when the resolver is ready to be processed. | 118 /// Invoked when the resolver is ready to be processed. |
| 119 /// | 119 /// |
| 120 /// Return a Future to indicate when apply is completed. | 120 /// Return a Future to indicate when apply is completed. |
| 121 applyResolver(Transform transform, Resolver resolver); | 121 applyResolver(Transform transform, Resolver resolver); |
| 122 } | 122 } |
| OLD | NEW |