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

Side by Side Diff: sdk/lib/core/uri.dart

Issue 22918029: Change the type of the pathSegments argument to the Uri constructor from List to Iterable (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/corelib/uri_path_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * A parsed URI, as specified by RFC-3986, http://tools.ietf.org/html/rfc3986. 8 * A parsed URI, as specified by RFC-3986, http://tools.ietf.org/html/rfc3986.
9 */ 9 */
10 class Uri { 10 class Uri {
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 * percent-encoding of the keys and values encodes all characters 151 * percent-encoding of the keys and values encodes all characters
152 * except for the unreserved characters. 152 * except for the unreserved characters.
153 * 153 *
154 * The fragment component is set through [fragment]. 154 * The fragment component is set through [fragment].
155 */ 155 */
156 Uri({scheme, 156 Uri({scheme,
157 this.userInfo: "", 157 this.userInfo: "",
158 this.host: "", 158 this.host: "",
159 port: 0, 159 port: 0,
160 String path, 160 String path,
161 List<String> pathSegments, 161 Iterable<String> pathSegments,
162 String query, 162 String query,
163 Map<String, String> queryParameters, 163 Map<String, String> queryParameters,
164 fragment: ""}) : 164 fragment: ""}) :
165 scheme = _makeScheme(scheme), 165 scheme = _makeScheme(scheme),
166 query = _makeQuery(query, queryParameters), 166 query = _makeQuery(query, queryParameters),
167 fragment = _makeFragment(fragment) { 167 fragment = _makeFragment(fragment) {
168 // Perform scheme specific normalization. 168 // Perform scheme specific normalization.
169 if (scheme == "http" && port == 80) { 169 if (scheme == "http" && port == 80) {
170 _port = 0; 170 _port = 0;
171 } else if (scheme == "https" && port == 443) { 171 } else if (scheme == "https" && port == 443) {
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 allLowercase = false; 494 allLowercase = false;
495 } else { 495 } else {
496 throw new ArgumentError('Illegal scheme: $scheme'); 496 throw new ArgumentError('Illegal scheme: $scheme');
497 } 497 }
498 } 498 }
499 } 499 }
500 500
501 return allLowercase ? scheme : scheme.toLowerCase(); 501 return allLowercase ? scheme : scheme.toLowerCase();
502 } 502 }
503 503
504 String _makePath(String path, List<String> pathSegments) { 504 String _makePath(String path, Iterable<String> pathSegments) {
505 if (path == null && pathSegments == null) return ""; 505 if (path == null && pathSegments == null) return "";
506 if (path != null && pathSegments != null) { 506 if (path != null && pathSegments != null) {
507 throw new ArgumentError('Both path and pathSegments specified'); 507 throw new ArgumentError('Both path and pathSegments specified');
508 } 508 }
509 var result; 509 var result;
510 if (path != null) { 510 if (path != null) {
511 result = _normalize(path); 511 result = _normalize(path);
512 } else { 512 } else {
513 result = pathSegments.map((s) => _uriEncode(_pathCharTable, s)).join("/"); 513 result = pathSegments.map((s) => _uriEncode(_pathCharTable, s)).join("/");
514 } 514 }
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 void clear() { 1465 void clear() {
1466 throw new UnsupportedError("Cannot modify an unmodifiable map"); 1466 throw new UnsupportedError("Cannot modify an unmodifiable map");
1467 } 1467 }
1468 void forEach(void f(K key, V value)) => _map.forEach(f); 1468 void forEach(void f(K key, V value)) => _map.forEach(f);
1469 Iterable<K> get keys => _map.keys; 1469 Iterable<K> get keys => _map.keys;
1470 Iterable<V> get values => _map.values; 1470 Iterable<V> get values => _map.values;
1471 int get length => _map.length; 1471 int get length => _map.length;
1472 bool get isEmpty => _map.isEmpty; 1472 bool get isEmpty => _map.isEmpty;
1473 bool get isNotEmpty => _map.isNotEmpty; 1473 bool get isNotEmpty => _map.isNotEmpty;
1474 } 1474 }
OLDNEW
« no previous file with comments | « no previous file | tests/corelib/uri_path_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698