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

Unified Diff: pkg/analyzer/lib/src/generated/utilities_dart.dart

Issue 2242883003: Fix resolveRelativeUri() to handle correctly empty contained Uri(s). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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
Index: pkg/analyzer/lib/src/generated/utilities_dart.dart
diff --git a/pkg/analyzer/lib/src/generated/utilities_dart.dart b/pkg/analyzer/lib/src/generated/utilities_dart.dart
index 1409cd5dcc269b1dfd37396d2d7c61a692584f18..d244dce7a7fd6e8de6547d31e954dc934502f64e 100644
--- a/pkg/analyzer/lib/src/generated/utilities_dart.dart
+++ b/pkg/analyzer/lib/src/generated/utilities_dart.dart
@@ -27,21 +27,14 @@ Uri resolveRelativeUri(Uri baseUri, Uri containedUri) {
}
Uri origBaseUri = baseUri;
try {
- bool isOpaque = baseUri.isAbsolute && !baseUri.path.startsWith('/');
- if (isOpaque) {
- String scheme = baseUri.scheme;
+ String scheme = baseUri.scheme;
+ if (scheme == DartUriResolver.DART_SCHEME) {
String part = baseUri.path;
- if (scheme == DartUriResolver.DART_SCHEME && part.indexOf('/') < 0) {
- part = "$part/$part.dart";
+ if (part.indexOf('/') < 0) {
+ baseUri = FastUri.parse('$scheme:$part/$part.dart');
}
- baseUri = FastUri.parse("$scheme:/$part");
}
- Uri result = baseUri.resolveUri(containedUri);
- if (isOpaque) {
- result =
- FastUri.parse("${result.scheme}:${result.path.substring(1)}");
- }
- return result;
+ return baseUri.resolveUri(containedUri);
} catch (exception, stackTrace) {
throw new AnalysisException(
"Could not resolve URI ($containedUri) relative to source ($origBaseUri)",
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/all_the_rest_test.dart » ('j') | pkg/analyzer/test/generated/all_the_rest_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698