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

Unified Diff: runtime/lib/array_patch.dart

Issue 838463002: Change List/Set/Map/Queue.from constructrs to accept any iterable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/js_lib/core_patch.dart » ('j') | sdk/lib/collection/hash_map.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/array_patch.dart
diff --git a/runtime/lib/array_patch.dart b/runtime/lib/array_patch.dart
index 424a65110fc2ba0fba52290b3d82bfa1a10d1088..37c697c9d3ddd0524c7cf9a69f602e1de6e0323b 100644
--- a/runtime/lib/array_patch.dart
+++ b/runtime/lib/array_patch.dart
@@ -32,16 +32,16 @@ patch class List<E> {
return result;
}
- /* patch */ factory List.from(Iterable other, { bool growable: true }) {
- if (other is EfficientLength) {
- int length = other.length;
+ /* patch */ factory List.from(Iterable elements, { bool growable: true }) {
+ if (elements is EfficientLength) {
+ int length = elements.length;
var list = growable ? new _GrowableList<E>(length) : new _List<E>(length);
int i = 0;
- for (var element in other) { list[i++] = element; }
+ for (var element in elements) { list[i++] = element; }
return list;
}
List<E> list = new _GrowableList<E>(0);
- for (E e in other) {
+ for (E e in elements) {
list.add(e);
}
if (growable) return list;
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/js_lib/core_patch.dart » ('j') | sdk/lib/collection/hash_map.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698