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

Unified Diff: packages/analyzer/lib/source/custom_resolver.dart

Issue 2990843002: Removed fixed dependencies (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/analyzer/lib/source/config.dart ('k') | packages/analyzer/lib/source/embedder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/analyzer/lib/source/custom_resolver.dart
diff --git a/packages/analyzer/lib/source/custom_resolver.dart b/packages/analyzer/lib/source/custom_resolver.dart
new file mode 100644
index 0000000000000000000000000000000000000000..f5bbf46482ddb8cbd8fecf9bb16a3c2d23e71c5f
--- /dev/null
+++ b/packages/analyzer/lib/source/custom_resolver.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library analyzer.source.custom_resolver;
+
+import 'package:analyzer/file_system/file_system.dart';
+import 'package:analyzer/src/generated/source.dart';
+
+class CustomUriResolver extends UriResolver {
+ final ResourceProvider resourceProvider;
+ final Map<String, String> _urlMappings;
+
+ CustomUriResolver(this.resourceProvider, this._urlMappings);
+
+ @override
+ Source resolveAbsolute(Uri uri, [Uri actualUri]) {
+ String mapping = _urlMappings[uri.toString()];
+ if (mapping == null) {
+ return null;
+ }
+ Uri fileUri = new Uri.file(mapping);
+ if (!fileUri.isAbsolute) {
+ return null;
+ }
+ return resourceProvider
+ .getFile(resourceProvider.pathContext.fromUri(fileUri))
+ .createSource(actualUri ?? uri);
+ }
+}
« no previous file with comments | « packages/analyzer/lib/source/config.dart ('k') | packages/analyzer/lib/source/embedder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698