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

Side by Side Diff: sdk/lib/core/string.dart

Issue 711003002: Add some ArgumentError and RangeError constructors that capture more information. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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 part of dart.core; 5 part of dart.core;
6 6
7 /** 7 /**
8 * A sequence of characters. 8 * A sequence of characters.
9 * 9 *
10 * A string can be either single or multiline. Single line strings are 10 * A string can be either single or multiline. Single line strings are
(...skipping 660 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 * Resets the iterator to the rune at the specified index of the string. 671 * Resets the iterator to the rune at the specified index of the string.
672 * 672 *
673 * Setting a negative [rawIndex], or one greater than or equal to 673 * Setting a negative [rawIndex], or one greater than or equal to
674 * [:string.length:], 674 * [:string.length:],
675 * is an error. So is setting it in the middle of a surrogate pair. 675 * is an error. So is setting it in the middle of a surrogate pair.
676 * 676 *
677 * Setting the position to the end of then string will set [current] to null. 677 * Setting the position to the end of then string will set [current] to null.
678 */ 678 */
679 void set rawIndex(int rawIndex) { 679 void set rawIndex(int rawIndex) {
680 if (rawIndex >= string.length) { 680 if (rawIndex >= string.length) {
681 throw new RangeError.range(rawIndex, 0, string.length - 1); 681 throw new RangeError.index(rawIndex, string);
682 } 682 }
683 reset(rawIndex); 683 reset(rawIndex);
684 moveNext(); 684 moveNext();
685 } 685 }
686 686
687 /** 687 /**
688 * Resets the iterator to the given index into the string. 688 * Resets the iterator to the given index into the string.
689 * 689 *
690 * After this the [current] value is unset. 690 * After this the [current] value is unset.
691 * You must call [moveNext] make the rune at the position current, 691 * You must call [moveNext] make the rune at the position current,
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
764 _position = position - 1; 764 _position = position - 1;
765 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit); 765 _currentCodePoint = _combineSurrogatePair(prevCodeUnit, codeUnit);
766 return true; 766 return true;
767 } 767 }
768 } 768 }
769 _position = position; 769 _position = position;
770 _currentCodePoint = codeUnit; 770 _currentCodePoint = codeUnit;
771 return true; 771 return true;
772 } 772 }
773 } 773 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698