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

Unified Diff: sdk/lib/core/uri.dart

Issue 438303002: Revert "Add Uri.replace which creates a new Uri with the same fields as the original, but with some… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « no previous file | tests/corelib/uri_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/uri.dart
diff --git a/sdk/lib/core/uri.dart b/sdk/lib/core/uri.dart
index c4dc8d94832b98d52e2bfd7955288f95f2665c59..ce9c8bb89be3617310461cd6d1af6181acfdc334 100644
--- a/sdk/lib/core/uri.dart
+++ b/sdk/lib/core/uri.dart
@@ -819,101 +819,6 @@ class Uri {
}
/**
- * Returns a new `Uri` based on this one, but with some parts replaced.
- *
- * This method takes the same parameters as the [new Uri] constructor,
- * and they have the same meaning.
- *
- * At most one of [path] and [pathSegments] must be provided.
- * Likewise, at most one of [query] and [queryParameters] must be provided.
- *
- * Each part that is not provided will default to the corresponding
- * value from this `Uri` instead.
- *
- * This method is different from [Uri.resolve] which overrides in a
- * hierarchial manner,
- * and can instead replace each part of a `Uri` individually.
- *
- * Example:
- *
- * Uri uri1 = Uri.parse("a://b@c:4/d/e?f#g");
- * Uri uri2 = uri1.replace(scheme: "A", path: "D/E/E", fragment: "G");
- * print(uri2); // prints "A://b@c:4/D/E/E/?f#G"
- *
- * This method acts similarly to using the `new Uri` constructor with
- * some of the arguments taken from this `Uri` . Example:
- *
- * Uri uri3 = new Uri(
- * scheme: "A",
- * userInfo: uri1.userInfo,
- * host: uri1.host,
- * port: uri1.port,
- * path: "D/E/E",
- * query: uri1.query,
- * fragment: "G");
- * print(uri3); // prints "A://b@c:4/D/E/E/?f#G"
- * print(uri2 == uri3); // prints true.
- *
- * Using this method can be seen as a shorthand for the `Uri` constructor
- * call above, but may also be slightly faster because the parts taken
- * from this `Uri` need not be checked for validity again.
- */
- Uri replace({String scheme,
- String userInfo,
- String host,
- int port,
- String path,
- Iterable<String> pathSegments,
- String query,
- Map<String, String> queryParameters,
- String fragment}) {
- if (scheme == null) {
- scheme = this.scheme;
- } else {
- scheme = _makeScheme(scheme, scheme.length);
- }
- if (userInfo == null) {
- userInfo = this.userInfo;
- } else {
- userInfo = _makeUserInfo(userInfo, 0, userInfo.length);
- }
- if (host == null) {
- host = this.host;
- } else {
- host = _makeHost(host, 0, host.length, false);
- }
- if (port == null) {
- port = this.port;
- }
-
- bool ensureLeadingSlash = (host != "" || scheme == "file");
- if (path == null && pathSegments == null) {
- path = this.path;
- if (ensureLeadingSlash && !path.isEmpty && !path.startsWith('/')) {
- path = "/$path";
- }
- } else {
- path = _makePath(path, 0, _stringOrNullLength(path), pathSegments,
- ensureLeadingSlash);
- }
-
- if (query == null && queryParameters == null) {
- query = this.query;
- } else {
- query = _makeQuery(query, 0, _stringOrNullLength(query), queryParameters);
- }
-
- if (fragment == null) {
- fragment = this.fragment;
- } else {
- fragment = _makeFragment(fragment, 0, fragment.length);
- }
-
- return new Uri._internal(
- scheme, userInfo, host, port, path, query, fragment);
- }
-
- /**
* Returns the URI path split into its segments. Each of the
* segments in the returned list have been decoded. If the path is
* empty the empty list will be returned. A leading slash `/` does
« no previous file with comments | « no previous file | tests/corelib/uri_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698