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

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

Issue 11275042: Renaming IndexOutOfRangeException to RangeError. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
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 /** 5 /**
6 * Provide a list of Unicode codepoints for a given string. 6 * Provide a list of Unicode codepoints for a given string.
7 */ 7 */
8 List<int> stringToCodepoints(String str) { 8 List<int> stringToCodepoints(String str) {
9 List<int> codepoints; 9 List<int> codepoints;
10 // TODO _is16BitCodeUnit() is used to work around a bug with dart2js 10 // TODO _is16BitCodeUnit() is used to work around a bug with dart2js
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 class _ListRange implements Iterable { 212 class _ListRange implements Iterable {
213 final List _source; 213 final List _source;
214 final int _offset; 214 final int _offset;
215 final int _length; 215 final int _length;
216 216
217 _ListRange(source, [offset = 0, length]) : 217 _ListRange(source, [offset = 0, length]) :
218 this._source = source, 218 this._source = source,
219 this._offset = offset, 219 this._offset = offset,
220 this._length = (length == null ? source.length - offset : length) { 220 this._length = (length == null ? source.length - offset : length) {
221 if (_offset < 0 || _offset > _source.length) { 221 if (_offset < 0 || _offset > _source.length) {
222 throw new IndexOutOfRangeException(_offset); 222 throw new RangeError(_offset);
223 } 223 }
224 if (_length != null && (_length < 0)) { 224 if (_length != null && (_length < 0)) {
225 throw new IndexOutOfRangeException(_length); 225 throw new RangeError(_length);
226 } 226 }
227 if (_length + _offset > _source.length) { 227 if (_length + _offset > _source.length) {
228 throw new IndexOutOfRangeException(_length + _offset); 228 throw new RangeError(_length + _offset);
229 } 229 }
230 } 230 }
231 231
232 _ListRangeIterator iterator() => 232 _ListRangeIterator iterator() =>
233 new _ListRangeIteratorImpl(_source, _offset, _offset + _length); 233 new _ListRangeIteratorImpl(_source, _offset, _offset + _length);
234 234
235 int get length => _length; 235 int get length => _length;
236 } 236 }
237 237
238 /** 238 /**
(...skipping 27 matching lines...) Expand all
266 _offset -= by; 266 _offset -= by;
267 } 267 }
268 268
269 int get remaining => _end - _offset; 269 int get remaining => _end - _offset;
270 270
271 void skip([int count = 1]) { 271 void skip([int count = 1]) {
272 _offset += count; 272 _offset += count;
273 } 273 }
274 } 274 }
275 275
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698