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

Side by Side Diff: test/generated_sdk/lib/collection/set.dart

Issue 1122313002: Typing fixes to eliminate casts/dcalls (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Rebase Created 5 years, 7 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 /** 5 /**
6 * Base implementations of [Set]. 6 * Base implementations of [Set].
7 */ 7 */
8 part of dart.collection; 8 part of dart.collection;
9 9
10 /** 10 /**
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 int i = 0; 118 int i = 0;
119 for (E element in this) result[i++] = element; 119 for (E element in this) result[i++] = element;
120 return result; 120 return result;
121 } 121 }
122 122
123 Iterable map(f(E element)) => 123 Iterable map(f(E element)) =>
124 new EfficientLengthMappedIterable<E, dynamic>(this, f); 124 new EfficientLengthMappedIterable<E, dynamic>(this, f);
125 125
126 E get single { 126 E get single {
127 if (length > 1) throw IterableElementError.tooMany(); 127 if (length > 1) throw IterableElementError.tooMany();
128 Iterator it = iterator; 128 Iterator<E> it = iterator;
129 if (!it.moveNext()) throw IterableElementError.noElement(); 129 if (!it.moveNext()) throw IterableElementError.noElement();
130 E result = it.current; 130 E result = it.current;
131 return result; 131 return result;
132 } 132 }
133 133
134 String toString() => IterableBase.iterableToFullString(this, '{', '}'); 134 String toString() => IterableBase.iterableToFullString(this, '{', '}');
135 135
136 // Copied from IterableMixin. 136 // Copied from IterableMixin.
137 // Should be inherited if we had multi-level mixins. 137 // Should be inherited if we had multi-level mixins.
138 138
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 Iterable<E> skip(int n) { 207 Iterable<E> skip(int n) {
208 return new SkipIterable<E>(this, n); 208 return new SkipIterable<E>(this, n);
209 } 209 }
210 210
211 Iterable<E> skipWhile(bool test(E value)) { 211 Iterable<E> skipWhile(bool test(E value)) {
212 return new SkipWhileIterable<E>(this, test); 212 return new SkipWhileIterable<E>(this, test);
213 } 213 }
214 214
215 E get first { 215 E get first {
216 Iterator it = iterator; 216 Iterator<E> it = iterator;
217 if (!it.moveNext()) { 217 if (!it.moveNext()) {
218 throw IterableElementError.noElement(); 218 throw IterableElementError.noElement();
219 } 219 }
220 return it.current; 220 return it.current;
221 } 221 }
222 222
223 E get last { 223 E get last {
224 Iterator it = iterator; 224 Iterator<E> it = iterator;
225 if (!it.moveNext()) { 225 if (!it.moveNext()) {
226 throw IterableElementError.noElement(); 226 throw IterableElementError.noElement();
227 } 227 }
228 E result; 228 E result;
229 do { 229 do {
230 result = it.current; 230 result = it.current;
231 } while(it.moveNext()); 231 } while(it.moveNext());
232 return result; 232 return result;
233 } 233 }
234 234
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 abstract class SetBase<E> extends SetMixin<E> { 302 abstract class SetBase<E> extends SetMixin<E> {
303 /** 303 /**
304 * Convert a `Set` to a string as `{each, element, as, string}`. 304 * Convert a `Set` to a string as `{each, element, as, string}`.
305 * 305 *
306 * Handles circular references where converting one of the elements 306 * Handles circular references where converting one of the elements
307 * to a string ends up converting [set] to a string again. 307 * to a string ends up converting [set] to a string again.
308 */ 308 */
309 static String setToString(Set set) => 309 static String setToString(Set set) =>
310 IterableBase.iterableToFullString(set, '{', '}'); 310 IterableBase.iterableToFullString(set, '{', '}');
311 } 311 }
OLDNEW
« no previous file with comments | « test/generated_sdk/lib/collection/linked_hash_set.dart ('k') | test/generated_sdk/lib/collection/splay_tree.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698