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

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

Issue 2376073003: Add tests for resolveRelativeUri() and a workaround. (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/analyzer/test/generated/test_all.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8dd40dffe09c8d33dafe3aa69bcb2e4ecc1705ac..b3f688a3e3fbf456190c411b9db3897a38be2aa7 100644
--- a/pkg/analyzer/lib/src/generated/utilities_dart.dart
+++ b/pkg/analyzer/lib/src/generated/utilities_dart.dart
@@ -27,12 +27,23 @@ Uri resolveRelativeUri(Uri baseUri, Uri containedUri) {
Uri origBaseUri = baseUri;
try {
String scheme = baseUri.scheme;
+ // dart:core => dart:core/core.dart
if (scheme == DartUriResolver.DART_SCHEME) {
String part = baseUri.path;
if (part.indexOf('/') < 0) {
baseUri = FastUri.parse('$scheme:$part/$part.dart');
}
}
+ // foo.dart + ../bar.dart = ../bar.dart
+ // TODO(scheglov) Remove this temporary workaround.
+ // Should be fixed as https://github.com/dart-lang/sdk/issues/27447
+ List<String> baseSegments = baseUri.pathSegments;
+ List<String> containedSegments = containedUri.pathSegments;
+ if (baseSegments.length == 1 &&
+ containedSegments.length > 0 &&
+ containedSegments[0] == '..') {
+ return containedUri;
+ }
return baseUri.resolveUri(containedUri);
} catch (exception, stackTrace) {
throw new AnalysisException(
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/test_all.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698