| Index: sdk/lib/_collection_dev/iterable.dart
|
| diff --git a/sdk/lib/_collection_dev/iterable.dart b/sdk/lib/_collection_dev/iterable.dart
|
| index 82c6ebf12c6fb8300ba6bb17153e22e2de8d9d13..7013272c6ca420ddb7f99adf3b44859593143e73 100644
|
| --- a/sdk/lib/_collection_dev/iterable.dart
|
| +++ b/sdk/lib/_collection_dev/iterable.dart
|
| @@ -688,6 +688,9 @@ abstract class BidirectionalIterator<T> implements Iterator<T> {
|
| * The uses of this class will be replaced by mixins.
|
| */
|
| class IterableMixinWorkaround {
|
| + // A list to identify cyclic collections during toString() calls.
|
| + static List _toStringList = new List();
|
| +
|
| static bool contains(Iterable iterable, var element) {
|
| for (final e in iterable) {
|
| if (e == element) return true;
|
| @@ -881,6 +884,27 @@ class IterableMixinWorkaround {
|
| return buffer.toString();
|
| }
|
|
|
| + static String toStringIterable(Iterable iterable, String leftDelimiter,
|
| + String rightDelimiter) {
|
| + for (int i = 0; i < _toStringList.length; i++) {
|
| + if (identical(_toStringList[i], iterable)) {
|
| + return '$leftDelimiter...$rightDelimiter';
|
| + }
|
| + }
|
| +
|
| + StringBuffer result = new StringBuffer();
|
| + try {
|
| + _toStringList.add(iterable);
|
| + result.write(leftDelimiter);
|
| + result.writeAll(iterable, ', ');
|
| + result.write(rightDelimiter);
|
| + } finally {
|
| + assert(identical(_toStringList.last, iterable));
|
| + _toStringList.removeLast();
|
| + }
|
| + return result.toString();
|
| + }
|
| +
|
| static Iterable where(Iterable iterable, bool f(var element)) {
|
| return new WhereIterable(iterable, f);
|
| }
|
|
|