Chromium Code Reviews| Index: dart/frog/leg/lib/mockimpl.dart |
| diff --git a/dart/frog/leg/lib/mockimpl.dart b/dart/frog/leg/lib/mockimpl.dart |
| index 5840bd4eece3c7a363925357792fb4fead177e6e..e9501e689e38463bd07a29586a7c48324ed63aff 100644 |
| --- a/dart/frog/leg/lib/mockimpl.dart |
| +++ b/dart/frog/leg/lib/mockimpl.dart |
| @@ -484,3 +484,15 @@ class DateImplementation implements Date { |
| return adjustedSeconds * Duration.MILLISECONDS_PER_SECOND + milliseconds; |
| } |
| } |
| + |
| +class ListFactory<E> implements List<E> { |
| + factory List([int length]) => Primitives.newList(length); |
| + factory List.from(Iterable<E> other) { |
| + List<E> result = new List<E>(); |
| + Iterator<E> iterator = other.iterator(); |
|
kasperl
2012/02/21 07:16:43
Wouldn't it be simpler with:
for (E element in
ahe
2012/02/21 23:03:25
Yes. I'll add a todo because for-in and bailout is
|
| + while (iterator.hasNext()) { |
| + result.add(iterator.next()); |
| + } |
| + return result; |
| + } |
| +} |