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

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

Issue 9555013: Get dartdoc in the SDK and working correctly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update copyright date. Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2011, 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 // 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();
11 callback(); 11 callback();
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 /** 70 /**
71 * Joins [items] into a single, comma-separated string using [conjunction]. 71 * Joins [items] into a single, comma-separated string using [conjunction].
72 * E.g. `['A', 'B', 'C']` becomes `"A, B, and C"`. 72 * E.g. `['A', 'B', 'C']` becomes `"A, B, and C"`.
73 */ 73 */
74 String joinWithCommas(List<String> items, [String conjunction = 'and']) { 74 String joinWithCommas(List<String> items, [String conjunction = 'and']) {
75 if (items.length == 1) return items[0]; 75 if (items.length == 1) return items[0];
76 if (items.length == 2) return "${items[0]} $conjunction ${items[1]}"; 76 if (items.length == 2) return "${items[0]} $conjunction ${items[1]}";
77 return Strings.join(items.getRange(0, items.length - 1), ', ') + 77 return Strings.join(items.getRange(0, items.length - 1), ', ') +
78 ', $conjunction ' + items[items.length - 1]; 78 ', $conjunction ' + items[items.length - 1];
79 } 79 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698