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

Unified Diff: pkg/compiler/lib/src/util/uri_extras.dart

Issue 717103004: Revert "Emit warning on import of dart:mirrors." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « pkg/compiler/lib/src/library_loader.dart ('k') | pkg/compiler/lib/src/warnings.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/util/uri_extras.dart
diff --git a/pkg/compiler/lib/src/util/uri_extras.dart b/pkg/compiler/lib/src/util/uri_extras.dart
index aa8cdcf7f129271ecbf3c01f5a395248435cc56c..65a4ed2516112ac27787c9719d5cc45e73642d4c 100644
--- a/pkg/compiler/lib/src/util/uri_extras.dart
+++ b/pkg/compiler/lib/src/util/uri_extras.dart
@@ -7,18 +7,16 @@ library uri_extras;
import 'dart:math';
String relativize(Uri base, Uri uri, bool isWindows) {
- bool equalsNCS(String a, String b) {
- return a.toLowerCase() == b.toLowerCase();
+ if (!base.path.startsWith('/')) {
+ // Also throw an exception if [base] or base.path is null.
+ throw new ArgumentError('Expected absolute path: ${base.path}');
}
-
- if (!equalsNCS(base.scheme, uri.scheme) ||
- equalsNCS(base.scheme, 'dart') ||
- equalsNCS(base.scheme, 'package')) {
- return uri.toString();
+ if (!uri.path.startsWith('/')) {
+ // Also throw an exception if [uri] or uri.path is null.
+ throw new ArgumentError('Expected absolute path: ${uri.path}');
}
-
- if (!equalsNCS(base.scheme, 'file')) {
- isWindows = false;
+ bool equalsNCS(String a, String b) {
+ return a.toLowerCase() == b.toLowerCase();
}
String normalize(String path) {
@@ -29,7 +27,9 @@ String relativize(Uri base, Uri uri, bool isWindows) {
}
}
- if (base.userInfo == uri.userInfo &&
+ if (equalsNCS(base.scheme, 'file') &&
+ equalsNCS(base.scheme, uri.scheme) &&
+ base.userInfo == uri.userInfo &&
equalsNCS(base.host, uri.host) &&
base.port == uri.port &&
uri.query == "" && uri.fragment == "") {
@@ -37,11 +37,6 @@ String relativize(Uri base, Uri uri, bool isWindows) {
return uri.path.substring(base.path.lastIndexOf('/') + 1);
}
- if (!base.path.startsWith('/') ||
- !uri.path.startsWith('/')) {
- return uri.toString();
- }
-
List<String> uriParts = uri.path.split('/');
List<String> baseParts = base.path.split('/');
int common = 0;
« no previous file with comments | « pkg/compiler/lib/src/library_loader.dart ('k') | pkg/compiler/lib/src/warnings.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698