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

Side by Side Diff: sdk/lib/utf/utf_core.dart

Issue 11416240: Address Ivan's comments. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Fix typos Created 8 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 | « sdk/lib/utf/utf8.dart ('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) 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 // TODO(jmesserly): would be nice to have this on String (dartbug.com/6501). 5 // TODO(jmesserly): would be nice to have this on String (dartbug.com/6501).
6 /** 6 /**
7 * Provide a list of Unicode codepoints for a given string. 7 * Provide a list of Unicode codepoints for a given string.
8 */ 8 */
9 List<int> stringToCodepoints(String str) { 9 List<int> stringToCodepoints(String str) {
10 // Note: str.charCodes gives us 16-bit code units on all Dart implementations. 10 // Note: str.charCodes gives us 16-bit code units on all Dart implementations.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 return true; 205 return true;
206 } 206 }
207 } 207 }
208 208
209 /** 209 /**
210 * _ListRange in an internal type used to create a lightweight Interable on a 210 * _ListRange in an internal type used to create a lightweight Interable on a
211 * range within a source list. DO NOT MODIFY the underlying list while 211 * range within a source list. DO NOT MODIFY the underlying list while
212 * iterating over it. The results of doing so are undefined. 212 * iterating over it. The results of doing so are undefined.
213 */ 213 */
214 // TODO(floitsch): Consider removing the extend and switch to implements since
215 // that's cheaper to allocate.
214 class _ListRange extends Iterable { 216 class _ListRange extends Iterable {
215 final List _source; 217 final List _source;
216 final int _offset; 218 final int _offset;
217 final int _length; 219 final int _length;
218 220
219 _ListRange(source, [offset = 0, length]) : 221 _ListRange(source, [offset = 0, length]) :
220 this._source = source, 222 this._source = source,
221 this._offset = offset, 223 this._offset = offset,
222 this._length = (length == null ? source.length - offset : length) { 224 this._length = (length == null ? source.length - offset : length) {
223 if (_offset < 0 || _offset > _source.length) { 225 if (_offset < 0 || _offset > _source.length) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 _offset -= by; 271 _offset -= by;
270 } 272 }
271 273
272 int get remaining => _end - _offset - 1; 274 int get remaining => _end - _offset - 1;
273 275
274 void skip([int count = 1]) { 276 void skip([int count = 1]) {
275 _offset += count; 277 _offset += count;
276 } 278 }
277 } 279 }
278 280
OLDNEW
« no previous file with comments | « sdk/lib/utf/utf8.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698