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

Unified Diff: pkg/intl/lib/number_format.dart

Issue 13817008: Fix some warnings in pub and pkg packages. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: pkg/intl/lib/number_format.dart
diff --git a/pkg/intl/lib/number_format.dart b/pkg/intl/lib/number_format.dart
index c700e6217f0325f13b761aaad7e5e7e470efe279..1745178323ca98cf0aaf510ef45f1b2f31191b4c 100644
--- a/pkg/intl/lib/number_format.dart
+++ b/pkg/intl/lib/number_format.dart
@@ -475,7 +475,7 @@ class _NumberFormatParser {
format._negativePrefix = _parseAffix();
// Skip over the negative trunk, verifying that it's identical to the
// positive trunk.
- for (var each in _iterator(trunk)) {
+ for (var each in _iterable(trunk)) {
if (pattern.current != each && pattern.current != null) {
throw new FormatException(
"Positive and negative trunks must be the same");
@@ -720,10 +720,27 @@ class _NumberFormatParser {
}
/**
+ * Returns an [Iterable] on the string as a list of substrings.
+ */
+Iterable _iterable(String s) => new _StringIterable(s);
+
+/**
* Return an iterator on the string as a list of substrings.
*/
Iterator _iterator(String s) => new _StringIterator(s);
+// TODO(nweiz): remove this when issue 3780 is fixed.
+/**
+ * Provides an Iterable that wraps [_iterator] so it can be used in a `for`
+ * loop.
+ */
+class _StringIterable extends Iterable<String> {
+ final Iterator<String> iterator;
+
+ _StringIterable(String s)
+ : iterator = _iterator(s);
+}
+
/**
* Provides an iterator over a string as a list of substrings, and also
* gives us a lookahead of one via the [peek] method.
« no previous file with comments | « pkg/intl/lib/message_lookup_by_library.dart ('k') | pkg/scheduled_test/lib/src/scheduled_server/safe_http_server.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698