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

Unified Diff: pkg/front_end/lib/src/fasta/translate_uri.dart

Issue 2890883002: Fix for resolving 'bar.dart' against 'dart:foo'. Test for TranslateUri. (Closed)
Patch Set: Created 3 years, 7 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/front_end/lib/src/incremental/file_state.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/translate_uri.dart
diff --git a/pkg/front_end/lib/src/fasta/translate_uri.dart b/pkg/front_end/lib/src/fasta/translate_uri.dart
index 00453c669298d2b26cea22d5a79f55a7018cfdff..3799df8a949c67d37e7c112300d35b16950a217e 100644
--- a/pkg/front_end/lib/src/fasta/translate_uri.dart
+++ b/pkg/front_end/lib/src/fasta/translate_uri.dart
@@ -23,7 +23,18 @@ class TranslateUri {
return null;
}
- Uri translateDartUri(Uri uri) => dartLibraries[uri.path];
+ Uri translateDartUri(Uri uri) {
+ if (!uri.isScheme('dart')) return null;
+ String path = uri.path;
+
+ int index = path.indexOf('/');
+ if (index == -1) return dartLibraries[path];
+
+ String libraryName = path.substring(0, index);
+ String relativePath = path.substring(index + 1);
+ Uri libraryFileUri = dartLibraries[libraryName];
+ return libraryFileUri?.resolve(relativePath);
+ }
Uri translatePackageUri(Uri uri) {
int index = uri.path.indexOf("/");
« no previous file with comments | « no previous file | pkg/front_end/lib/src/incremental/file_state.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698