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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/util/link_implementation.dart

Issue 12401002: Make List.from and Iterable.toList default to not growable. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/util/link.dart ('k') | sdk/lib/collection/queue.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of util_implementation; 5 part of util_implementation;
6 6
7 class LinkIterator<T> implements Iterator<T> { 7 class LinkIterator<T> implements Iterator<T> {
8 T _current; 8 T _current;
9 Link<T> _link; 9 Link<T> _link;
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 if (link.isEmpty) { 74 if (link.isEmpty) {
75 throw new RangeError('Index $n out of range'); 75 throw new RangeError('Index $n out of range');
76 } 76 }
77 link = link.tail; 77 link = link.tail;
78 } 78 }
79 return link; 79 return link;
80 } 80 }
81 81
82 bool get isEmpty => false; 82 bool get isEmpty => false;
83 83
84 List<T> toList({ bool growable: false }) { 84 List<T> toList({ bool growable: true }) {
85 return new List<T>.from(this, growable: growable); 85 return new List<T>.from(this, growable: growable);
86 } 86 }
87 87
88 void forEach(void f(T element)) { 88 void forEach(void f(T element)) {
89 for (Link<T> link = this; !link.isEmpty; link = link.tail) { 89 for (Link<T> link = this; !link.isEmpty; link = link.tail) {
90 f(link.head); 90 f(link.head);
91 } 91 }
92 } 92 }
93 93
94 bool operator ==(other) { 94 bool operator ==(other) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 if (head == null) { 129 if (head == null) {
130 head = entry; 130 head = entry;
131 } else { 131 } else {
132 lastLink.tail = entry; 132 lastLink.tail = entry;
133 } 133 }
134 lastLink = entry; 134 lastLink = entry;
135 } 135 }
136 136
137 bool get isEmpty => length == 0; 137 bool get isEmpty => length == 0;
138 } 138 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/util/link.dart ('k') | sdk/lib/collection/queue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698