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

Side by Side Diff: utils/dartdoc/utils.dart

Issue 8822001: Bunch of dartdoc changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Default to showing source. Created 9 years 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 | « utils/dartdoc/static/styles.css ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 // Generic utility functions. 5 // Generic utility functions.
6 6
7 /** Invokes [callback] and returns how long it took to execute in ms. */ 7 /** Invokes [callback] and returns how long it took to execute in ms. */
8 num time(callback()) { 8 num time(callback()) {
9 final watch = new Stopwatch(); 9 final watch = new Stopwatch();
10 watch.start(); 10 watch.start();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 /** Removes up to [indentation] leading whitespace characters from [text]. */ 47 /** Removes up to [indentation] leading whitespace characters from [text]. */
48 String unindent(String text, int indentation) { 48 String unindent(String text, int indentation) {
49 var start; 49 var start;
50 for (start = 0; start < Math.min(indentation, text.length); start++) { 50 for (start = 0; start < Math.min(indentation, text.length); start++) {
51 // Stop if we hit a non-whitespace character. 51 // Stop if we hit a non-whitespace character.
52 if (text[start] != ' ') break; 52 if (text[start] != ' ') break;
53 } 53 }
54 54
55 return text.substring(start); 55 return text.substring(start);
56 } 56 }
57
58 /** Sorts the map by the key, doing a case-insensitive comparison. */
59 List orderByName(Map<String, Dynamic> map) {
60 // TODO(rnystrom): it'd be nice to have this in corelib.
61 List keys = map.getKeys();
62 keys.sort((x, y) => x.toUpperCase().compareTo(y.toUpperCase()));
63 final values = [];
64 for (var k in keys) {
65 values.add(map[k]);
66 }
67 return values;
68 }
OLDNEW
« no previous file with comments | « utils/dartdoc/static/styles.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698