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

Unified Diff: runtime/lib/array_patch.dart

Issue 14402013: Revert "- Do not keep growing when creating Lists from Iterables." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
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 6a2ba292be04b0d14d06ce1ba73bf7663d29a366..386e8acfb9e0203241cc47a6007bfca4d10381fd 100644
--- a/runtime/lib/array_patch.dart
+++ b/runtime/lib/array_patch.dart
@@ -32,44 +32,6 @@ patch class List<E> {
return result;
}
- /* patch */ factory List.from(Iterable other, { bool growable: true }) {
- // TODO(iposva): Avoid the iterators for the known lists and do the copy in
- // the VM directly.
- var len = null;
- // TODO(iposva): Remove this dance once dart2js does not implement
- // an Iterable that throws on calling length.
- try {
- len = other.length;
- } catch (e) {
- // Ensure that we try again below.
- len = null;
- }
- if (len == null) {
- len = 0;
- try {
- var iter = other.iterator;
- while (iter.moveNext()) {
- len++;
- }
- } catch (e) {
- rethrow; // Giving up and throwing to the caller.
- }
- }
- var result;
- if (growable) {
- result = new _GrowableObjectArray<E>.withCapacity(len);
- result.length = len;
- } else {
- result = new _ObjectArray<E>(len);
- }
- var iter = other.iterator;
- for (var i = 0; i < len; i++) {
- iter.moveNext();
- result[i] = iter.current;
- }
- return result;
- }
-
// Factory constructing a mutable List from a parser generated List literal.
// [elements] contains elements that are already type checked.
factory List._fromLiteral(List elements) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698