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

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

Issue 2338883002: Update uses of deprecated API in ddc (Closed)
Patch Set: Created 4 years, 3 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 | « no previous file | pkg/dev_compiler/lib/src/analyzer/context.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/source/custom_resolver.dart
diff --git a/pkg/analyzer/lib/source/custom_resolver.dart b/pkg/analyzer/lib/source/custom_resolver.dart
new file mode 100644
index 0000000000000000000000000000000000000000..06a2d10a8fe98c37df065d31e5320c3b55638aba
--- /dev/null
+++ b/pkg/analyzer/lib/source/custom_resolver.dart
@@ -0,0 +1,33 @@
+// 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';
+
+/**
+ * A resolver that maps individual URI's to other URI's.
scheglov 2016/09/13 18:27:24 The comment seems too generic.
Brian Wilkerson 2016/09/13 20:37:20 The original class had no comment, and I don't act
+ */
+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(fileUri.toFilePath())
scheglov 2016/09/13 18:27:24 I think we need to use ResourceProvider's path con
Brian Wilkerson 2016/09/13 20:37:20 Done
+ .createSource(actualUri ?? uri);
+ }
+}
« no previous file with comments | « no previous file | pkg/dev_compiler/lib/src/analyzer/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698