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

Unified Diff: dart/frog/leg/lib/mockimpl.dart

Issue 9355031: Improve List implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 10 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: 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;
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698