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

Unified Diff: pkg/utf/lib/utf32.dart

Issue 68563004: Move unicode tests to utf package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Simplify test. Created 7 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 side-by-side diff with in-line comments
Download patch
Index: pkg/utf/lib/utf32.dart
diff --git a/pkg/utf/lib/utf32.dart b/pkg/utf/lib/utf32.dart
index 885ed947a5babe31d1ea16a3c6ca6a1e83cd9b5c..c481c81771c73bc250a9ba63f0a75dae058516e1 100644
--- a/pkg/utf/lib/utf32.dart
+++ b/pkg/utf/lib/utf32.dart
@@ -234,7 +234,12 @@ abstract class Utf32BytesDecoder implements _ListRangeIterator {
bool moveNext() {
_current = null;
- if (utf32EncodedBytesIterator.remaining < 4) {
+ int remaining = utf32EncodedBytesIterator.remaining;
+ if (remaining == 0) {
+ _current = null;
+ return false;
+ }
+ if (remaining < 4) {
utf32EncodedBytesIterator.skip(utf32EncodedBytesIterator.remaining);
if (replacementCodepoint != null) {
_current = replacementCodepoint;
@@ -243,18 +248,17 @@ abstract class Utf32BytesDecoder implements _ListRangeIterator {
throw new ArgumentError(
"Invalid UTF32 at ${utf32EncodedBytesIterator.position}");
}
+ }
+ int codepoint = decode();
+ if (_validCodepoint(codepoint)) {
+ _current = codepoint;
+ return true;
+ } else if (replacementCodepoint != null) {
+ _current = replacementCodepoint;
+ return true;
} else {
- int codepoint = decode();
- if (_validCodepoint(codepoint)) {
- _current = codepoint;
- return true;
- } else if (replacementCodepoint != null) {
- _current = replacementCodepoint;
- return true;
- } else {
- throw new ArgumentError(
- "Invalid UTF32 at ${utf32EncodedBytesIterator.position}");
- }
+ throw new ArgumentError(
+ "Invalid UTF32 at ${utf32EncodedBytesIterator.position}");
}
}

Powered by Google App Engine
This is Rietveld 408576698