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

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

Issue 10919146: Get rid of a lot of () for getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | « lib/html/src/dart2js_LocationWrapper.dart ('k') | lib/utf/utf16.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 #library('dart:uri'); 5 #library('dart:uri');
6 6
7 #import('dart:math'); 7 #import('dart:math');
8 #import('dart:utf'); 8 #import('dart:utf');
9 9
10 #source('encode_decode.dart'); 10 #source('encode_decode.dart');
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 bool hasAuthority() { 171 bool hasAuthority() {
172 return (userInfo != "") || (domain != "") || (port != 0); 172 return (userInfo != "") || (domain != "") || (port != 0);
173 } 173 }
174 174
175 /** 175 /**
176 * For http/https schemes returns URI's [origin][] - scheme://domain:port. 176 * For http/https schemes returns URI's [origin][] - scheme://domain:port.
177 * For all other schemes throws IllegalArgumentException. 177 * For all other schemes throws IllegalArgumentException.
178 * [origin]: http://www.w3.org/TR/2011/WD-html5-20110405/origin-0.html#origin 178 * [origin]: http://www.w3.org/TR/2011/WD-html5-20110405/origin-0.html#origin
179 */ 179 */
180 String get origin() { 180 String get origin {
181 if (scheme == "") { 181 if (scheme == "") {
182 // TODO(aprelev@gmail.com): Use StateException instead 182 // TODO(aprelev@gmail.com): Use StateException instead
183 throw new IllegalArgumentException("Cannot use origin without a scheme"); 183 throw new IllegalArgumentException("Cannot use origin without a scheme");
184 } 184 }
185 if (scheme != "http" && scheme != "https") { 185 if (scheme != "http" && scheme != "https") {
186 // TODO(aprelev@gmail.com): Use StateException instead 186 // TODO(aprelev@gmail.com): Use StateException instead
187 throw new IllegalArgumentException( 187 throw new IllegalArgumentException(
188 "origin is applicable to http/https schemes only. Not \'$scheme\'"); 188 "origin is applicable to http/https schemes only. Not \'$scheme\'");
189 } 189 }
190 StringBuffer sb = new StringBuffer(); 190 StringBuffer sb = new StringBuffer();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 } 223 }
224 224
225 static void _addIfNonEmpty(StringBuffer sb, String test, 225 static void _addIfNonEmpty(StringBuffer sb, String test,
226 String first, String second) { 226 String first, String second) {
227 if ("" != test) { 227 if ("" != test) {
228 sb.add(first === null ? "null" : first); 228 sb.add(first === null ? "null" : first);
229 sb.add(second === null ? "null" : second); 229 sb.add(second === null ? "null" : second);
230 } 230 }
231 } 231 }
232 } 232 }
OLDNEW
« no previous file with comments | « lib/html/src/dart2js_LocationWrapper.dart ('k') | lib/utf/utf16.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698