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

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

Issue 11238035: Make isEmpty a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/html/templates/immutable_list_mixin.darttemplate ('k') | pkg/dartdoc/bin/dartdoc.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 String merge(String base, String reference) { 5 String merge(String base, String reference) {
6 if (base == "") return "/$reference"; 6 if (base == "") return "/$reference";
7 return "${base.substring(0, base.lastIndexOf("/") + 1)}$reference"; 7 return "${base.substring(0, base.lastIndexOf("/") + 1)}$reference";
8 } 8 }
9 9
10 String removeDotSegments(String path) { 10 String removeDotSegments(String path) {
11 List<String> output = []; 11 List<String> output = [];
12 bool appendSlash = false; 12 bool appendSlash = false;
13 for (String segment in path.split("/")) { 13 for (String segment in path.split("/")) {
14 appendSlash = false; 14 appendSlash = false;
15 if (segment == "..") { 15 if (segment == "..") {
16 if (!output.isEmpty() && 16 if (!output.isEmpty &&
17 ((output.length != 1) || (output[0] != ""))) output.removeLast(); 17 ((output.length != 1) || (output[0] != ""))) output.removeLast();
18 appendSlash = true; 18 appendSlash = true;
19 } else if ("." == segment) { 19 } else if ("." == segment) {
20 appendSlash = true; 20 appendSlash = true;
21 } else { 21 } else {
22 output.add(segment); 22 output.add(segment);
23 } 23 }
24 } 24 }
25 if (appendSlash) output.add(""); 25 if (appendSlash) output.add("");
26 return Strings.join(output, "/"); 26 return Strings.join(output, "/");
27 } 27 }
OLDNEW
« no previous file with comments | « lib/html/templates/immutable_list_mixin.darttemplate ('k') | pkg/dartdoc/bin/dartdoc.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698